Braintree custom paypal button

2019-02-20 16:01发布

问题:

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

For example:

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

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'
    }
  })

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

回答1:

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

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.