Skip to main content

Track External Purchases

Import Stripe purchases made outside of RevenueCat purchase flows

AIAsk AIChatGPTClaude

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.created
  • checkout.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 ID
  • app_user_id: The App User ID the subscription should be applied to

Headers

  • X-Platform: Set to stripe
  • Authorization: Bearer YOUR_REVENUECAT_STRIPE_APP_PUBLIC_API_KEY
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:

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.

⚠️One-time purchase support

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.

📘App User ID is required

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.