Track External Purchases
Import Stripe purchases made outside of RevenueCat purchase flows
If you accept Stripe purchases outside of RevenueCat purchase flows — for example, through your own checkout integration — you can import those purchases into RevenueCat so they are reflected in charts and customer data, and used to unlock entitlements.
There are two ways to do this:
- Manually, by posting purchase tokens to the RevenueCat API
- Automatically, using Stripe server-to-server notifications
Tracking purchases manually via the RevenueCat API
Send Stripe subscriptions to RevenueCat using the POST receipt endpoint. When using Stripe Checkout, send the purchase only after one of these events has completed:
customer.subscription.createdcheckout.session.completed
We recommend listening to customer.subscription.created for subscriptions and checkout.session.completed for one-time purchases for the simplest flow.
The only required fields when sending a Stripe purchase to the RevenueCat API are:
fetch_token: Your Stripe subscription ID (sub_...) or your Stripe Checkout Session IDapp_user_id: The App User ID the subscription should be applied to
Headers
X-Platform: Set tostripeAuthorization:Bearer YOUR_REVENUECAT_STRIPE_APP_PUBLIC_API_KEY
- Code
curl -X POST \
https://api.revenuecat.com/v1/receipts \
-H 'Content-Type: application/json' \
-H 'X-Platform: stripe' \
-H 'Authorization: Bearer YOUR_REVENUECAT_STRIPE_APP_PUBLIC_API_KEY' \
-d '{ "app_user_id": "my_app_user_id",
"fetch_token": "sub_xxxxxxxxxx"
}'
Stripe subscriptions are automatically refreshed by RevenueCat the same way as subscriptions from the app stores. This means it may take up to two hours for a Stripe cancellation to be reflected in the RevenueCat backend. Alternatively, you can re-post the same subscription to RevenueCat after a user cancels, and it will be updated immediately.
Tracking purchases automatically via server-to-server notifications
RevenueCat can automatically process Stripe tokens sent through server-to-server notifications. To enable this, ensure the following are configured:
Choose when RevenueCat registers subscription purchases
The Subscription purchase recognition setting controls how RevenueCat handles an active Stripe subscription when its latest invoice is still pending. This setting applies to purchases tracked automatically through Stripe server notifications and manually through POST /receipts.
- Register a purchase when an invoice is created: RevenueCat registers the active subscription while its latest invoice is still pending. This can grant Entitlements before Stripe confirms the payment.
- Register a purchase when the invoice has been paid: RevenueCat waits until Stripe reports that the latest invoice is paid before registering the subscription purchase. The RevenueCat dashboard selects this behavior by default when you create a new Stripe config.
To change this behavior, open an existing Stripe config in the RevenueCat dashboard and select an option under Subscription purchase recognition.
One-time purchases
To track one-time purchases made through Stripe Checkout, send the Checkout Session ID as the fetch_token when posting to the RevenueCat API. RevenueCat supports both one-time purchases and subscriptions made through Stripe Checkout, using Stripe's Prices objects.
RevenueCat supports non-subscription purchases, as long as they are created through a Checkout Session. Other ways of selling one-time purchases outside of Checkout Sessions can't be identified.
In order for a Stripe subscription to be honored within an app, the Purchases SDK must be configured with the same App User ID associated with the Stripe subscription.
Troubleshooting
A Stripe purchase is missing/not found in RevenueCat
If a Stripe purchase seems to be missing in RevenueCat, first double check you've got the right App User ID. Sometimes users may have multiple accounts, and may contact you referencing the wrong identifier.
If you're sure you've got the right App User ID, you'll likely need to re-send the purchase token and App User ID to our API, or wait for a new subscription event to occur (if you have server-to-server notifications enabled). The end-user won't be able to directly restore their Stripe purchases to sync to RevenueCat as is possible with the mobile app stores.