ASP.NET CORE & Angular (single solution) .NET 5.0 v10.2.0
We would like to sell ebooks to our tenant subscribers. Where after received payment (webhook) they get a download link to the ebook. I was thinking of adding products to our Stripe dashboard and set all options Make a StripeProductsAppService, or should i use the current StripePaymentAppservice and make a function to get all products and displays them in Angular, then on buy go to the stripe checkout page.
Any advice on this? Point me in the right directions. Maybe someone already build this?
Kind regards, Rene van Woezik
Unfortunately not but I can try to explain the flow.
- When a user tries to purchase something, we create a record on database (PaymentRequest) with a not paid status. This record also holds what user is trying to purchase.
- Then, user is provided with the payment gateway selection (If you are planning to use 1 payment gateway, you can skip this section).
- Some payment gateways require additional information, so when user selects a payment gateway we show a form to get additional data if requested by payment gateway.
- Redirect user to payment gateway with a callbackUrl to our website. When user makes the payment, user will be redirected to callbackUrl.
- Validate the payment status on calback URL's controller and set the payment status to paid and make necessary updates on user's account.
For some payment gateways, there might be a different flow using WebHooks. In that case, payment gateway sends a webhook request to an endpoint you provide. In that endpoint, you can validate the payment and update its status to Paid. You can also make necessary updates on user's account in this step.
For this scenario (using WebHooks), in step 5 above, you don't need to validate the payment but you need to show a loading indicator until status of the payment is updated to Paid by webhook.
Thanks a lot! Very clear description, it works!
Only one more thing, after payment is succeeded i want to present them a temporary secure link where they can download the E-Book. Just like on the asp.net zero website where you can download the project.
Any suggestions, flow how to do this?
Thanks in advance! Rene van Woezik