Jiew Meng
Jiew Meng

Reputation: 88197

How to save card with Stripe 3ds?

I find that I can save a 3ds source for future use, but its only for single use. If I want to use 3ds but allow allow customer to save this card for future use many times, isit impossible to do so?

I used

stripe.customers.createSource

to save the source to the customer, then I tried to use it once, it works, but 2nd time fails with

The source you provided is not in a chargeable state

Upvotes: 1

Views: 546

Answers (1)

koopajah
koopajah

Reputation: 25552

I covered Sources versus Cards conceptually in my answer to your other question here: https://stackoverflow.com/a/51338279/1606729

A 3D Secure Source is created from a Card Source. This is something you do client-side based on whether the card supports (or even requires) 3D Secure as documented here. Then you can use this new Source for the charge through 3D Secure.

Since the 3D Secure Source is single-use though, you want to keep the original Card Source too for future charges.

The flow is something like this:

  1. Create a Card Source client-side src_123
  2. Check if the Card Source requires/supports 3D Secure
  3. If not, send the source id src_123 to your server and save that Source on a customer to charge it now/in the future.
  4. If yes, create a 3D Secure Source client-side src_ABC.
  5. Have the customer complete 3D Secure verification which involves a redirect to their bank
  6. Send the 3D Secure source id src_ABC to your server as it is ready to be charged
  7. Save the original Card Source on the Customer too for future payments. This source id src_123 is available on the 3D Secure Source under three_d_secure[card].

Upvotes: 1

Related Questions