我只是试图用PayPal链接付款进行测试,这真的令人沮丧。我的这个测试的目标是发送主接收器$ 15,然后$ 1发送到辅助接收器。这里是我的代码:PayPal链接付款帮助[PHP]
$api = "https://svcs.sandbox.paypal.com/AdaptivePayments/Pay";
$input = array(
"actionType" => "PAY",
"currencyCode" => "USD",
"feesPayer" => "EACHRECEIVER",
"cancelUrl" => "https://www.google.com", //test url
"returnUrl" => "https://www.google.com", //test url
"receiverList" => array(
"receiver" => array(//send primary receiver $15
"amount" => "15.00",
"email" => "[email protected]",
"primary" => true
),
"receiver" => array(//send owner of site $1 commission
"amount" => "1.00",
"email" => "[email protected]",
"primary" => false
)
),
"requestEnvelope" => array(
"errorLanguage" => "en_US"
)
);
$headers = array(
"X-PAYPAL-SECURITY-USERID: ".USER_ID, //predefined
"X-PAYPAL-SECURITY-PASSWORD: ".USER_PASS, //predefined
"X-PAYPAL-SECURITY-SIGNATURE: ".USER_SIG, //predefined
"X-PAYPAL-REQUEST-DATA-FORMAT: JSON",
"X-PAYPAL-RESPONSE-DATA-FORMAT: JSON",
"X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T"
);
$ch = curl_init($api);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($input));
$response = curl_exec($ch);
var_dump($response);
当我尝试这样做,它的工作原理,但在我的付款细节,只显示了$ 1二级接收器,不存在主接收器的跟踪:
{"paymentInfo":[{"receiver":{"amount":"1.00","email":"[email protected]","primary":"false","paymentType":"SERVICE","accountId":"6LBSVJQNVE9DA"},"pendingRefund":"false"}]}
我尝试了“操作类型”设置为“PAY_PRIMARY”,它给了我这个错误:
"message":"Invalid request parameter: action type PAY_PRIMARY can only be used in chained payments","parameter":["PAY_PRIMARY"]
它变得相当令人沮丧,因为我看着它在YouTube上,计算器,一些论坛网站等并没有找到很多有用的信息。
非常感谢任何会花时间阅读本文并帮助我的人!
'这真是令人沮丧'欢迎来到贝宝的世界。 – Martin