使用 Paypal 智能按钮上线

Posted

技术标签:

【中文标题】使用 Paypal 智能按钮上线【英文标题】:Go Live using Paypal Smart Buttons 【发布时间】:2020-10-06 11:35:11 【问题描述】:

我的智能按钮中有这个:

<script src="https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></script>

<script>
paypal.Buttons(
    createOrder: function (data, actions) 
        return actions.order.create(
            purchase_units: [
                
                    reference_id: "PUHF",
                    description: "Sporting Goods",

                    custom_id: "CUST-HighFashions",
                    soft_descriptor: "HighFashions",
                    amount: 
                        currency_code: "GBP",
                        value: "230.00",
                        breakdown: 
                            item_total: 
                                currency_code: "GBP",
                                value: "180.00"
                            ,
                            shipping: 
                                currency_code: "GBP",
                                value: "30.00"
                            ,
                            handling: 
                                currency_code: "GBP",
                                value: "10.00"
                            ,
                            tax_total: 
                                currency_code: "GBP",
                                value: "20.00"
                            ,
                            shipping_discount: 
                                currency_code: "GBP",
                                value: "10"
                            
                        
                    ,
                    items: [
                        
                            name: "T-Shirt",
                            description: "Green XL",
                            sku: "sku01",
                            unit_amount: 
                                currency_code: "GBP",
                                value: "90.00"
                            ,
                            tax: 
                                currency_code: "GBP",
                                value: "10.00"
                            ,
                            quantity: "1",
                            category: "PHYSICAL_GOODS"
                        ,
                        
                            name: "Shoes",
                            description: "Running, Size 10.5",
                            sku: "sku02",
                            unit_amount: 
                                currency_code: "GBP",
                                value: "45.00"
                            ,
                            tax: 
                                currency_code: "GBP",
                                value: "5.00"
                            ,
                            quantity: "2",
                            category: "PHYSICAL_GOODS"
                        
                    ],
                    shipping: 
                        method: "United States Postal Service",
                        address: 
                            name: 
                                full_name: "John",
                                surname: "Doe"
                            ,
                            address_line_1: "123 Townsend St",
                            address_line_2: "Floor 6",
                            admin_area_2: "San Francisco",
                            admin_area_1: "CA",
                            postal_code: "94107",
                            country_code: "UK"
                        
                    
                
            ]
        );
    ,
    onApprove: function (data, actions) 
        return actions.order.capture().then(function (details) 
            alert('Transaction completed by ' + details.payer.name.given_name);
            // Call your server to save the transaction

        );
    
).render('#paypal-button-container');
</script>

我已登录我的沙盒 paypal 帐户,查看测试资金是否通过了它。 但是如何让这些智能按钮生效呢?

我需要改变什么?

另外,如果我使用智能按钮输入信用卡详细信息,用户是否必须拥有贝宝帐户才能使用信用卡智能按钮通过信用卡付款?

【问题讨论】:

【参考方案1】:

要上线,请将client-id 更改为 应用在 https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplications

借记卡/信用卡按钮通常会扩展为不需要帐户的卡形式

【讨论】:

以上是关于使用 Paypal 智能按钮上线的主要内容,如果未能解决你的问题,请参考以下文章

使用 Javascript 智能按钮灯箱的 PayPal 访客订阅未关闭

Paypal 智能按钮结账,无需运费

Paypal 智能按钮订阅状态

PayPal 智能支付按钮 - 请求数量

使用旧状态的 PayPal 智能支付按钮

Paypal 智能按钮无法正确呈现