沃梦达 / 编程问答 / php问题 / 正文

Braintree 自定义贝宝按钮

Braintree custom paypal button(Braintree 自定义贝宝按钮)

本文介绍了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.

这篇关于Braintree 自定义贝宝按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Braintree 自定义贝宝按钮

基础教程推荐