簡體   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