#nacho_446
1 messages · Page 1 of 1 (latest)
To clarify, you want to charge a customer via the api when you get a checkout.session.created event?
Yeah you can do that
You could either use https://stripe.com/docs/api/payment_methods/customer_list to get list of payment methods available
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or get the one from the checkout session's payment
Oh I have to pass the payment method not the customer Id
Unless default pm is set on the customer, yeah
I was passing the id thinking it would take the payment method
Ok
How can I set a card details as default
It's on the customer object (default_source)
Recommend you explicitly pass payment method id though
If you read here: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That's what our docs recommend
So default source I pass ? The pm id ?
You can try
I don't know if you can set a pm_ id as default source though
That's really an old param
That's why we generally recommend explicitly controlling the pm id you pass to the payment intent
On the docs the default source you can add the default payment id
But I used the payment method api to create the card details so I tried the invoice settings.default _payment method. It still did not work
The default source can’t take the pm id
It needs an id of the default payment source
Yeah
Just pass pm_ directly to payment intent
As is recommended in the docs
source is the precursor to payment method
Really not the recommended flow anymore
They're being deprecated
The pm directly to the checkout session? Pass as what value
You said yes to this question earlier: To clarify, you want to charge a customer via the api when you get a checkout.session.created event?
I'm confused
Can you just describe in detail what you are trying to actually do here?
The whole point of checkout sessions is that customers are online to pay themselves. If you want to just make a payment with a card on file, it's better to just create a payment intent instead. No need to show the customer a checkout session
I want to charge a user using checkout.session.create api
Ok so I should change from checkout.sessions.create to what
You can use checkout sessions if you want
But the whole point of checkout sessions is the user is online to pay
Is your goal to process a payment without the user being present using an existing card?