Search code examples
reactjsstripe-paymentspayment-gatewaypaymentsubscription

How can i integrate stripe recurring in react and express with custom checkout page?


I am working on a project where I have to integrate Stripe Recurring Payment with custom checkout page.

I tried many ways but nothing is working.

I hope i get a answer here.

Also Please someone help me with how to store payments every month in data base.

Thank you for your answers.


Solution

  • You can have recurring payments with Express and React using Stripe. At a high level you need to:

    1. Create a product and a recurring price, either with the dashboard or with the API
    2. Create a Subscription on the backend and retrieve the latest_invoice.payment_intent.client_secret of the subscription. You can see an example here with Express.
    3. Use the client secret to collect payment information on the frontend. For React this is covered on this documentation page.

    To store the monthly payments in your database, you can use Stripe webhooks to listen to the invoice.paid event