My application is using Braintree to collect payments on my application. I want to have a checkbox on payment form which can be ticked to store the credit card details to the braintree customer record
However, I cannot reuse the same nonce that is generated to make the payment (I am getting error saying I cannot use the same nonce multiple times).
This is what I am trying to do:
...
$paymentMethodNonce = $this->input->post("payment_method_nonce");
//make payment
Braintree_Transaction::sale(['paymentMethodNonce' => $paymentMethodNonce,
'orderId' => $orderId,
'merchantAccountId' => $merchantAccountId,
'amount' => $amount,
"options" => ["submitForSettlement" => true]
]);
//create card for existing customer
Braintree_PaymentMethod::create(['paymentMethodNonce' => $paymentMethodNonce,
'customerId' => $customerId,
'options' => ['verifyCard' => true]
]);
...
I do not want to force user to re enter their credit card details again to be able to save it.
Is there a way in Braintree to generate more than one nonce for one hosted form? Or is there a better way to save card than having a checkbox?
Many thanks