PHP - PayPal Parallel Payments Error

I am trying to implement PayPal Parallel Payments on my website, which manages transactions between end users and the end user selected bus company. During the process, 10% of the total amount must be given to my company and the rest to the bus company. This is my PHP code (I'll remove some parts that are not relevant to the question):

$compMail = [...];
$amount = [...];
$myAmount = ($amount * 10) / 100;
$amountCompany = $amount - $myAmount;

$API_Endpoint = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);

$credentials = array(
'X-PAYPAL-SECURITY-USERID: '. "sdk-three_api1.sdk.com",
'X-PAYPAL-SECURITY-PASSWORD: '. "xxxx",
'X-PAYPAL-SECURITY-SIGNATURE: '. "A‑xxxxx",
'X-PAYPAL-REQUEST-DATA-FORMAT: NV',
'X-PAYPAL-RESPONSE-DATA-FORMAT: NV',
'X-PAYPAL-APPLICATION-ID: '. "APP-XXX"
);

curl_setopt($ch, CURLOPT_HTTPHEADER, $credentials);

$detail_level = urlencode("ReturnAll");
$error_language = urlencode("it_IT");

$nvp_req = "actionType=PAY&clientDetails.applicationId=APP-80W284485P519543T&clientDetails.ipAddress=127.0.0.1&currencyCode=EUR&feesPayer=EACHRECEIVER&memo=Example&receiverList.receiver(0).amount=$amountCompany&receiverList.receiver(0).email=$compMail&receiverList.receiver(0).primary=true&receiverList.receiver(1).amount=$myAmount&receiverList.receiver(1).email=bitleapps@gmail.com&receiverList.receiver(1).primary=false&requestEnvelope.errorLanguage=it_IT&returnUrl=[...]&cancelUrl=[...]";

curl_setopt($ch, CURLOPT_POSTFIELDS, $nvp_req);

$response = curl_exec($ch);
echo $response;

      

But when this code is executed, this is the answer:

responseEnvelope.timestamp=2015-07-12T04%3A55%3A28.308-07%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=b33b7d0d86ca3&responseEnvelope.build=17325060&error(0).errorId=520002&error(0).domain=PLATFORM&error(0).subdomain=Application&error(0).severity=Error&error(0).category=Application&error(0).message=Internal+Error&error(0).parameter(0)=Client+exception%2C+while+calling+AuthAndAuth.authenticate_and_authorize+1.1%3A

      

How can I solve my problem?

+3


source to share





All Articles