6

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

谢谢。

4

2 回答 2

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

于 2014-05-02T00:02:54.177 回答
0

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

开始销售时,您将在 JSON 请求中包含 experience_profile_id。

于 2017-01-30T09:13:54.720 回答