【发布时间】:2017-06-22 15:56:59
【问题描述】:
我只是在尝试使用 paypal 链式付款进行测试,这真的很令人沮丧。我这次测试的目标是先向主要接收者发送 15 美元,然后再向次要接收者发送 1 美元。这是我的代码:
$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" => "rbxseller1@gmail.com",
"primary" => true
),
"receiver" => array( //send owner of site $1 commission
"amount" => "1.00",
"email" => "rbxowner@gmail.com",
"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":"rbxowner@gmail.com","primary":"false","paymentType":"SERVICE" ,"accountId":"6LBSVJQNVE9DA"},"pendingRefund":"false"}]}
我尝试将“actionType”设置为“PAY_PRIMARY”,但它给了我这个错误:
"message":"请求参数无效:动作类型 PAY_PRIMARY 只能用于链式支付","parameter":["PAY_PRIMARY"]
我在 youtube、stackoverflow、一些论坛网站等上查找它并没有找到太多有用的信息,这让我感到非常沮丧。
非常感谢愿意花时间阅读本文并帮助我的人!
【问题讨论】:
-
it's really frustrating欢迎来到 Paypal 的世界。