Reusing the payment source
How to save the payment source into the customer wallet so that it can be reused
Last updated
How to save the payment source into the customer wallet so that it can be reused
Last updated
You want to save a Braintree payment source already used to complete a purchase into the customer wallet and eventually reuse it for future payments.
To save the payment source into the customer wallet you need to ensure that the payment_method_nonce
is already set, then send a PATCH
request to the /api/orders/:id
endpoint, setting the _save_payment_source_to_customer_wallet
attribute to true
.
To reuse the stored payment source you need to associate it with the related order. To do that send a PATCH
request to the /api/orders/:id
endpoint, using the ID of the selected customer payment source to properly set the _customer_payment_source_id
attribute.
Remember that Braintree payment_method_nonce
is one-time-use: you need to store it in the customer wallet before using it to place the order, otherwise Braintree will respond with an error — "cannot use a payment_method_nonce
more than once".
The following request save the Braintree payment source to the customer wallet for the order identified by the "qaMAhZkZvd" ID:
The following request associates the payment source saved into the customer wallet and identified by the ID "QgDXpwsqDx" with the order identified by the "qaMAhZkZvd" ID:
See our documentation if you need more information on how to or deal with .