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

- 31
- 2
2 Answers
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

- 490
- 3
- 13
-
1I only store the nonce for a single transaction and that works fine. What I found is that if I take the same user through the DropinUI flow for a new transaction (second separate independent transaction ) w/in a certain time instead of getting a new and different nonce, I get the same identical nonce and when I go and try to settle the second one I get the error mentioned above. SHould I not assume that I get a new nonce every time I create a DropUI payment form ? – paolino Mar 30 '15 at 03:31
-
Correct. You should assume that the nonce will be distinct every time your run drop in. – mickeyreiss Mar 31 '15 at 14:34
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).

- 1,038
- 14
- 16