【发布时间】:2021-02-05 19:52:13
【问题描述】:
我正在尝试创建一个网站,将来自不同卖家的商品出售给不同的人。我使用的是 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"
}
}
【问题讨论】:
标签: php paypal paypal-sandbox