Test nonces don't work?
See original GitHub issuenot sure what I’m doing wrong here, but I’m in a sandbox environment using nonce='fake-valid-nonce'
here:
resp = braintree.Subscription.create({
'payment_method_nonce': nonce,
'plan_id': config.BRAINTREE_SUBSCRIPTION_PLAN_ID
})
and keep getting the error “Payment method nonce is invalid.”
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Braintree: test nonces are resulting in Payment Method Nonce ...
I am passing the sandbox credentials when I make my initial connection but it seems like it is not honoring the fake nonce....
Read more >Testing | Ruby - Braintree Developer Documentation
The following nonces are only for testing Visa cards. Liability shift status is generally agnostic to the card type and other card brands...
Read more >Testing and Go Live | Node.js
Test values from the sandbox testing page will not work. This means that every test transaction that you allow to settle in your...
Read more >Sandbox test payment not working - Square Developer
A quick reference of test credit card numbers and payment nonces you can use to make test payments with the Square Sandbox. I...
Read more >What is a Nonce? - Cryptographic Nonce from SearchSecurity
Using the sequential nonce method guarantees that values are not repeated, ... Proof of work systems use nonce values to vary input to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found the solution to my problem by using the
nonce_for_new_payment_method
available from this spec helper, included with the Braintree gem: https://github.com/braintree/braintree_ruby/blob/master/spec/integration/braintree/client_api/spec_helper.rbRecording this here in case anyone else is writing a Ruby controller test involving a Braintree::Subscription.
Here is my working example:
Recommend updating this documentation page, which errantly suggests that the fake valid nonces can be using for recurring billing: https://developers.braintreepayments.com/guides/recurring-billing/testing-go-live/ruby
Our fake nonces are effectively one-time-use, but subscription calls need a payment method that they can hit periodically.
Subscription.create()
calls will only accept a nonce if it is directly tied to a payment method in your Vault. You can generate a nonce like this by usingPaymentMethodNonce.create()
and passing it a token from your Vault. For example:This shouldn’t affect you in production because you’ll never use fake nonces.