#nacho_446

1 messages · Page 1 of 1 (latest)

echo furnaceBOT
warped gazelle
#

To clarify, you want to charge a customer via the api when you get a checkout.session.created event?

last violet
#

Yes

#

I have the customer Id saved

warped gazelle
#

Yeah you can do that

#

Or get the one from the checkout session's payment

last violet
#

Oh I have to pass the payment method not the customer Id

warped gazelle
#

Unless default pm is set on the customer, yeah

last violet
#

I was passing the id thinking it would take the payment method

#

Ok

#

How can I set a card details as default

warped gazelle
#

It's on the customer object (default_source)

#

Recommend you explicitly pass payment method id though

#

That's what our docs recommend

last violet
#

So default source I pass ? The pm id ?

warped gazelle
#

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

last violet
#

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

warped gazelle
#

Yeah payment intents don't pull from invoice settings

#

That's expected

last violet
#

The default source can’t take the pm id

#

It needs an id of the default payment source

warped gazelle
#

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

last violet
#

The pm directly to the checkout session? Pass as what value

warped gazelle
#

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

last violet
#

I want to charge a user using checkout.session.create api

#

Ok so I should change from checkout.sessions.create to what

echo furnaceBOT
warped gazelle
#

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?

last violet
#

Yes

#

The setup is there on checkout sessions because the old system used that I don’t wants to modify much

full bramble
#

👋 taking over this thread and catching up

#

To clarify, Checkout Session is for customer to pay online, with their presence. If you want to charge a customer without their presence, just create and confirm a PaymentIntent