#lennard.
1 messages · Page 1 of 1 (latest)
are you using any Stripe integrations currently?
No. I dont have it installed yet. I would like to use the plain payment link if possible
And then on a /[customer-data-from-stripe]/auth/private/start-flow check if the payment was done correctly. If yes, store the user ID and redirect to a auth page (if errors occurred just redirect to support site, or something like that
And my question is basically the easiest way to do that w/ the official Stripe api? @final sparrow
Stripe doesn't have an official offering for that part(handling the successful payment) since that is your own business logic you write on your own servers.
Overall I'd suggest using Checkout as it allows customers to sign up for subscriptions, you can configure it to add one-time items for the initial payment, and then you can use webhooks to trigger behaviour in your backend server.
I hope I explained it understandable haha
Thanks, so basically redirect to https://example.com/api/private/start?session_id={CHECKOUT_SESSION_ID} ?
And there then pass the Session ID over to the OAuth calls i do to Instagram, etc.?
I don't follow at all. Instagram has no idea what a Stripe CheckoutSession ID is.
Yes, the problem I mean is that the route should only work once after the checkout.
So if a random user goes to /auth/private/start-flow nothing happens.
you can't stop people visiting a URL
generally the way it works is you handle the Checkout webhook in your backend server; which updates some database on your side to indicate a certain user has paid
if that same user visits a URL, you authenticate them in the way you usually do(for example they might have cookies from your user login system) and if that authenticated user has paid(you look up your database to see the payment status) then you can take whatever action a paid user can do, otherwise you error.
Thank you @final sparrow! That’s understandable. Would it be easier to implement w/ a single payment only?
I wouldn't say that really makes any difference at this level
it still comes down to, the user pays for something, and you use a webhook to update a database on your side to note they've paid, and you can check that database when they access a paid part of your service.
Okay, thanks. I don’t need a complicated login system for the rest of my app. So on the upgrade click event, can I just get a id (backend I handle), set it as a cookie and redirect to the payment site?
@final sparrow And in the webhook backend ofc handle the state change to paid
👋 taking over for my colleague. Let me catch up.
you don't need a cookie
Okay!
please read through https://stripe.com/docs/checkout/quickstart
this would give you a way of using checkout within your website
as for this part you can find resources here: https://stripe.com/docs/payments/checkout/fulfill-orders
the webhook event is sent from Stripe as a Post message to your endpoint
Okay. So i can’t just check for the status and then do a res.redirect?
I'm not sure I understand
I basically have a endpoint on my NextJS app called /start.
I would like to host the webhook on it. And if the payment was successful do a res.redirect(„/auth/private/Instagram“)
the webhook isn't something called from your site to redirect it to instagram
the checkout session can have a success URL
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
the webhook is to fulfill the order