繁体   English   中英

PHP中的PayPal自适应链式付款方法

[英]PayPal Adaptive Chained Payments method in php

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失败。 API凭证不正确。

据我了解,您正在使用沙盒环境来测试自适应链式支付。 如果愿意,请使用沙箱帐户凭据,APP-ID为APP-80W284485P519543T,端点为$ API_Endpoint =“ https://svcs.sandbox.paypal.com/AdaptivePayments/Pay ”;

对于Live,您需要请求APP ID并将端点设置为live。 使用真实帐户凭据。

对于PHP代码,请单击此处

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM