我是 paypal API 的新手。我正在尝试将钱从一个 Paypal 账户转账到另一个 Paypal 账户,但出现错误。所以请检查我的代码并告诉我错误是什么。欢迎您提出建议。
这是我正在尝试的代码:
$receiverList=array();
$receiverList["receiver"][$counter]["amount"]=50;
$receiverList["receiver"][$counter]["email"]='amandeep.singh@#######.com';
$receiverList["receiver"][$counter]["paymentType"]="PAY";
$receiverList["receiver"][$counter]["invoiceId"]=1548569;
$payLoad["actionType"]="PAY";
$payLoad["cancelUrl"]="";
$payLoad["currencyCode"]="EUR";
$payLoad["receiverList"]=$receiverList;
$payLoad["feesPayer"]="SENDER ";
$payLoad["sender"]["email"]='amandeep.singh@#######.com';
//run the call
$API_Endpoint = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";
$payLoad["requestEnvelope"]= array("errorLanguage"=>urlencode("en_US"),"detailLevel"=>urlencode("ReturnAll"));
$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);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-PAYPAL-REQUEST-DATA-FORMAT: JSON',
'X-PAYPAL-RESPONSE-DATA-FORMAT: JSON',
'X-PAYPAL-SECURITY-USERID: amandeep.singh-facilitator_api1.mobilyte.com',
'X-PAYPAL-SECURITY-PASSWORD: AZVMY9FZK2J#####',
'X-PAYPAL-SECURITY-SIGNATURE: AFcWxV21C7fd0v3bYYYRCpSSRl31AodeBybN3aK381NetHgWkUW1####',
'X-PAYPAL-APPLICATION-ID: APP-80W28##########3'));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payLoad));
$response = curl_exec($ch);
$response = json_decode($response, 1);
在调用 curl 后,paypal 返回此错误:-
Array ( [responseEnvelope] => Array ( [timestamp] => 2016-02-21T21:58:24.854-08:00 [ack] => Failure [correlationId] => 3693e36af347f [build] => 20367699 ) [error] => Array ( [0] => Array ( [errorId] => 560022 [domain] => PLATFORM [subdomain] => Application [severity] => Error [category] => Application [message] => The X-PAYPAL-APPLICATION-ID header contains an invalid value [parameter] => Array ( [0] => X-PAYPAL-APPLICATION-ID ) ) ) )
最佳答案
沙盒和直播的APPID是不同的。
沙盒应使用以下 ID :
APP-80W284485P519543T
并且live使用的是类似于APP凭据的ID。
关于php - 如何将钱从 Paypal 转移到付款?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35546892/