#madhav-sharma_api

1 messages ยท Page 1 of 1 (latest)

heavy havenBOT
#

๐Ÿ‘‹ 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.

gray ridge
#

hi there!

keen vale
#

hi soma

gray ridge
#

if you have a saved payment method, why do you want to use a Checkout Session?

keen vale
#

I have created a payment method by using card that I am hoping to use in a checkout to collect payment for a product

gray ridge
#

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.

keen vale
#

But actually with Payment Intents we can not explicitly use the tax right

gray ridge
#

True

#

an other option would be to use Invoice, which support Tax.

keen vale
#

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

gray ridge
#

if you want to use Checkout Session, check the link I shared above.

keen vale
#

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

gray ridge
#

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.

keen vale
keen vale
gray ridge
#

I am creting paymentmethod by using stripe.PaymentMethod.create() api
can you share a bit more about your payment flow?

keen vale
#

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

gray ridge
#

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.

heavy havenBOT
sinful pecan
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

keen vale
#

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

sinful pecan
#

SetupIntents are the backbone of CheckoutSessions in setup mode

#

Intents are our high level API that abstract the attempts of the payment/setup

keen vale
#

so do they allow to use the taxation as well

sinful pecan
#

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

keen vale
sinful pecan
#

do your really need that? I mean to make it into 2 steps?

keen vale
#

Yes

#

it is the requirements

sinful pecan
keen vale
#

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

sinful pecan
#

would you mind sharing either the Checkout Session ID or the request ID?

keen vale
#

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

sinful pecan
#

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

sinful pecan
keen vale