#Mijelz-serverless
1 messages · Page 1 of 1 (latest)
we don't have a guide for serverless, but we do have guides on how to use Stripe with React
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?
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.
I see, so, in order to ensure that condition where a user closes the browser and we might fail to save course data to the user account, we kinda have to rely on a cloud function to handle the work of saving data and stuff to the user account then
Would there ever be an issue with the time it takes for the cloud function to 'wake up'?
i'm not familiar with cloud functions so could be a better question for that community