在Paypal智能付款按钮上设置国家/地区和电话

时间:2019-08-23 00:23:57

标签: paypal paypal-sandbox

使用Smart Payment Buttons向PayPal发送动态付款时,我试图设置国家和电话号码。

我确保与REST应用程序关联的沙箱帐户也来自加拿大。

这是我在actions.order.create()中输入的订单:

{
    "purchase_units": [{
        "items": [{
            "name": "Test Item",
            "quantity": 1,
            "unit_amount": {
                "value": "125.01",
                "currency_code": "CAD"
            }
        }, {
            "name": "Beach Therapy",
            "quantity": 1,
            "unit_amount": {
                "value": "1010.00",
                "currency_code": "CAD"
            }
        }],
        "amount": {
            "value": "1135.01",
            "currency_code": "CAD",
            "breakdown": {
                "item_total": {
                    "value": "1135.01",
                    "currency_code": "CAD"
                }
            }
        }
    }],
    "application_context": {
        "brand_name": "TEST",
        "landing_page": "BILLING",
        "shipping_preference": "NO_SHIPPING",
        "user_action": "PAY_NOW",
        "locale": "en-CA"
    },
    "payer": {
        "email_address": "wafe@fewa.com",
        "phone": {
            "phone_number": {
                "national_number": "16135802400"
            }
        },
        "address": {
            "address_line_1": "",
            "address_line_2": "",
            "admin_area_2": "Ottawa",
            "admin_area_1": "ON",
            "postal_code": "K1P",
            "country_code": "CA"
        }
    }
}

1 个答案:

答案 0 :(得分:0)

不完整的答案:

只是碰到了这一点。期待尝试。

<script src="https://www.paypal.com/sdk/js?client-id=sb"></script>
<script>paypal.Buttons({
  enableStandardCardFields: true,
  createOrder: function(data, actions) {
    return actions.order.create({
      intent: 'CAPTURE',
      payer: {
        name: {
          given_name: "PayPal",
          surname: "Customer"
        },
        address: {
          address_line_1: '123 Fake Street',
          address_line_2: 'Apt 2',
          admin_area_2: 'San Jose',
          admin_area_1: 'CA',
          postal_code: '95121',
          country_code: 'US'
        },
        email_address: "customer@domain.com",
        phone: {
          phone_type: "MOBILE",
          phone_number: {
            national_number: "14082508100"
          }
        }
      },
      purchase_units: [
        {
          amount: {
            value: '15.00',
            currency_code: 'USD'
          },
          shipping: {
            address: {
              address_line_1: '2211 N First Street',
              address_line_2: 'Building 17',
              admin_area_2: 'San Jose',
              admin_area_1: 'CA',
              postal_code: '95131',
              country_code: 'US'
            }
          },
        }
      ]
    });
  }
}).render("body");
</script>

来源:Paypal - Standard Card Fields