PayPal自适应链式付款方式。我该如何整合这种方法?请提供一个示例代码,其中包含PHP语言示例 这是我的curl api请求请检查并告诉我我的错误在哪里
请求代码: -
$header_info = array(
'X-PAYPAL-SECURITY-USERID:'=>'test@gmail.com',
'X-PAYPAL-SECURITY-PASSWORD:'=>'************',
'X-PAYPAL-SECURITY-SIGNATURE:'=>'***************',
'X-PAYPAL-REQUEST-DATA-FORMAT:'=>'NV',
'X-PAYPAL-RESPONSE-DATA-FORMAT:'=>'NV',
'X-PAYPAL-APPLICATION-ID:'=>'QVH6C2AC7VWW2',
);
$nvpStr_='actionType=PAY_PRIMARY&clientDetails.applicationId=APP-80W284485P519543T&clientDetails.ipAddress=127.0.0.1¤cyCode=SGD&feesPayer=EACHRECEIVER&memo=Example&receiverList.receiver(0).amount=25.00&receiverList.receiver(0).email=retailah@gmail.com&receiverList.receiver(0).primary=true&receiverList.receiver(1).amount=5.00&receiverList.receiver(1).email=merchant@gmail.com&receiverList.receiver(1).primary=false&requestEnvelope.errorLanguage=en_US&returnUrl=http://www.yourdomain.com/success.html&cancelUrl=http://www.yourdomain.com/cancel.html';
$API_Endpoint = "https://svcs.paypal.com/AdaptivePayments/Pay";
// $API_Endpoint = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";
$version = urlencode('51.0');
// Set the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_info);
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_POSTFIELDS,$nvpStr_);
$httpResponse = curl_exec($ch);
pr($httpResponse ); die;
回应代码:
2017-05-05T22:05:24.585-07:00Failure159af6737a82e32250686520003PLATFORMApplicationErrorApplicationAuthentication failed。 API凭据不正确。
答案 0 :(得分:0)
据我所知,您正在使用沙箱环境来测试自适应链式支付。如果是这样,请使用沙盒帐户凭据,APP-ID为APP-80W284485P519543T,终点为$ API_Endpoint =“https://svcs.sandbox.paypal.com/AdaptivePayments/Pay”;
对于Live,您需要请求APP ID并将端点设置为live。使用真实帐户凭据。
对于PHP代码点击here