Braintree 自定义贝宝按钮

2021-12-29 00:00:00 php paypal braintree

我想为付款方式创建一个下拉列表.

I would like to create a drop-down list for payment methods.

例如:

<ul>
  <li id="paypal">paypal</li>
  <li id="credit_card">credit card</li>
</ul>

在选择的信用卡上,它会加载信用卡付款所需的所有字段.但是现在我在设置贝宝按钮时遇到了麻烦.我真的不想要一个蓝色按钮.我可以让用户点击 id="paypal" 并启动 paypal 吗?

On select credit card, it loads all fields needed for credit card payment. But now I am having trouble setting up a paypal button. I don't really want a blue button. Can I have the user click id="paypal" and launch paypal?

  braintree.setup(token,"custom",{
    paypal:{
      container:"paypal",
      amount: 10.00,
      currency: 'USD'
    }
  })

我可以让它完全自定义吗?我希望贝宝按钮看起来像我的 CSS 列表中的一个项目.

Can I make it completely custom looking? I want the paypal button just look like an item in the list with my CSS.

推荐答案

Braintree 员工在这里.从 2.15.0 开始,我们引入了headless"选项,允许自定义贝宝按钮.

Braintree employee here. As of 2.15.0, we introduced a "headless" option that allows a custom PayPal button.

这项工作在这些 JS 网址上进行:
https://js.braintreegateway.com/js/braintree-2.15.2.js
https://js.braintreegateway.com/js/braintree-2.15.2.min.js

This work is live at these JS urls:
https://js.braintreegateway.com/js/braintree-2.15.2.js
https://js.braintreegateway.com/js/braintree-2.15.2.min.js

我们创建了一个提供示例代码的小要点.此版本尚未热链接,但我们的文档会在更新时更新.

We created a small gist that provides sample code. This version is not yet hotlinked but our docs will be updated when it is.

相关文章