How to use Stripe Checkout without a website

  • 3 August 2021
  • 0 replies
  • 61 views

Userlevel 3
Badge +7
  • Developer Support Engineer
  • 120 replies

If you don't have or don't want a full website, it can be unclear on how to proceed with integrating Stripe payments alongside your existing mobile in-app purchases. This sample project demonstrates how to use Stripe Checkout and webhooks to send purchase data to RevenueCat. Once published, you’ll be able to share individual links with users that will automatically redirect to Stripe, then send the receipt back to RevenueCat once the purchase is completed.

It’s recommended that you know the basics about RevenueCat and Stripe before continuing with this project.

 

Example Use-Cases

  • Win-back email campaigns

    • Send individual links to expired users to re-subscribe using Stripe checkout. In this case, you’ll need to have app user IDs and email addresses paired (typically from your own auth system).
       

Setup

The easiest way to use this sample is by deploying to Heroku instantly with the button below.

Deploy

Or you can deploy by clicking this link.

 

The following environment variables should be set before starting the server.

  • RC_API_KEY - Required. API key for your RevenueCat app.

  • STRIPE_KEY - Required. Production Stripe API key.

  • STRIPE_KEY_TEST - Required. Test Stripe API key.

  • TEST_MODE - Required. Should be ‘false’ for production mode. Set to ‘true’ if you want to use Stripe in test mode.

  • SUCCESS_URL - Required. The URL that Stripe will redirect the user to after a successful purchase. If you don't have a website, you could use a URL scheme to redirect back to your mobile app.

  • CANCEL_URL - Required. The URL that Stripe will redirect the user to after the user cancels a purchase without completing it. If you don't have a website, you could use a URL scheme to redirect back to your mobile app.

 

Purchasing

Once your products and Stripe account have been set up as detailed in the GitHub repository, you’re ready to start sending links to your customers.


If you deployed to Heroku, your link might look something like this:

http://(herokuID).herokuapp.com/purchase/:appUserID/:stripePriceID

 

Of course, with a little bit more work, you could have your own domain here so your links look more friendly for your existing customers.

Make sure you test these links with test Stripe products - the last thing you would want is a customer who tries to purchase but the link is broken. Additionally, before you start sending links to customers, be sure you’ve included a ‘real’ Stripe price ID and not a test product.

 

Summary

This is a great way to offer customers an alternative to App Store payments. Keep in mind: you can’t advertise this as an option inside of your app, or Apple may reject your app!

For more information about this project and implementation, take a look at the GitHub repository.


This post has been closed for comments