gpt4 book ai didi

PayPal REST API 不采用自定义送货地址

转载 作者:太空宇宙 更新时间:2023-11-03 15:40:46 26 4
gpt4 key购买 nike

我正在关注位于 https://developer.paypal.com/webapps/developer/docs/api/ 的 PayPal REST API 引用创建和执行付款。

为了创建付款,我将以下数据发送到 PayPal。数据包含“shipping_address”。付款创建成功。

{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://www.somethingabc.com/approve",
"cancel_url": "http://www.somethingabc.com/cancel"
},
"transactions": [{
"amount": {
"currency": "USD",
"total": "10.00",
"details": {
"shipping": "0.00",
"subtotal": "10.00",
"tax": "0.00"
}
},
"item_list": {
"items": [{
"quantity": "1",
"name": "Apples",
"price": "10.00",
"currency": "USD"
}],
"shipping_address": {
"recipient_name": "John",
"type": "residential",
"line1": "441 Waterdale RD",
"city": "Heidelberg West",
"country_code": "AU",
"postal_code": "3081",
"state": "VICTORIA"
}
}
}]

然后,我将 Web 浏览器重定向到 PayPal 响应中提供的 approval_url(例如 https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-343434SADSDSAD34),以便用户登录并批准付款。用户登录并出现 PayPal 评论网页。我希望此评论页面应该显示我之前在创建付款时提供的自定义送货地址。但是,PayPal 评论网页显示的是 PayPal 所有者的地址。

那么,我的问题是如何强制 PayPal 评论网页显示自定义的送货地址而不是 PayPal 所有者的地址?如果做不到,如何获取用户在PayPal评论页面上选择的收货地址(当我调用API执行支付时,选择的收货地址不包含在payer_info对象中!) .

谢谢。

最佳答案

测试您的代码后,我没有发现任何错误。完成付款时得到的响应:

{
"id": "PAY-xxxxxxx",
"create_time": "2014-05-01T23:54:00Z",
"update_time": "2014-05-01T23:59:35Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"email": "test@paypal.com",
"first_name": "John",
"last_name": "Smith",
"payer_id": "GPV2878GCMNGE",
"shipping_address": {
"line1": "441 Waterdale RD",
"city": "Heidelberg West",
"state": "Victoria",
"postal_code": "3081",
"country_code": "AU"
}
}
},
"transactions": [
{
"amount": {
"total": "10.00",
"currency": "USD",
"details": {
"subtotal": "10.00"
}
},
"item_list": {
"items": [
{
"name": "Apples",
"price": "10.00",
"currency": "USD",
"quantity": "1"
}
],
"shipping_address": {
"recipient_name": "John",
"line1": "441 Waterdale RD",
"city": "Heidelberg West",
"state": "VICTORIA",
"postal_code": "3081",
"country_code": "AU"
}
},
.....
}

如果您没有看到这个,我会联系 Paypal's Technical Support并提交故障单。因为这是您应该得到的响应。

关于PayPal REST API 不采用自定义送货地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19508080/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com