我正在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"
}
}
}]
}
然后,我将网络浏览器重定向到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对象中!)
感谢。
答案 0 :(得分:0)
测试代码后,我找不到任何错误。我在完成付款时得到的回复:
{
"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并提交故障单。因为这是你应该得到的回应。
答案 1 :(得分:0)
您需要创建一个经验资料,并将address_override选项设置为1.客户将无法更改您传递给PayPal的送货地址。
您可以在启动销售时在您的JSON请求中包含experience_profile_id。