简体   繁体   English

Django/JS/Paypal 按钮集成中的自定义位置选择

[英]Customized location choices in Django/JS/Paypal Buttons Integration

Below I have my Payal Checkout setup.下面我有我的付款结帐设置。 User can input any address they want but I want to limit the country, State/Province, and City choices they have with a dropdown menu.用户可以输入他们想要的任何地址,但我想通过下拉菜单限制他们拥有的国家、州/省和城市选择。

我的贝宝结帐

Does anyone know how to do that?有谁知道这是怎么做到的吗? or any alternate options for this?或任何替代选项?

You cannot limit a user's billing address, it is outside your control They are free to enter any billing address.您不能限制用户的帐单地址,它不在您的控制范围内。他们可以自由输入任何帐单地址。

If you prompt for a shipping address using your own form before displaying the buttons, you can pass that shipping address to PayPal and use the application_context object's SET_PROVIDED_ADDRESS object to force the use of the shipping address you have collected and validated.如果您在显示按钮之前使用您自己的表单提示输入送货地址,您可以将该送货地址传递给 PayPal 并使用 application_context 对象的 SET_PROVIDED_ADDRESS object 来强制使用您收集和验证的送货地址。

For example:例如:

"application_context": {
  "shipping_preference": "SET_PROVIDED_ADDRESS"
},
"purchase_units": [{
  "shipping": {
    "address": {
      "address_line_1": "123 Sunny Lane",
      "admin_area_2": "Phoenix",
      "admin_area_1": "AZ",
      "postal_code": "85001",
      "country_code": "US",
    },
    "name": {
      "full_name":"John Doe",
    }
  },
  "amount": {
    "currency_code": "USD",
    "value": "123.45"
  },
}]

PayPal doesn't recommend this integation, for two reasons: PayPal 不推荐这种集成,原因有两个:

1) If you collect an invalid address, the payment attempt will be rejected with an error (since you are forcing that address to be used), and checkout cannot proceed. 1) 如果您收集的地址无效,付款尝试将被拒绝并出现错误(因为您强制使用该地址),并且无法进行结帐。

2) You are adding friction to the checkout process by forcing users to manually enter an address. 2)您通过强制用户手动输入地址来增加结帐过程的摩擦。 Much of the benefit of the "PayPal" payment method, apart from security, is the ability to check out without having to type any payment or shipping information -- it's all all pre-saved in the buyer's account, allowing them to make a snap payment decision, thus increasing your site's sales "conversion" rate.除了安全性之外,“PayPal”支付方式的大部分好处是无需输入任何付款或运输信息即可结账——所有这些都预先保存在买家的账户中,让他们可以快速完成付款决定,从而提高您网站的销售“转化”率。

But well, there you go if you have this business need of controlling the addresses before the customer enters a checkout flow.但是,如果您有在客户进入结账流程之前控制地址的业务需求,那么您就是 go。 This same v2/orders syntax applies to client-side JavaScript buttons, or a server-side API-based integration (interacting with the appropriate front-end for buttons)此相同的v2/orders 语法适用于客户端 JavaScript 按钮,或基于服务器端 API 的集成(与相应的按钮前端交互)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM