I am using a Braintree Payment Nonce to create a recurring subscription request. The below code is what I have to create a subscription. I'm using Payment Nonce which is received from Client. But the subscription request fails with a message "Payment method nonce is invalid."
Any help/pointers would be much appreciated.
SubscriptionRequest request = new SubscriptionRequest()
.paymentMethodNonce(customer.getPaymentNonce())
.planId(customer.getPlan().getBraintreePlanId());
Result<Subscription> result = getGateway().subscription().create(request);
I work at Braintree. I'd suggest you reach out to our support team if you have more questions.
Unfortunately the "Payment method nonce is invalid"
validation error is currently undocumented; that should be fixed soon.
This error means that the nonce couldn't be found, due it not existing, being locked, being already used, not pointing to a vaulted card, etc. In your example, customer.getPaymentNonce()
likely isn't returning a valid payment method nonce. Make sure it was created with a customer ID and vaulted, and that you're not trying to use the same nonce more than once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With