#shaitan1126-Attaching PMs

1 messages · Page 1 of 1 (latest)

sinful summit
#

👋 What's the PaymentMethod's id? (pm_******)

cedar mirage
#

pm_1JkpK3BtJRSvW01wuG7KeCjk

#

This is the payment_method id which I retrieved from payment_intent api response.

#

When a user goes back to the website from stripe platform after making payment then we got the cs_test_*** id, using this id we call an api to get cs_test**** full data and in this api we got the payment_intent id and all

sinful summit
#

OK, so the thing about CheckoutSessions is they will always have a Customer associated with them, and the PaymentMethod will be attached to that Customer. If you pass a customer id when creating the CheckoutSession, it will use an existing Customer, but otherwise it will create a new Customer automatically.

For that PaymentMethod, you can see this on https://dashboard.stripe.com/test/payments/pi_3JkpIoBtJRSvW01w0BJa6dCy

So if you want a CheckoutSession to attach a PaymentMethod to an existing Customer, you need to pass that Customer as customer when creating the CheckoutSession.