问题
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);
回答1:
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.
来源:https://stackoverflow.com/questions/24977463/cannot-create-subscription-using-braintree-payment-nonce