#Mijelz-serverless

1 messages · Page 1 of 1 (latest)

mental mantle
#

we don't have a guide for serverless, but we do have guides on how to use Stripe with React

bold dune
#

Hi Alex thanks, yes I'm using NextJS as well (static generation only), my app is simple, it sells courses online. All digital delivery, no physical goods. Ideally, I'd like some flow like this:

User attempts payment.
on successful payment, we save course data to the users account.
On failed payment, we alert and ask to retry payment.

So, I'd like to be able to uhh have an onClick handler basically bound to the "pay" button, or be able to read the response of an attempted payment result

#

Is something like this possible?

mental mantle
#

i would strongly reccomend that you use webhooks to listen for the successful payment event. Generally, you wouldn't want to rely on the browser callback for important actions like this since the customer could close the browser before the callback executes.

https://stripe.com/docs/webhooks
https://stripe.com/docs/webhooks/quickstart

You can take a look at these guides for accepting a payment :
https://stripe.com/docs/payments/accept-a-payment
https://stripe.com/docs/payments/quickstart

And yes, you can display the result of an attempted payment result.

bold dune
#

Would there ever be an issue with the time it takes for the cloud function to 'wake up'?

mental mantle
#

i'm not familiar with cloud functions so could be a better question for that community