如何转账PayPal付款?

时间:2016-02-22 06:13:33

标签: php paypal payment-gateway paypal-sandbox

我是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 ) ) ) ) 

1 个答案:

答案 0 :(得分:1)

沙箱和直播的 APPID 彼此不同。

Sand Box应与以下ID一起使用:

  

APP-80W284485P519543T

live与ID一起使用,类似于APP凭证。