贝宝智能按钮信用卡填充或隐藏电话号码

问题描述

我允许使用Paypal智能按钮进行信用卡付款。这是我的createOrder的样子:

createOrder: function(data,actions) {
    paypalActions = actions;
    return fetch('/basket/get/lineitems',{
            method: 'get'
        }).then(function(res) {
            return res.json();
        }).then(function(orderData) {
            orderDataArray = [orderData]
            return actions.order.create({
                payer: {
                    name: {
                    given_name: "PayPal",surname: "Customer"
                    },address: {
                    address_line_1: '123 ABC 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: "12345678"
                    }
                    }
                },purchase_units: orderDataArray,shipping_type: 'PICKUP',application_context: { shipping_preference: 'NO_SHIPPING' }
            })
        });

},

获取请求会获取我的卡片项目。)

下面是文档:https://developer.paypal.com/docs/checkout/integration-features/standard-card-fields/#optimize-the-card-fields,可以很好地传递我已经拥有的帐单地址。只有电话号码没有填写。

enter image description here

用上面的示例填写电话字段需要什么?甚至可以将其设置为不需要吗?

解决方法

国家号码的号码长度是对API的验证;以美国为例,您需要正确的电话号码长度。对于美国号码,它预期为1 ### ### ####