alexpoint
alexpoint

Reputation: 151

Having a Braintree custom form with CB and PayPal

We don't want to use Braintree's dropin form to stick with our UI. So far, our payment form with only CC fields was working great. We were setting up braintree.js with:

braintree.setup(token, "custom", {
  id: "options"
});

Then came PayPal and we added the PayPal container to the setup:

braintree.setup(token, "custom", {
  id: "options",
  paypal: {
    container: "paypal-button"
  }
});

Everything was working locally until last Saturday. By digging I found out that the payment_method_nonce wasn't sent to the server anymore when filling the CC fields: missing nonce server side

although the nonce input is present client-side in my form!!! enter image description here

So what's the matter here? Is braintree.js interacting somehow with the form submission? How come this payment_method_nonce is sometimes retrieved server-side (when paying via PayPal) and sometimes not (when paying via CC)?

Thanks

Upvotes: 3

Views: 2645

Answers (2)

alexpoint
alexpoint

Reputation: 151

Alright, turns out the issue was on Braintree's side.

Using https://js.braintreegateway.com/v2/braintree.js with braintree.js version greater than 2.2.4 solves the issue.

Upvotes: 0

mrak
mrak

Reputation: 504

You're almost there. You need to use "custom" as the integration method when you are using your own credit card form with an additional PayPal button:

braintree.setup(token, "custom", {
  id: "options",
  paypal: {
    container: "paypal-button"
  }
});

Upvotes: 2

Related Questions