#nauman

1 messages · Page 1 of 1 (latest)

wanton marlinBOT
lavish rover
#

The Checkout Session needs to be paid to have an associated PaymentIntent

#

There are 2 steps: Creating Checkout Session and Paying it

vocal horizon
#

yes after paying it creates customer and I want the payment method save for future use

#

with that customer

lavish rover
#

Ah. Then setupFutureUsage doesn't do that automatically. I would recommend listening to checkout.session.completed webhook, take the PaymentMethod and setup as Customer default paymentmethod yourself

#

Hmm wait, can you provide a sample Checkout Session Id?

vocal horizon
#

yes

#

cs_test_a17s1uyMMGMhr9e1pwKW6ncXWuZCNfGIcbaeNYY552xmOAKUz2HrHQOPxk

lavish rover
#

This didn't create a Customer

#

So you can get the PaymentMethodId from the PaymentIntentId from the Checkout, by using Retrieve Checkout Session API and expand

vocal horizon
#

ok . For any checkout session is it necessary to create PaymentIntent first or we just create Customer and the redirect to checkout ?

lavish rover
#

No just create Customer and supply its Id to Checkout

vocal horizon
#

ok I will try and then update you

vocal horizon
#

cs_test_b1sInDt0OkT1vswdbxcpPSDmX9pGd45BuprSu4xRX2GZCTr8soqNH7QV0I

#

I hqve tried but no luck

#

screen

lavish rover
#

This customer does have a PaymentMethod attached

vocal horizon
#

yes but not default

lavish rover
#

It won't set as default. You would need to set as default by yourself

#

It only to attach to the Customer

vocal horizon
#

ok but how we get this PaymentMethodId from CustomerId or PaymentIntendId