#madhav-sharma_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1334488980065878078
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there!
hi soma
if you have a saved payment method, why do you want to use a Checkout Session?
I have created a payment method by using card that I am hoping to use in a checkout to collect payment for a product
Checkout Session is mainly used to collect new payment information. if you already have a saved payment method, then you don't really need to use a Checkout Session. you can directly create a PaymentIntent to charge the card.
if you really want to use a Checkout Session and prefil the existing card, this is covered here: https://docs.stripe.com/payments/existing-customers
But actually with Payment Intents we can not explicitly use the tax right
Yes we have implemented invoice but this is scenario where we have checkout implemented in the flow itself
so is there any way around this
if you want to use Checkout Session, check the link I shared above.
sure
one more thing
while creating a payment method I can see there is no card_id that i am recieving in the response
I am just recieving the fingerprint
while creating a payment method
how are you creating the PaymentMethod?
there is no card_id
why do you want a card ID? if it's a PaymentMethod, there should be a pm_xxx ID.
I am creting paymentmethod by using stripe.PaymentMethod.create() api
just wanted to know if we are going to get the card_id
I am creting paymentmethod by using stripe.PaymentMethod.create() api
can you share a bit more about your payment flow?
sure
We first create customer for our users on stripe
following this we create a payment method (card) and attach this to the user
next when the user adds a product to purchase
we create a checkout session to collect the payment
Now here we want to show the payment method earlier attached to the customer
following this we create a payment method (card) and attach this to the user
that's not a flow we would recommend. instead you should use a SetupIntent for this.
either this: https://docs.stripe.com/payments/save-and-reuse, or a Checkout Session in setup mode.
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Sure Tarzan so just wondering if we can implement the scenario that I explained using the checkouts only because checkout sessions are already in place so is it possible
also what is the difference between a checkout session or a setupintent
SetupIntents are the backbone of CheckoutSessions in setup mode
Intents are our high level API that abstract the attempts of the payment/setup
so do they allow to use the taxation as well
if you're using Checkout Sessions you don't need to worry about Intents
Stripe will handle that for you
and yes Tax is available with Checkout Sessions
to go back to your original question, are you expecting your customer to pay on the first time? if that's the case you can save the payment method during the payment and allow the PM to be redisplayed in the future as well https://docs.stripe.com/payments/checkout/save-during-payment#save-payment-methods-to-prefill-them-in-checkout
We are allowing the user to save a card for future use before the payments explicitly
do your really need that? I mean to make it into 2 steps?
then you should use https://docs.stripe.com/payments/checkout/save-and-reuse?payment-ui=stripe-hosted with the param from https://docs.stripe.com/payments/checkout/save-during-payment?payment-ui=stripe-hosted#save-payment-methods-to-prefill-them-in-checkout
ok let me try it once
I tried passing saved_payment_method_options={"payment_method_save": "enabled"} while creating a checkout session but it is still not taking the saved payment method
would you mind sharing either the Checkout Session ID or the request ID?
sure
here is the request id
req_T2qwgbFUN56GTk
a question do we need not to pass payment_method_types if we are passing saved_payment_method_options in the payload
creating the Checkout Session isn't enough to save the PaymentMethod
first you need to pass mode: "setup" instead of "payment" when you create the Checkout Session
then you need to visit the url that is generated by the Checkout Session
to collect the payment method details
these params are not related.
ok i will try using mode: setup