PayPal REST API不接受自定义的送货地址

Cup*_*upi 6 paypal paypal-sandbox

我在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"
        }
    }
}]
Run Code Online (Sandbox Code Playgroud)

}

然后,我将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对象中!) .

谢谢.

小智 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"
        }
      },
      .....
}
Run Code Online (Sandbox Code Playgroud)

如果您没有看到这一点,我会联系Paypal 的技术支持并提交故障单。因为这是您应该得到的回应。