【问题标题】:PayPal REST API does not take the customized shipping addressPayPal REST API 不采用自定义收货地址
【发布时间】:2013-10-30 17:53:36
【问题描述】:

我正在关注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 对象中!) .

谢谢。

【问题讨论】:

  • 我测试了您的代码,它确实覆盖并强制使用默认送货地址。但是,我不确定这是否仅限于美国地址,因为我必须将其更改为美国地址,因为测试凭证是美国,它不会让我运送到 AU。

标签: paypal paypal-sandbox


【解决方案1】:

测试您的代码后,我找不到任何错误。完成付款后收到的回复:

{
  "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 并提交故障单。因为这是您应该得到的响应。

【讨论】:

    【解决方案2】:

    您需要创建一个将 address_override 选项设置为 1 的体验档案。然后客户将无法更改您传递给 PayPal 的送货地址。

    您可以在发起销售时在 JSON 请求中包含 experience_profile_id。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-11
      • 2021-07-12
      • 2021-11-25
      • 2014-12-06
      • 1970-01-01
      • 2020-06-15
      • 2019-04-01
      • 2014-08-19
      相关资源
      最近更新 更多