#Neal

1 messages ยท Page 1 of 1 (latest)

brisk moatBOT
surreal chasm
#

๐Ÿ‘‹ happy to help

#

instead of creating a PaymentIntent you can create a SetupIntent

eager zealot
#

Awesome, I have tried the following 1. const paymentMethod = await stripe.createPaymentMethod({
type: 'card',
card: elements.getElement('payment'),
});

#

Am trying to create a subscription with the PaymentRequestButtonElement. Can I share my code sample?

surreal chasm
#

yes

eager zealot
#

My component code

#

My main issue is what values should I use to succesfully create a subscription?

#

Any advice ?

surreal chasm
#

sorry haven't had the chance to look at it yet

#

bear with me a moment please

#

basically what you need to do is to follow this guide

#

you would use PRB

#

you would then see which one of latest_invoice.payment_intent and pending_setup_intent is not null, and send its client secret to the front end

#

and depending on whether it's a PI or an SI you would do either confirmCardPayment or confirmCardSetup

eager zealot
#

Sorry but , I am completely lost now

surreal chasm
#

I think what you were trying to do is to collect the Payment Method (PM) before creating the subscription

#

which is not the path we recommend doing

#

PRB = Payment Request Button
PI = PaymentIntent
SI = SetupIntent
latest_invoice.payment_intent and pending_setup_intent are respectively https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice and https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent coming from the subscription object

eager zealot
#

Ok, is there a need to create a customer when dealing with subscriptions ?

surreal chasm
eager zealot
#

Oh. Thank you so much . Let me get into it .