#Neal
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
instead of creating a PaymentIntent you can create a SetupIntent
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?
yes
My component code
My main issue is what values should I use to succesfully create a subscription?
Any advice ?
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
instead of using PaymentElement in this step https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#collect-payment
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
Sorry but , I am completely lost now
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok, is there a need to create a customer when dealing with subscriptions ?
Initially I am using the following code for making payments via CardElements
yes
I really think you should start over, this is a very old workflow that is no longer recommended
Oh. Thank you so much . Let me get into it .