首页 > 解决方案 > 如何使用脚本自定义 PayPal 按钮?

问题描述

我是 PayPal 集成和设置的新手,并尝试在以下脚本中自定义 PayPal 按钮。

<script src="https://www.paypal.com/sdk/js?client-id=sb"> // Required. Replace SB_CLIENT_ID with your sandbox client ID.
</script>
<div id="paypal-button-container"></div>
<script>
    paypal.Buttons({
        style: {
            layout: 'horizontal',
            color: 'gold',
            shape: 'pill',
            label: 'paypal'
        },
        createOrder: function (data, actions) {
            // This function sets up the details of the transaction, including the amount and line item details.
            return actions.order.create({
                purchase_units: [{
                    amount: {
                        value: '0.01'
                    }
                }]
            });
        }
    }).render('#paypal-button-container');
</script>

在他们的文档中,在我没有收到的按钮中发短信之前有一个 PayPal 图标,所以请您指导我为什么我没有收到它。

上述代码的输出

在此处输入图像描述

https://developer.paypal.com/docs/checkout/integration-features/customize-button/#layout

标签: htmlpaypal

解决方案


在他们的文档中,在我没有收到的按钮中发短信之前有一个 PayPal 图标,所以请您指导我为什么我没有收到它。

该文档已过期。几个月前,第一个按钮 (PayPal) 不再包含徽标。

您正在看到当前和正确的行为。


推荐阅读