#lennard.

1 messages · Page 1 of 1 (latest)

sand nymphBOT
final sparrow
#

are you using any Stripe integrations currently?

hushed saddle
#

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

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.

hushed saddle
#

I hope I explained it understandable haha

hushed saddle
#

And there then pass the Session ID over to the OAuth calls i do to Instagram, etc.?

final sparrow
#

I don't follow at all. Instagram has no idea what a Stripe CheckoutSession ID is.

hushed saddle
#

So if a random user goes to /auth/private/start-flow nothing happens.

final sparrow
#

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.

hushed saddle
#

Thank you @final sparrow! That’s understandable. Would it be easier to implement w/ a single payment only?

final sparrow
#

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.

hushed saddle
#

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

visual tendon
#

👋 taking over for my colleague. Let me catch up.

visual tendon
#

this would give you a way of using checkout within your website

visual tendon
hushed saddle
#

Okay. Thanks.

#

Is the webhook called from the browser? @visual tendon

visual tendon
#

the webhook event is sent from Stripe as a Post message to your endpoint

hushed saddle
visual tendon
#

I'm not sure I understand

hushed saddle
# visual tendon 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“)

visual tendon
#

the webhook isn't something called from your site to redirect it to instagram

#

the checkout session can have a success URL

#

the webhook is to fulfill the order

hushed saddle
#

Oh, i think I finally understood 😅 Thanks

#

I’ll just customize the success url and retrieve the status etc. Thanks.