#dtfk
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Tokens API is old and will be deprecated in future. You should really be using PaymentMethods API along with SetupIntents. It would allow you to save payment method details and charge them later on.
https://stripe.com/docs/payments/save-and-reuse
What docs are you referring to?
right but that's just for reference, we have a doc here that goes over PaymentMethod API transition (from Tokens & Sources APIs)
https://stripe.com/docs/payments/payment-methods/transitioning
I'd recommend reading through this
Let me share a document with you, I just want to replicate it using Payment Intent api
Because our business model is using tokens
this one
Ah I see. I think you can pass the source ID as a payment_method parameter when you create a PaymentIntent
https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
which should work (haven't tested this myself recently, so would recommend testing it out in test mode to be 100% sure)
Actually the idea behind is that if we create card token & charge it using card token then we can use token only once
But if we create card token >>>> create customer with card token >>>> create charge using customer id
then we can charge the customer multiple times without asking card details again n again
Therefore this doc was provided to me by another Stripe dev https://stripe.com/docs/saving-cards#saving-credit-card-details-for-later
But the thing is this is legacy api & I want to do it with Payment Intent Api
Right, the token becomes re-usable once you attach it to a customer
Have you tried creating a PaymentIntent by only providing a customer ID to see if it charges the attached source? Similar to how the guide does it
No, I havent tried it yet.
Give it a try and see if that works
And if it works, will it be considered as right way
yup
Sure
Thanks
Yes its working with the test card
Please let me know one thing, now we can create card token using Create Card Token and can use anytime in future like after 90 days?
I don't see an explicit expiration date for tokens but they are meant to be used very soon after they are created. I think it would be best to at least save the token as a PaymentMethod or source, those will be able to work indefinitely once saved
Hi @old hollow so here we were discussing about using Payment Intent API create card token >>>> create customer with card token >>>> create charge using customer id
then we can charge the customer multiple times without asking card details again n again
And i used stripe cli & replicated the methods create card token >>>> create customer with card token >>>> create charge using customer id
and its working
Yep yep, once you have the card saved like that it should work in future
so plz tell me one thing can I save card details by generating the token
by just using Create Card Token method
or do I need to do whole process like setup intent?
Using a SetupIntent is what you should do if you are starting your integration now. As hanzo mentioned, the Tokens API is older and more limited
Just creating a token won't save the card details long term necessarily, you could use a token to create a source or payment method, but using a setup intent will do the payment method creation for you and can make other parts of integrating this easier
Yes, exactly
this creates payment method id
and we can use this payment method id again n again
Right?
Correct!
Token API is going to deprecate?
I don't think there are current plans for it but at some point it likely will. We don't recommend using it if you are starting with your integration now
ok
Thank u so much for all the help
๐
@old hollow one more thing
in this whole process we are not saving the actual card number & cvv. Right?
Correct, Stripe is saving that info but your system never sees the CC info so you have less of a PCI compliance requirement
and in return its providing payment method id?
Ok thanks a lot @old hollow