I am using the master-sdk-php paypal api for making a billing agreement for reference transactions.
I got the token using the api SetExpressCheckout().Below is response :-
PayPal\PayPalAPI\SetExpressCheckoutResponseType Object
(
[Token] => EC-1EG869789X969882G
[Timestamp] => 2014-09-08T05:52:43Z
[Ack] => Success
[CorrelationID] => 84464deca9458
[Errors] =>
[Version] => 104.0
[Build] => 12658619
)
but it is not working when I am calling the CreateBillingAgreement() api call.
I tested the code with demo api credentials and working fine. But it not working with my api credentials.
It is giving me Internal Error
Below is api call :-
// Include required library files.
require_once($main_path.'paypal_lib/includes/config.php');
require_once($main_path.'paypal_lib/autoload.php');
// Create PayPal object.
$PayPalConfig = array(
'Sandbox' => $sandbox,
'APIUsername' => 'bharat.maheshwari_api1.dotsquares.com',
'APIPassword' => '********',
'APISignature' => '*******',
'PrintHeaders' => $print_headers,
'LogResults' => $log_results,
'LogPath' => $log_path,
);
$PayPal = new angelleye\PayPal\PayPal($PayPalConfig);
// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$Token = $_REQUEST['token'];
$PayPalResult = $PayPal->CreateBillingAgreement($_REQUEST['token']);
// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);
I have used below api credentials for testing :-
$PayPalConfig = array(
'Sandbox' => $sandbox,
'APIUsername' => 'jb-us-seller_api1.paypal.com',
'APIPassword' => 'WX4WTU3S8MY44S7F',
'APISignature' => 'AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy',
'PrintHeaders' => $print_headers,
'LogResults' => $log_results,
'LogPath' => $log_path,
);
And code working fine but not working with my api credentials.I used my details with other adaptive payment api and working fine. It is generating token also with my details.
Response from paypal :-
Array
(
[TIMESTAMP] => 2014-09-08T04:54:02Z
[CORRELATIONID] => ec2641e7483b6
[ACK] => Failure
[VERSION] => 112.0
[BUILD] => 12658619
[L_ERRORCODE0] => 10001
[L_SHORTMESSAGE0] => Internal Error
[L_LONGMESSAGE0] => Internal Error
[L_SEVERITYCODE0] => Error
[ERRORS] => Array
(
[0] => Array
(
[L_ERRORCODE] => 10001
[L_SHORTMESSAGE] => Internal Error
[L_LONGMESSAGE] => Internal Error
[L_SEVERITYCODE] => Error
)
)
[REQUESTDATA] => Array
(
[USER] => bharat.maheshwari_business_api1.dotsquares.com
[PWD] => ******
[VERSION] => 112.0
[BUTTONSOURCE] => AngellEYE_PHPClass
[SIGNATURE] => ******
[METHOD] => CreateBillingAgreement
[TOKEN] => EC-28P65999553574317
)
[RAWREQUEST] => USER=bharat.maheshwari_business_api1.dotsquares.com&PWD=******&VERSION=112.0&BUTTONSOURCE=AngellEYE_PHPClass&SIGNATURE=*******2&METHOD=CreateBillingAgreement&TOKEN=EC-28P65999553574317
[RAWRESPONSE] => TIMESTAMP=2014%2d09%2d08T04%3a54%3a02Z&CORRELATIONID=ec2641e7483b6&ACK=Failure&VERSION=112%2e0&BUILD=12658619&L_ERRORCODE0=10001&L_SHORTMESSAGE0=Internal%20Error&L_LONGMESSAGE0=Internal%20Error&L_SEVERITYCODE0=Error
)
Issue has been solved. It was due to my account was not enabled for reference transaction. It was enabled by paypal support team.