#videovillain
1 messages ยท Page 1 of 1 (latest)
๐ Is there anything that I can help?
Hi @tight trench maybe! I am sort of struggling to get my subscriptions set up.
Currently I made a big long component that filters through my products and prices to then match them up and display them neatly with monthly/yearly costs for 3 options and that works fine, and then I send it through the Checkout Form I built, which also works, but it doesn't create a subscription, its just a payment.
Also, I then found out (after finishing my component to do the same thing, lol) about the awesome product tables and implemented that. And that one works well at first but then sends the user out of the app and though I have the return address set up, it doesn't return me to the app, but rather gives me a CORS error.
Subscription API should be used to create a Subscription, not Payment Intent API. For more information, you may refer to the guide here: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
I'd like to get both to work since we are still deciding which way to go
Where was the CORS error thrown? Can you share the error message?
So after they select the product and price from my created table, then I need to pass along the customerid and priceid to the checkoutpage it seems. I will try that, though I thought I had already tried that. ๐
Yes I can, give me a moment.
Are you using Subscription API with Elements?
Let me check, but also, is it safe to show the cs_test_********* string in the error or should I black it out if you don't need it?
It's fine to share the Checkout Session ID (cs_xxx) here
Oh! So you're not using Elements, but Checkout Session instead
well this is for the product table
its two different things I'm using, haha
this is the CORS error
but I've checked and triple checked, we have CORS handled properly
Are you able to complete payment in Checkout Session page?
yes, it finishes payment
Since the payment can be completed, then this error is just red herring and shouldn't affect your integration
hmmm, okay. but then I never get confirmation of payment an I can't update my backend
I'd have to separately ping the customerID or something to make sure payment was finalized to unlock their access rights
or am I overthinking things?
You should listen to checkout.session.completed event to check if the payment has been made successfully and fulfil order accordingly: https://stripe.com/docs/payments/checkout/fulfill-orders
Ahh, missing a webhook, is that it?
Yes! Webhook should be set up for getting notified with payment completion
do you know if they are pretty traffic heavy?
It depends on how many event types your webhook endpoint listens to. If you only listen to checkout.session.* events, then they will only be sent when there is a change to Checkout Session payment status. If you subscribe to many more event types, then the traffic will be higher for sure
Okay, thanks!
As for the elements portion, I'm looking into it now but I think I'm creating a paymentIntent first that is based on price (actual price not id) and currency and getting back a clientsecret
But from the looks of it I'm supposed to be making a subscription with the priceid and customerid is that right? and THAT returns a clientsecret to finish the Elements?
For subscription, then yes! You should create a Subscription with Price ID and Customer ID, then return the client secret of the latest invoice to complete payment with Elements
Payment Intent creation should only be used for one-time payment
Does the subscription object have a 'client_secret' property the same way a paymentIntent object has one?
Oh, I see, it's berried deeper: subscription.latest_invoice.payment_intent.client_secret is that right?
Yes! You may refer to the guide here: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements