'Stripe 3D Secure when Saving Cards for future payments
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?
Solution 1:[1]
Use the SetupIntent
API, which are basically PaymentIntent
with a null amount (same workflow).
Solution 2:[2]
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
Solution 3:[3]
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
Solution 4:[4]
Set setup_future_usage='off_session'
when creating a payment intent.
stripe.PaymentIntent.create(
amount=1099,
currency='usd',
setup_future_usage='off_session',
)
These stripe docs show how to save a card in a way that should allow future "off_session" payments for cards which use 3D Secure.
https://stripe.com/docs/payments/payment-intents#future-usage
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Antwan |
Solution 2 | Community |
Solution 3 | Avery |
Solution 4 | pythonjsgeo |