#burger-reactnative-subscription
1 messages ยท Page 1 of 1 (latest)
hello ๐
In theory what you do is that you
1/ Create the Customer
2/ Create the Subscription with payment_behavior: 'default_incomplete
That will automatically create the first invoice for you, that first invoice will have a PaymentIntent, that PaymentIntent will have a client_secret and that's the client_secret you give to your mobile app where you confirm it. When you do, the subscription becomes active
This is all done using the https://stripe.com/docs/expand feature at once
https://stripe.com/docs/billing/quickstart covers this end to end though it can look overwhelming. It's fairly simple once you grasp that part
hmm, so i've covered that but it's just not marrying up to the subscription loool
that's the thing, you need to start with the subscription
do you have a PaymentIntent id pi_123 that I can look at
https://dashboard.stripe.com/test/logs/req_rgJ8EGYNuJYEdE see this request? You create the PaymentIntent yourself via the API
That's not the right way unfortunately
Waht you want is what I explained above. You have to create the subscription first
and that Subscription will create an Invoice in_123 and that Invoice will have a PaymentIntent pi_ABC
the subscription is created first then the card details captured + then the backend is called
ooft so i can pass in a param for paymentIntent?
okay look at this call: https://dashboard.stripe.com/test/logs/req_LrHT0O8iRIDMPw
that's your subscription creation call
that call has the PaymentIntent for you: pi_3LGmGSKYfNu7l2460AIx8dGb
you need to use that one not a new one
kind of
you don't need any
You already have it
So when you create that Subscription you get itback in node and you already expanded the Invoice and the PaymentIntent
you can do subscription.latest_invoice.payment_intent.client_secret immediately and send that to your mobile app
ahh, i see, i think it's getting tossed there, i'll give that a whirl, cheers!
sure thing! let me know if you're stuck
aight, changed everything over, but went with paymentSheet
paymentsheet returns "success" on the same payment intent client secret but i don't think anythings happening after that lelel
At that point the PaymentIntent should have status: "succeeded" and then the Subscription should have status: "active"
do you have another PaymentIntent id I can look at?
ahh, this where i update via webhooks?
yes!
though it completes on your mobile app so you can hit your server after the fact to report the success
perfect, i'll chuck in some code for handling it server side now ๐
Always use webhooks since your request could fail, you could lose internet, etc. But if I were building this I'd still submit to my server to try and move forward quickly
yeah definitely always using webhooks when required ๐
would you say paymentsheet is a good way to process these payments for subscriptions?
I think so yes, that's what I'd do at least
so if the payment succeeds, it triggers the webhook, but doesn't log a payment to the customer?
the PaymentIntent would be on the customer with a successful Charge
Do you have that cus_123 or pi_123 handy?
yeah didn't go through and payment sheet seems to have returned an image lol
cus_LyeKGrXNOQpv73
what does "returned an image" mean? ๐