Is it possible to use 3D Secure when saving cards for future payments?
From Stripe's docs, https://stripe.com/docs/sources/three-d-secure. This seems to be the way to do it.
However according to the documentation, it's no longer recommended and to use PaymentIntents instead:
Use of this API is no longer recommended. If you wish to use 3D Secure we strongly encourage you to adopt PaymentIntents, our new payments API.
So with that, is there a way to use PaymentIntents (to utilize 3D secure) to just save a card without making a payment immediately?
Testing the 3D Secure flowUse a Stripe test card with any CVC, postal code, and future expiration date to trigger 3DS authentication challenge flows while in test mode. When you build an integration with your test API keys, the authentication process displays a mock authentication page.
Stripe Terminal lets you save payment methods (excluding mobile wallets) for online reuse. Use an in-person card to initiate an online subscription using Billing, save payment details to a customer's online account, or defer payment.
A 3D secure authentication error could be due to everything from a mistyped card number to an incorrect expiration date. If the error continues, the cardholder will need to contact their credit card issuer for assistance.
Is it possible to use 3D Secure when saving cards for future payments?
What I do using PaymentIntents
is to create a customer and then make the payment:
customer = stripe.Customer.create(
payment = stripe.PaymentIntent.create(customer=customer_id, ....
In payment you have the card type payment['charges']['data'][0]['payment_method_details']['card']['brand']
and the last 4 digits of the card payment['charges']['data'][0]['payment_method_details']['card']['last4']
You can store locally the customer_id
, the card type and the last 4 digits to show them to that customer next time.
To make another payment you only need to use stripe.PaymentIntent.create()
with the customer.id
you saved the first time.
If the customer wants to use another card just do
customer = stripe.Customer.modify(
customer_id,
source=token_id
)
token_id
comes from stripe.js in your frontend
just to let you know, I have contacted the Stripe support as I get the same concern as you, here the answer:
[...] PaymentIntents currently does not support creating sources without also creating a charge thereafter. It's also not possible to integrate 3DSecure with the current method of saving credit cards unfortunately.
PaymentIntents is a fairly new Stripe product and we're still working out the kinks and deciding what functionality we'll support down the line. Saving sources is definitely high on our priority list and there'll be more information on this update in the future.
I tried to get more info about their roadmap to know if the feature will be released by september, but the support could not give me the info.
Edit: stripe has improve its documentation and now explaining how to implement what you want while respecting the SCA https://stripe.com/docs/payments/cards/saving-cards#saving-card-without-payment and https://stripe.com/docs/payments/cards/charging-saved-cards
Use the SetupIntent
API, which are basically PaymentIntent
with a null amount (same workflow).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With