#jayy26

1 messages ยท Page 1 of 1 (latest)

old fogBOT
bitter edge
#

You'd need to do that manually after session completion

fringe marsh
#

so on the 'payment_method.attached' event ?

bitter edge
fringe marsh
#

can you tell me what am i doing wrong with this >> req_mRepcfrX1PXQ2P

I am doing a charge using the following:

 await stripe.charges.create({
            amount: Math.floor(charge * 100),
            description: 'Prorated charge for subscription update.',
            customer: paymentMethod.user.stripeCustomerId!,
            currency: paymentMethod.user.currency,
          })
#

it says Cannot charge a customer that has no active card
but i did set it as default

#

so i'm not sure what am i doing wrong here ..

#

๐Ÿ‘€

safe sun
#

๐Ÿ‘‹

fringe marsh
#

๐Ÿ‘‹

#

do you want a recap or is the history viewable ?

safe sun
#

Why are you using the Charge endpoint? This is a very old API that we don't recommend using.

fringe marsh
#

i wanted to create a 1 time charge to the customer

safe sun
#

Then you should use a PaymentIntent

fringe marsh
#

and i pass confirm: true?

safe sun
#

Yes

fringe marsh
#

wait i'm a little bit confused. so confirm: true skips the redirection to stripe and just charges the customer yes? so what about off_session ?
i'm gonna test this:

 await stripe.paymentIntents.create({
            amount: Math.floor(charge * 100),
            currency: paymentMethod.user.currency,
            customer: paymentMethod.user.stripeCustomerId!,
            capture_method: 'automatic',
            off_session: true,
            description: 'Prorated charge for subscription update.',
            confirm: true,
          })

to see if it works

safe sun
#

You forgot to set the payment_method, so it won't work.

fringe marsh
#

doesn't it use the default one attached to the customer already ?

safe sun
#

The default is only used by Billing products (so invoices and subscriptions, not PaymentIntents)

fringe marsh
#

oh okay

#

Thanks guys :)!