[英]PAYPAL php SDK v1.0.1, cannot set payee's email
我正在嘗試制作一個網站,將不同賣家的商品出售給不同的人。 我使用的是 PHP SDK,我無法在請求正文中設置收款人的電子郵件。 我已經檢查了文檔,並且根據paypal-orders-v2-payee-object-in-checkout-php-sdk-fails-with-amount-error ,位置錯誤,因此我進行了相應的修復。 但是我的回復(來自創建訂單)顯示收款人與我設置的不同。
這里是createorder.php里面的請求生成函數,當用戶點擊支付按鈕時調用。
function buildRequestBody()
{
return array(
'intent' => 'CAPTURE',
'application_context' =>
array(
'return_url' => 'https://example.com/return',
'cancel_url' => 'https://example.com/cancel'
),
'purchase_units' =>
array(
0 =>
array(
'amount' =>
array(
'currency_code' => 'EUR',
'value' => '221.00'
),
array(
'payee' =>
array(
'email_address' => 'sb-qloys3515897@business.example.com'//a business account which I created (sandbox)
)
)
)
)
);
}
以下是訂單創建返回的內容:
{
"statusCode": 201,
"result": {
"id": "5P300384200963842",
"intent": "CAPTURE",
"status": "CREATED",
"purchase_units": [
{
"reference_id": "default",
"amount": {
"currency_code": "EUR",
"value": "221.00"
},
"payee": {
"email_address": "sb-acw7h3524652@business.example.com",//the email is different (this is actually the sandbox's default business account)
"merchant_id": "HYDLKKLS2AC9G"
}
}
],
"create_time": "2020-10-22T18:01:17Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/5P300384200963842",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/checkoutnow?token=5P300384200963842",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/5P300384200963842",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/5P300384200963842/capture",
"rel": "capture",
"method": "POST"
}
]
},
"headers": {
"": "",
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
"Content-Length": "748",
"Content-Type": "application/json",
"Date": "Thu, 22 Oct 2020 18",
"Paypal-Debug-Id": "88a1fa19cd8c9"
}
}
收款人對象數組仍然在錯誤的地方。 這個調整后的樣本對你有用嗎? (未測試)
private static function buildRequestBody()
{
return array(
'intent' => 'AUTHORIZE',
'purchase_units' =>
array(
0 =>
array(
'amount' =>
array(
'currency_code' => 'USD',
'value' => '220.00'
),
'payee' =>
array(
'email_address' => 'payee@email.com'
)
)
)
);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.