I'm using Braintree marketplace in the Sandbox, and I have a problem/question.
I'm using Customer ID when generating the client_token, saving the payment_nonce in my database and using it later (w/in 3-4 min) to submit_for_settlement. The problem is that each transaction needs a unique nonce, but if I submit the Dropin UI twice w/in 2-3 mins I get the same nonce and the second transaction fails with error : Cannot use payment methos nonce more than once. Is there a way to ensure that I get unique nonce's ?
thank you
Duplicate nonce in BrainTree using Dropin UI
1.7k Views Asked by paolino At
2
There are 2 best solutions below
2

Instead of creating another transaction with the same nonce, try submitting the original a transaction for settlement using transaction.submit_for_settlement
Payment method nonces are one time use. To reference the same parent method multiple times in your server side integration, you can create a payment method token in the vault.
In general, you should never store a payment method nonce in the database, as they are short lived and single use only.
https://developers.braintreepayments.com/ios+ruby/reference/request/transaction/submit-for-settlement https://developers.braintreepayments.com/ios+ruby/start/vault
If you're following everything by the book and you still get this error sporadically, it's likely because users are clicking the form submit button multiple times without refresh. This will cause the first submission to go through correctly, but you'll recieve this error on the second form submit (which arrives milliseconds later using the same nonce as the first submit).
Disabling the form submit button after the first click solved it for me (see here).