#waleed-khalid_api

1 messages ยท Page 1 of 1 (latest)

lofty basinBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

forest mauve
#

hye

torn raft
#

Hello

forest mauve
#

I have created checkout session to get customer details from customer

#

can you please confirm webhook is the one through which I will get checkout result, which should include payment method id

#

?

torn raft
#

The recommended webhook is checkout.session.completed and then to expand details as necessary from there

#

Or even expand setup_intent.payment_method if you want the full details of the PaymentMethod beyond just its ID

forest mauve
#

great great lemme just check this one. I have to enable this event checkout.session.completed on stripe webhooks right ?

torn raft
#

Yes

forest mauve
#

please check

torn raft
#

Yeah after you receive the Event you have to retreive the Checkout Session and expand the setup_intent.payment_method

forest mauve
#

lemme check

#

it will be like this ?

const session = await stripe.checkout.sessions.retrieve(
'cs_test_c1ZxMIaEDOCbxaigQy3NDxRtH1fynNTF3kSna8JGizb7Gtb4o8BwAgpmL7',
{
expand: ['setup_intent.payment_method'],
}
);

torn raft
#

Yep

forest mauve
#

I got this pm_1Pw3IFRqbp84r6xNpK8so0kk id

#

now if I want to do the payment, what I need to do is passing customer id and payment id in payment intent right ?

torn raft
#

Yep

forest mauve
#

lemme try that

forest mauve
#

hi

#

after expansion I got payment method id. After that I am using payment element with payment intent id. Look what I got on payment element

#

const paymentIntent = await stripe.paymentIntents.create({
amount: netAmount.amountInCents,
currency: 'usd',
customer: 'cus_QnenVkFTyBpbRe',
payment_method: 'pm_1Pw3mNRqbp84r6xNC5TMvga2',
setup_future_usage: 'off_session',
payment_method_types: ['us_bank_account'],
payment_method_options: {
us_bank_account: {
verification_method: 'instant',
financial_connections: {
permissions: ['payment_method', 'balances'],
},
},
},
});

this is my payment intent object, can you please help me out in this ?

torn raft
#

You don't need to use Payment Element at all

#

You already have the PaymentMethod ID

#

All you do is create/confirm a PaymentIntent in your backend

forest mauve
#

lemme try that'

#

it works buddy