docs
llms.txt0 starsChanged 55 days agoMITView on GitHub
RevenueDot is an open-source backend for in-app purchases and subscriptions on the App Store, Google Play and the web. It has an SDK for every platform. RevenueDot Cloud Pro is free until your apps make $10,000 a month, then 0.5% of revenue above that, never more than $999 a month; Enterprise is custom. The server is AGPL-3.0 and the SDKs are MIT. RevenueDot is also the open-source RevenueCat alternative: the first release is v2026.10.03, and it has run in production…
- Reads credentials
- Installs packages
- Sends data out
The file
Show its rules and text
We split this llms-full.txt into the rules it gives an agent
22 rules. About 0 are common, 8 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 115
Do it in the dashboard:
- Distinctive: line 116
Apps: add an app of type Test Store.
- Very specific: line 117
Product catalog, Products: add a product for the Test Store app, for example pro_monthly, a subscription that lasts one month.
- Very specific: line 118
Product catalog, Entitlements: add an entitlement called pro and attach the product.
- Very specific: line 119
Product catalog, Offerings: add an offering called default, give it a package with the product, and make it current.
- Very specific: line 147
Android: Add the package from Maven Central, then configure the SDK in Application.onCreate().
- Distinctive: line 166
Flutter: Add the SDK as a git dependency.
- Distinctive: line 273
Check the same customer through the REST API with the secret key:
- Distinctive: line 394
Every SDK's exact call is in its guide: iOS, Android, [React
- Distinctive: line 412
Moving a live app from RevenueCat: use proxy mode or the RevenueDot SDK in the next release, keep your RevenueCat keys through the …
- Very specific: line 479
Create an app per store with POST /v2/projects/{project_id}/apps or on the dashboard's Apps page.
- Very specific: line 554
Archive instead of delete: when a product is retired: POST .../products/{product_id}/actions/archive.
- Distinctive: line 770
Every event's payload is on Webhook events.
- Very specific: line 913
Add the RevenueDot SDK to your app with Swift Package Manager or CocoaPods, then call Purchases.configure(withAPIKey:) with your app's key …
- Very specific: line 937
Use the app's public key from RevenueDot: appl_..., mac_...
- Very specific: line 957
Check the entitlement your app unlocks, here pro, then buy a package from the current offering, the set of products your paywall shows.
- Very specific: line 991
Create a test_store app in RevenueDot and pass its test_...
- Very specific: line 994
Test Store prices come from each product's Test Store price.
- Distinctive: line 1015
Use the app's public key from RevenueDot.
- Very specific: line 1064
Add the RevenueDot SDK, app.revenuedot.purchases:purchases, from Maven Central, then call Purchases.configure in Application.onCreate() …
- Very specific: line 1085
Use the app's goog_... key from RevenueDot, or test_...
- Very specific: line 1105
Check the entitlement your app unlocks, here pro, then buy a package from the current offering, the set of products your paywall shows.
≈ “Common” is an estimate: at least 1 in 5 of the 4,067 llms.txt files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
# RevenueDot documentation (full text)
> RevenueDot is an open-source backend for in-app purchases and subscriptions on the App Store, Google Play and the web. It has an SDK for every platform. RevenueDot Cloud Pro is free until your apps make $10,000 a month, then 0.5% of revenue above that, never more than $999 a month; Enterprise is custom. The server is AGPL-3.0 and the SDKs are MIT.
> RevenueDot is also the open-source RevenueCat alternative: the first release is v2026.10.03, and it has run in production beside RevenueCat since 2026-10-02.
> Start for free on RevenueDot Cloud (https://app.revenuedot.app/signup). Building and testing are free, no card needed. Add a card when you go live; Pro costs $0 until your apps make $10,000 a month. A new app installs the RevenueDot SDK for its platform and passes its API key; on RevenueDot Cloud nothing else is needed. An app switching from RevenueCat can keep the RevenueCat SDK, set its proxy URL to RevenueDot and keep its purchase code, offerings and customers.
> It verifies App Store and Google Play purchases on the server, keeps each customer's entitlements current from store notifications, and sends webhooks in RevenueCat's payload format.
> On RevenueDot Cloud, apps use the API at https://api.revenuedot.app and people sign in to the dashboard at https://app.revenuedot.app/login. The server is AGPL-3.0. The RevenueDot SDKs are MIT, built from RevenueCat's open-source SDKs, and keep RevenueCat's class and method names, so code imports RevenueCat and calls Purchases. RevenueDot is not affiliated with RevenueCat, Inc.
Generated from https://github.com/revenuedot/docs by scripts/gen-llms.mjs. Index: https://raw.githubusercontent.com/revenuedot/docs/main/llms.txt
=== Getting started ===
# What is RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/README.md
Description: RevenueDot is an open-source backend for in-app purchases and subscriptions on the App Store, Google Play, Amazon, Stripe and the web. Install the RevenueDot SDK and start for free on RevenueDot Cloud.
RevenueDot is an open-source backend for in-app purchases and subscriptions on the App Store, Google Play, Amazon, Stripe and the web. You install the RevenueDot SDK in your app. RevenueDot then checks every purchase with the store, keeps each customer's access in sync and tells your backend what happened. The quickest start is **RevenueDot Cloud**: [start for free](https://app.revenuedot.app/signup). Building and testing are free, no card needed. Add a card when you go live; Pro costs $0 until your apps make $10,000 a month.
```swift
// iOS: install the RevenueDot SDK, then pass your app's key. On RevenueDot Cloud that is all the setup.
import RevenueCat
Purchases.configure(withAPIKey: "appl_...")
```
The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `RevenueCat` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account. The install line for every platform is in [Which SDKs does RevenueDot have?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md).
[](https://revenuedot.app/videos/revenuedot-platform-demo.mp4)
*Watch the 2:32 walkthrough, or [on YouTube](https://www.youtube.com/watch?v=iZH8eTC5B1c). [Watch page](https://revenuedot.app/watch/revenuedot-platform-demo).*
> Every page states what exists today and what is planned. Current limits are listed in [Known issues](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/known-issues.md).
## RevenueDot checks purchases, keeps access in sync and runs your paywalls
- **It checks every purchase with the store.** App Store purchases are verified against Apple's signed transactions and the App Store Server API. Google Play purchases are verified with the Google Play Developer API. Nothing is trusted from the device alone.
- **It keeps each customer's access up to date.** It turns store events (renewals, cancellations, billing problems, refunds, pauses) into **entitlements**. An entitlement is the access your app checks, such as `pro`.
- **It serves your paywall's contents.** An **offering** is the set of products your paywall shows, grouped into **packages**. You build [paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md) from templates in a visual editor and compare them with [experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md).
- **It tells your backend what happened.** [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md) carry an HMAC signature, and [integrations](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md) send the same events to analytics and marketing tools.
- **It shows your numbers.** [Charts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/charts.md) cover revenue, subscribers, trials and churn.
- **It sells beyond the app stores.** [Web checkout](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md) runs on your own Stripe account, and in-app currencies let you sell credits.
- **It gives you APIs and a dashboard.** REST APIs (v1 and v2) and a web dashboard manage the catalog, customers, apps, API keys and webhooks.
## RevenueDot is open source, and Cloud Pro is free until your apps make $10,000 a month
| | RevenueDot |
|---|---|
| Source code | Open source: the server and dashboard are AGPL-3.0 ([repository](https://github.com/revenuedot/revenuedot)), and the SDKs are MIT |
| Where it runs | RevenueDot Cloud at `https://api.revenuedot.app` |
| Price | RevenueDot Cloud Pro is free until your apps make $10,000 a month, then 0.5% of revenue above that, never more than $999 a month; Enterprise is custom. See [Cloud billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/cloud-billing.md) |
| App changes | Install the RevenueDot SDK and pass your app's key. |
| Data | RevenueDot runs the database for you |
## Your app talks to RevenueDot, and RevenueDot talks to the stores
```text
Your app (RevenueDot SDK)
│ GET /v1/subscribers/{id}, GET .../offerings, POST /v1/receipts
▼
RevenueDot server ◀──── App Store Server Notifications v2, Google Play real-time notifications
│ Postgres (customers, purchases, events)
├──▶ Webhooks to your backend (INITIAL_PURCHASE, RENEWAL, EXPIRATION ...)
└──▶ Dashboard and REST API (catalog, customers, keys)
```
1. The app asks RevenueDot for offerings and customer info.
2. The user buys through the App Store, Google Play or the built-in **Test Store**. The Test Store lets you buy before you have an App Store or Google Play account.
3. The SDK posts the purchase to `POST /v1/receipts`. RevenueDot verifies it with the store and answers with updated customer info, including active entitlements.
4. Later changes, such as renewals and refunds, arrive as store notifications. RevenueDot updates the customer and sends webhooks.
## Switching from RevenueCat? Keep your SDK and change one line
An app that already ships the RevenueCat SDK can keep it. Set the SDK's proxy URL to RevenueDot before `configure`, turn off its response-signature check, and keep your purchase code. RevenueDot implements the API that the RevenueCat SDKs call, its REST APIs are RevenueCat-compatible, and its webhooks use RevenueCat's payload shape.
```swift
// Switching from RevenueCat: keep the RevenueCat SDK and point it at RevenueDot Cloud, or at your own server.
Purchases.proxyURL = URL(string: "https://api.revenuedot.app")!
Purchases.configure(with: Configuration.Builder(withAPIKey: "appl_...").with(entitlementVerificationMode: .disabled).build())
```
The full order of steps, with the importer and a side-by-side run, is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
RevenueDot is not affiliated with, endorsed by or sponsored by RevenueCat, Inc. "RevenueCat" is a trademark of RevenueCat, Inc. and is used here only to describe compatibility.
## Where to go next
- **Try it in 5 minutes:** [create a free RevenueDot Cloud account](https://app.revenuedot.app/signup), then follow the [Quickstart](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md).
- **Install the SDK for your platform:** [SDK guides](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md).
- **Learn the model:** [Concepts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/README.md).
- **Already selling with your own StoreKit or Google Play Billing code?** [Import your products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md) from App Store Connect, Google Play or Stripe, install the RevenueDot SDK, and call `syncPurchases()` once so current subscribers keep access. See [How do I connect my app?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md).
- **Switching from RevenueCat? Keep your SDK and change one line:** [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
- **Run your own server (advanced):** [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md) and [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md).
- **Look something up:** [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/README.md), [Help center](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/README.md), [Blog](https://raw.githubusercontent.com/revenuedot/docs/main/blog/README.md).
---
# How do I make a first purchase with RevenueDot in 5 minutes?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md
Description: Create a RevenueDot Cloud account, add a Test Store app with a product and an entitlement, make a test purchase from the dashboard, then install the RevenueDot SDK in your app and pass your key.
Create an account on **RevenueDot Cloud**, add a Test Store app with one product and one entitlement, make a test purchase from the dashboard, then install the RevenueDot SDK in your app and pass it your key. You need no server, no App Store account and no Google Play account. Building and testing are free, no card needed. Add a card when you go live; Pro costs $0 until your apps make $10,000 a month.
[](https://revenuedot.app/videos/revenuedot-first-purchase.mp4)
*Watch the 1:18 walkthrough, or [on YouTube](https://www.youtube.com/watch?v=1YLygdbWOKM). [Watch page](https://revenuedot.app/watch/revenuedot-first-purchase).*
## 1. Create an account
1. Open [app.revenuedot.app/signup](https://app.revenuedot.app/signup).
2. Enter your email, a password of at least 8 characters, and a name for your first project. A project holds your apps, products and customers.
3. Open the email from RevenueDot and click the link to confirm your address. The link works for 24 hours. Cloud needs a confirmed address before you can create secret API keys or invite teammates.
The dashboard opens on **Overview**, with a six-step setup checklist. To sign in later, use [app.revenuedot.app/login](https://app.revenuedot.app/login).
## 2. Add a Test Store app, a product and an entitlement
The **Test Store** is RevenueDot's built-in store for testing. Its purchases unlock entitlements and send webhooks like real ones, and they are always sandbox data.
Do it in the dashboard:
1. **Apps:** add an app of type **Test Store**.
2. **Product catalog, Products:** add a product for the Test Store app, for example `pro_monthly`, a subscription that lasts one month.
3. **Product catalog, Entitlements:** add an entitlement called `pro` and attach the product. Your app checks this entitlement to unlock paid features.
4. **Product catalog, Offerings:** add an offering called `default`, give it a package with the product, and make it current. The SDK reads this offering to build the paywall.
Or seed all of it with one script. It needs `curl` and `jq`, and it uses only the public API. It signs in with the account you just made, then adds a Test Store app, three products, a `pro` entitlement, a `default` offering and a secret key. Run it after you confirm your email, because Cloud creates secret keys only for confirmed accounts:
```bash
curl -fsSLO https://raw.githubusercontent.com/revenuedot/examples/main/selfhost/docker-compose/seed.sh
RD_URL=https://api.revenuedot.app RD_EMAIL=you@example.com RD_PASSWORD='your password' bash seed.sh
```
The script prints the project id, the Test Store key (`test_...`) and a secret key (`sk_...`). Keep the secret key on your server only. Sign in to the dashboard at [app.revenuedot.app/login](https://app.revenuedot.app/login), even though the script prints the API address.
## 3. Make a test purchase from the dashboard
On **Overview**, click **Make a test purchase**. Keep the app user ID `test_user_1`, pick the product and click **Purchase**.
The purchase runs through the same steps as a real one. Open **Customers** and click `test_user_1`: the customer has the `pro` entitlement, active for one month, and the purchase events are listed.
## 4. Install the RevenueDot SDK and pass your key
Copy the Test Store key (it starts with `test_`) from **API keys**. Install the RevenueDot SDK for your platform and pass the key to `configure`. On RevenueDot Cloud that is all the setup, because the SDK already sends its requests to `https://api.revenuedot.app`.
The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `RevenueCat` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
**iOS.** In Xcode, choose **File > Add Package Dependencies**, enter `https://github.com/revenuedot/purchases-ios`, pick the exact version `5.91.0-revenuedot` and add the `RevenueCat` product. With CocoaPods, add `pod 'RevenueDotPurchases', '5.91.0'` instead.
```swift
import RevenueCat
Purchases.configure(withAPIKey: "test_...")
```
**Android.** Add the package from Maven Central, then configure the SDK in `Application.onCreate()`.
```kotlin
// build.gradle.kts
implementation("app.revenuedot.purchases:purchases:10.23.3")
```
```kotlin
Purchases.configure(PurchasesConfiguration.Builder(this, "test_...").build())
```
**React Native and Expo.** The npm alias installs the RevenueDot SDK under the name `react-native-purchases`, so your code imports `Purchases` from `"react-native-purchases"`.
```bash
npm install react-native-purchases@npm:@revenuedot/react-native-purchases@10.10.2
```
```ts
import Purchases from "react-native-purchases";
Purchases.configure({ apiKey: "test_..." });
```
**Flutter.** Add the SDK as a git dependency. The pub.dev names belong to RevenueCat, so the RevenueDot SDK comes from GitHub.
```yaml
# pubspec.yaml
dependencies:
purchases_flutter:
git:
url: https://github.com/revenuedot/purchases-flutter.git
ref: 10.13.2-revenuedot
```
```dart
import 'package:purchases_flutter/purchases_flutter.dart';
await Purchases.configure(PurchasesConfiguration('test_...'));
```
The install lines for the web, Capacitor, Kotlin Multiplatform, Unity and Cordova are in the [SDK guides](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md). Native SDKs accept `test_` keys only in debug builds. Ship with the `appl_` and `goog_` keys from your App Store and Google Play apps.
The shortest way to see a purchase in an app is the [purchases-js web example](https://github.com/revenuedot/examples/tree/main/web/purchases-js-vite), which runs in a browser. The second `npm install` swaps in the RevenueDot SDK for the web through an npm alias, so the example's imports stay as they are. The example reads the server address from `VITE_REVENUEDOT_URL`.
```bash
git clone https://github.com/revenuedot/examples.git && cd examples/web/purchases-js-vite
npm install
npm install @revenuecat/purchases-js@npm:@revenuedot/purchases-js@1.67.0
printf "VITE_REVENUEDOT_URL=https://api.revenuedot.app\nVITE_REVENUEDOT_API_KEY=test_...\n" > .env.local
npm run dev # open http://localhost:5199, click Buy, then "Test valid purchase"
```
> **Switching from RevenueCat?** Keep the RevenueCat SDK your app already ships. Set its proxy URL to `https://api.revenuedot.app` before `configure`, and turn off its response-signature check. See [How do I connect my app?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md#switching-from-revenuecat-keep-your-sdk-and-set-one-line) and [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
Give each Test Store product a price in the dashboard (Product catalog, Edit product, Test Store price) so the paywall shows it. A product without one shows 0. Real prices come from the App Store and Google Play. See [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Run your own server (advanced)
Most people should use RevenueDot Cloud above. If your company requires its own server, the server on Cloud is the same open-source code. You need Docker with Compose v2, plus `git`, `curl` and `jq`. Most of the 5 minutes is the first image build.
### 1. Start RevenueDot
```bash
git clone https://github.com/revenuedot/revenuedot.git
cd revenuedot
cp .env.example .env # sets POSTGRES_PASSWORD; change it before the first start
docker compose up -d # pulls ghcr.io/revenuedot/revenuedot, starts the server and Postgres
curl http://localhost:8787/v1/health
```
```json
{"status":"ok"}
```
One container serves the SDK API, the REST API and the dashboard on port 8787. To use another host port, set `REVENUEDOT_PORT=8797` in `.env`. The dashboard is at `http://localhost:8787/login`; the bare `/` path returns a small JSON document.
### 2. Seed a project with a Test Store app
The seed script uses only the public API. It creates a dashboard account and project, a Test Store app, three products, a `pro` entitlement, a `default` offering and a secret key.
```bash
curl -fsSLO https://raw.githubusercontent.com/revenuedot/examples/main/selfhost/docker-compose/seed.sh
bash seed.sh # RD_URL=http://localhost:8797 bash seed.sh for another port
```
```text
RevenueDot is seeded.
Dashboard http://localhost:8787 (sign in as dev@example.com)
Project id projqhf9p5jb
Test Store key test_960d2b3001bac439c7a73d7f4214514c <- the SDK's API key; the SDK's proxy URL is http://localhost:8787
Secret key sk_8b8dc12a743e51f4de759b0b9c6d372e6d25d32fe7280672 <- server-side only (REST API, backend checks)
Try it:
curl -s -H "Authorization: Bearer test_960d2b3001bac439c7a73d7f4214514c" http://localhost:8787/v1/subscribers/user_1/offerings
```
Save the two keys for the next steps:
```bash
export TEST_KEY=test_... # the Test Store key printed above
export SECRET_KEY=sk_... # the secret key printed above
```
To see what the script does, or to do it by hand, read [the seed script](https://github.com/revenuedot/examples/blob/main/selfhost/docker-compose/seed.sh). Each step is one REST API v2 call. You can also do everything in the dashboard.
### 3. Ask for offerings, as the SDK does
```bash
curl -s -H "Authorization: Bearer $TEST_KEY" http://localhost:8787/v1/subscribers/user_1/offerings
```
```json
{"current_offering_id":"default","offerings":[{"description":"Standard plans","identifier":"default","metadata":null,"packages":[{"identifier":"$rc_monthly","platform_product_identifier":"pro_monthly"},{"identifier":"$rc_annual","platform_product_identifier":"pro_annual"},{"identifier":"$rc_lifetime","platform_product_identifier":"pro_lifetime"}]}]}
```
### 4. Make a Test Store purchase
In an app, the SDK makes this call for you after the user confirms the Test Store dialog. The Test Store accepts any `fetch_token` of the form `test_<purchase time in ms>_<id>`.
```bash
curl -s http://localhost:8787/v1/receipts \
-H "Authorization: Bearer $TEST_KEY" -H "Content-Type: application/json" \
-d "{\"app_user_id\":\"user_1\",\"fetch_token\":\"test_$(date +%s)000_quickstart\",\"product_id\":\"pro_monthly\",\"price\":9.99,\"currency\":\"USD\"}"
```
The answer is the customer's info. `pro` is now in `entitlements`, active until one month from now:
```json
{
"request_date": "2026-09-30T19:49:29Z",
"subscriber": {
"entitlements": {
"pro": { "expires_date": "2026-10-30T19:49:29Z", "grace_period_expires_date": null, "product_identifier": "pro_monthly", "purchase_date": "2026-09-30T19:49:29Z" }
},
"original_app_user_id": "user_1",
"subscriptions": {
"pro_monthly": { "store": "test_store", "is_sandbox": true, "period_type": "normal", "expires_date": "2026-10-30T19:49:29Z", "...": "..." }
}
},
"purchased_products": { "pro_monthly": { "should_consume": false } }
}
```
Check the same customer through the REST API with the secret key:
```bash
curl -s -H "Authorization: Bearer $SECRET_KEY" \
"http://localhost:8787/v2/projects/<project id>/customers/user_1/active_entitlements"
```
The same `curl` calls work on Cloud: replace `http://localhost:8787` with `https://api.revenuedot.app`.
### 5. Set the SDK's proxy URL to your server
Install the RevenueDot SDK as in [step 4 above](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md#4-install-the-revenuedot-sdk-and-pass-your-key). Then add one line of setup before `configure`: the SDK's proxy URL, which is your server's address, for example `http://localhost:8787`. Then set entitlement verification to `disabled`. The RevenueDot SDK trusts RevenueDot Cloud's response-signing key, and your server signs with its own key. iOS and Android default to informational mode, so the code below sets `disabled`. React Native and Flutter already default to `disabled`. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
```swift
// iOS: set your server's address before configure.
Purchases.proxyURL = URL(string: "http://localhost:8787")!
Purchases.configure(with: Configuration.Builder(withAPIKey: "test_...").with(entitlementVerificationMode: .disabled).build())
```
```kotlin
// Android: the emulator reaches your computer at 10.0.2.2.
Purchases.proxyURL = URL("http://10.0.2.2:8787")
Purchases.configure(PurchasesConfiguration.Builder(this, "test_...").entitlementVerificationMode(EntitlementVerificationMode.DISABLED).build())
```
```ts
// React Native / Expo: verification is already disabled by default.
await Purchases.setProxyURL("http://localhost:8787");
Purchases.configure({ apiKey: "test_..." });
```
```dart
// Flutter: verification is already disabled by default.
await Purchases.setProxyURL('http://localhost:8787');
await Purchases.configure(PurchasesConfiguration('test_...'));
```
On the Android emulator, use `http://10.0.2.2:8787`, because the emulator reaches your computer at `10.0.2.2`. In the purchases-js example, set `VITE_REVENUEDOT_URL=http://localhost:8787`. The same lines work with the RevenueCat SDK if your app already ships it.
To run it for real customers, read [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md) and [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md).
## Next steps
- Receive the purchase on your backend: [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md).
- Simulate renewals, cancellations and refunds without waiting: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
- Learn how entitlements, offerings and customers fit together: [Concepts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/README.md).
- Connect a real store: [App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md), [Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md).
- Show a paywall: [Paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md).
- Switching from RevenueCat? Keep your SDK and change one line: [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
---
# How do I connect my app to RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md
Description: Install the RevenueDot SDK for your platform and pass your app's key; on RevenueDot Cloud nothing else is needed. An app switching from RevenueCat can instead keep its SDK and set one line, and the importer keeps its RevenueCat API keys working.
Install the RevenueDot SDK for your platform and pass your app's API key to `configure`. On RevenueDot Cloud that is all the setup, because the SDK already calls `https://api.revenuedot.app`. This is the way for new apps. It is also the way for any app that wants the SDK to verify that each response came from RevenueDot and to send nothing to RevenueCat's hosts. An app that already ships the RevenueCat SDK can instead keep it and set one line, the **proxy URL**. When such an app switches, the importer lets versions already in users' hands keep their **RevenueCat API keys**.
| Way | Who it is for | What you change in the app | What you get | Status (2026-10-02) |
|---|---|---|---|---|
| [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md#install-the-revenuedot-sdk-and-pass-your-key) | **Every new app (the default)** | Add the package and pass your app's key | Signed responses verify against RevenueDot Cloud; no traffic to RevenueCat's hosts | Released for all ten SDKs |
| [Keep the RevenueCat SDK and set one line](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md#switching-from-revenuecat-keep-your-sdk-and-set-one-line) | Apps switching from RevenueCat | One setting, the proxy URL, plus the verification mode | Purchases, customer info and offerings go to RevenueDot. Some diagnostics and analytics still go to RevenueCat ([known limits](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/known-issues.md#sdk-features)) | Works with every RevenueCat app SDK |
| [Keep your RevenueCat keys](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md#keep-your-revenuecat-api-keys) | Apps switching from RevenueCat | Nothing | App versions already in users' hands keep working | Works (importer) |
## Install the RevenueDot SDK and pass your key
```swift
// iOS: Swift package github.com/revenuedot/purchases-ios at 5.91.0-revenuedot, or pod 'RevenueDotPurchases', '5.91.0'.
import RevenueCat
Purchases.configure(withAPIKey: "appl_...")
```
```kotlin
// Android: implementation("app.revenuedot.purchases:purchases:10.23.3"), then in Application.onCreate():
Purchases.configure(PurchasesConfiguration.Builder(this, "goog_...").build())
```
```ts
// React Native and Expo: npm install react-native-purchases@npm:@revenuedot/react-native-purchases@10.10.2
import { Platform } from "react-native";
import Purchases from "react-native-purchases";
Purchases.configure({ apiKey: Platform.OS === "ios" ? "appl_..." : "goog_..." });
```
The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `RevenueCat` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account. It keeps the names your code imports (`import RevenueCat`, `com.revenuecat.purchases.*`, `package:purchases_flutter`). These changes matter to your app:
- Each SDK calls `https://api.revenuedot.app` (RevenueDot Cloud) by default, so a Cloud project needs no proxy URL.
- Each SDK trusts RevenueDot's response-signing key, so entitlement verification reports `VERIFIED` against RevenueDot Cloud.
- The Android SDK and purchases-js send their diagnostics and events to RevenueDot too.
- The proxy URL works on Flutter web.
There is a RevenueDot SDK for iOS, Android, React Native and Expo, Flutter, the web, Capacitor and Ionic, Kotlin Multiplatform, Unity and Cordova. The install line for each one is in [Which SDKs does RevenueDot have?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md): CocoaPods and Swift packages for iOS, Maven Central for Android and Kotlin Multiplatform, npm for the web, React Native, Capacitor and Cordova, a git tag for Flutter, and OpenUPM for Unity.
**Self-hosting:** also set the SDK's proxy URL to your server before `configure`, and set entitlement verification to `disabled`. A self-hosted server signs with its own key, so the official builds only verify against RevenueDot Cloud. The iOS, Android, Capacitor and Unity SDKs default to informational mode, which would log every response from your server as a failed check, so they need the setting. React Native, Flutter and Kotlin Multiplatform already default to `disabled`. Cordova has no setting for it, so it logs the failed checks and still grants access. Each [SDK guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md) shows the code. To verify against your own server, build the SDKs with your key; see [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md#verify-against-your-own-server).
## Switching from RevenueCat? Keep your SDK and set one line
An app that already ships the RevenueCat SDK can keep it. Set the SDK's proxy URL to RevenueDot (`https://api.revenuedot.app` for RevenueDot Cloud, or your own server) and turn its signature check off. That is **proxy mode**, and it works with every RevenueCat app SDK.
[](https://revenuedot.app/videos/revenuedot-connect-your-app.mp4)
*Watch the 1:18 walkthrough of proxy mode, or [on YouTube](https://www.youtube.com/watch?v=M_D0YodECkU). [Watch page](https://revenuedot.app/watch/revenuedot-connect-your-app).*
```swift
// iOS. Keep the RevenueCat SDK and point it at your RevenueDot server; nothing else in the app changes.
Purchases.proxyURL = URL(string: "https://revenuedot.example.com")!
Purchases.configure(with: Configuration.Builder(withAPIKey: "appl_...").with(entitlementVerificationMode: .disabled).build())
```
```kotlin
// Android. Keep the RevenueCat SDK and point it at your RevenueDot server; nothing else in the app changes.
Purchases.proxyURL = URL("https://revenuedot.example.com")
Purchases.configure(PurchasesConfiguration.Builder(context, "goog_...").entitlementVerificationMode(EntitlementVerificationMode.DISABLED).build())
```
```ts
// React Native and Expo. Keep the RevenueCat SDK and point it at your RevenueDot server; nothing else in the app changes.
import { Platform } from "react-native";
import Purchases from "react-native-purchases";
await Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configure({ apiKey: Platform.OS === "ios" ? "appl_..." : "goog_..." });
```
- **Set the proxy URL before `configure`.** The SDK reads it once. For RevenueDot Cloud it is `https://api.revenuedot.app`.
- **Turn entitlement verification off.** The RevenueCat SDK checks responses against RevenueCat's signing key. RevenueDot cannot sign with that key, so iOS and Android would report every response as `FAILED` in their default informational mode. Access still works, but the logs fill with errors. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Use the keys RevenueDot gives each app** (`appl_`, `goog_`, `test_` ...), or keep your RevenueCat keys as described below.
- **Known limits.** The RevenueCat Android SDK still sends diagnostics, paywall events and ad events to RevenueCat's hosts. RevenueCat's purchases-js sends analytics to RevenueCat unless you set `flags: { collectAnalyticsEvents: false }`. Flutter's web build ignores the proxy URL.
- **You can swap in the RevenueDot SDK later**, in any release. It is a package change, because it keeps every import name.
Every SDK's exact call is in its guide: [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md), [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md), [React Native](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/react-native.md), [Flutter](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/flutter.md), [Web](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/web.md), [Capacitor](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/capacitor.md), [Kotlin Multiplatform](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/kotlin-multiplatform.md), [Unity](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/unity.md), [Cordova](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/cordova.md).
## Keep your RevenueCat API keys
Apps already in the store send their RevenueCat public key (`appl_...`, `goog_...`). The [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) sets each RevenueDot app's public key to that same string, so old app versions work against RevenueDot the moment you point traffic at it. You can also do it for one app with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/import/apps/$APP_ID/public_key" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"public_key":"appl_YourExistingRevenueCatKey"}'
```
Old app versions still call RevenueCat's API until they update, because the proxy URL lives in the app. That is why a migration runs both systems side by side for a while. See [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## New apps install the RevenueDot SDK; switching apps can start with one line
- **New app, or new to in-app purchases:** install the RevenueDot SDK and test with the Test Store. See the [Quickstart](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md).
- **Already selling with your own StoreKit or Google Play Billing code:** [import your products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md) from App Store Connect, Google Play or Stripe, install the RevenueDot SDK, and call `syncPurchases()` once on the first launch of the update. It sends the device's existing store purchases to RevenueDot, so current subscribers keep access. Store notifications keep them current after that.
- **You rely on entitlement verification:** install the RevenueDot SDK. When you self-host, build it with your server's key.
- **Self-hosting:** install the RevenueDot SDK, set its proxy URL to your server and set entitlement verification to `disabled`.
- **Moving a live app from RevenueCat:** use proxy mode or the RevenueDot SDK in the next release, keep your RevenueCat keys through the importer, and run both systems side by side in a [dual run](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/dual-run.md) until most users have updated.
## Related
- [Quickstart](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md)
- [SDK guides](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where)
- [Why we forked the RevenueCat SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/blog/why-we-forked-the-revenuecat-sdks.md)
=== Concepts ===
# How is RevenueDot organized?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/README.md
Description: A server holds projects. A project holds apps (one per store), a catalog of products, entitlements, offerings and packages, and customers with their purchases and events.
A RevenueDot server holds **projects**. A project holds **apps** (one per store), a **catalog** (products, entitlements, offerings, packages) and **customers** (with their subscriptions, one-time purchases and events). Your app checks **entitlements**, not products.
```text
Project "Scanner"
├── Apps App Store app (appl_ key) · Google Play app (goog_ key) · Test Store app (test_ key)
├── Products pro_monthly (App Store) · pro:monthly (Google Play) · pro_monthly (Test Store) · lifetime
├── Entitlements pro ← unlocked by any of the products above
├── Offerings default (current) → packages $rc_monthly, $rc_annual → one product per app
└── Customers user_42 (aliases: $RCAnonymousID:ab12…, user_42)
├── subscriptions and one-time purchases, per store
└── events: INITIAL_PURCHASE, RENEWAL, CANCELLATION, EXPIRATION …
```
## The pages in this section
| Page | What it explains |
|---|---|
| [Projects, apps and API keys](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md) | What a project is, which app types exist, and which key goes where |
| [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md) | How store products map to the access your app checks |
| [Offerings and packages](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/offerings-and-packages.md) | How the paywall's contents are chosen without an app update |
| [Customers and app user IDs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md) | Anonymous IDs, `logIn`, aliases, and who owns a restored purchase |
| [Subscriptions and events](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/subscriptions-and-events.md) | Lifecycle states, grace periods, refunds, and the events each change produces |
| [Sandbox and production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/sandbox.md) | How test purchases are kept apart from real ones |
## Words used across the docs
| Word | Meaning |
|---|---|
| **RevenueDot SDK** | The SDK your app installs for its platform. It calls RevenueDot Cloud by default. See [SDK guides](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md) |
| **Proxy URL** | The SDK setting that names the server the SDK calls. You set it when you self-host, or when you switch an app that ships the RevenueCat SDK to RevenueDot |
| **Public app key** | A per-app key the SDK sends (`appl_`, `goog_`, `test_` …). Safe to ship in an app |
| **Secret key** | A per-project key (`sk_…`) for the REST API and your backend. Never ship it in an app |
| **App user ID** | The ID the SDK uses for the current user: either your own ID or an anonymous `$RCAnonymousID:…` |
| **Customer info** | The JSON the SDK decodes into `CustomerInfo`: entitlements, subscriptions and one-time purchases |
| **Test Store** | RevenueDot's built-in store for development. Purchases need no App Store or Google Play account and are always sandbox |
| **Sandbox** | Test purchases (App Store sandbox, Google Play test purchases, the Test Store). They are kept apart from production in metrics and can be filtered for webhooks. See [Sandbox and production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/sandbox.md) |
---
# What are projects, apps and API keys?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md
Description: A project is one product you sell. An app is that product on one store, with its own public SDK key. Secret keys belong to a project and unlock the REST API.
A **project** is one product you sell, such as "Scanner". It owns the catalog, the customers, the webhooks and the secret keys. An **app** is that product on one store. Each app has its own public key, which the SDK sends with every request.
## Projects
- Signing up in the dashboard (`/signup`) or with `POST /auth/signup` creates your account and its first project.
- More projects: dashboard → **New project**, or `POST /v2/projects` while signed in to the dashboard. A secret key belongs to one project, so it cannot create projects.
- Project settings (`GET` or `POST /v2/projects/{project_id}`): `name`, `transfer_behavior` and `sandbox_transfer_behavior`. See [Customers and app user IDs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md#who-owns-a-restored-purchase).
- Deleting a project deletes everything in it. Only an admin can do it, and only from the dashboard.
## Apps
Create an app per store with `POST /v2/projects/{project_id}/apps` or on the dashboard's **Apps** page.
| `type` | Store | Public key prefix | Store id field | Receipts accepted today |
|---|---|---|---|---|
| `app_store` | Apple App Store (iOS, iPadOS, tvOS, visionOS, watchOS) | `appl_` | `app_store.bundle_id` | Yes |
| `mac_app_store` | Mac App Store | `mac_` | `mac_app_store.bundle_id` | Yes |
| `play_store` | Google Play | `goog_` | `play_store.package_name` | Yes |
| `test_store` | RevenueDot Test Store | `test_` | none | Yes |
| `amazon` | Amazon Appstore | `amzn_` | `amazon.package_name` | Yes ([guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/amazon-appstore.md)) |
| `stripe` | Stripe, your own account | `strp_` | none | Yes: posted by your backend ([guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md)), or sold on RevenueDot's hosted checkout ([web billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)) |
| `paddle` | Paddle Billing, your own account | `pdl_` | none | Yes: posted by your backend ([guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paddle.md)) |
| `roku` | Roku Pay | `roku_` | none (`roku.roku_channel_id` tells channels apart) | Yes ([guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/roku.md)) |
| `galaxy` | Samsung Galaxy Store (a RevenueDot extension of the v2 API) | `galx_` | `galaxy.package_name` | Yes ([guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/galaxy-store.md)) |
| `rc_billing` | RevenueCat Billing | `rcb_` | none | No. Sell on the web with a `stripe` app instead |
```bash
curl -s -X POST http://localhost:8787/v2/projects/$PROJECT_ID/apps \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner (iOS)","type":"app_store","app_store":{"bundle_id":"com.example.scanner"}}'
```
```json
{"object":"app","id":"appk6jbcorn","name":"Scanner (iOS)","created_at":1790798214712,"type":"app_store","project_id":"projujvzn2wl","custom_url_scheme":"rc-3c3d62a884","app_store":{"bundle_id":"com.example.scanner","app_store_connect_api_key_configured":false,"subscription_key_configured":false,"app_store_connect_vendor_number":null}}
```
Store credentials, such as Apple's in-app purchase key and Google's service account, belong to the app. They are never returned by the API; responses only say whether each is configured. Setup is in [Connect the App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md) and [Connect Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md).
## Which key goes where
| Key | Looks like | Where it lives | What it can do |
|---|---|---|---|
| Public app key | `appl_…`, `goog_…`, `test_…` | In your app, passed to `Purchases.configure` | The [SDK endpoints](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md) for that app's project: customer info, offerings, receipts, logIn, attributes |
| Secret key | `sk_…` | Your backend and scripts only | [REST API v1](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v1.md) and [v2](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md) for one project, limited by its permissions |
| Dashboard session | cookie `rd_session` | Your browser | The dashboard, and `/v2` for every project you are a member of |
| Webhook signing secret | `whsec_…` | Your backend | Verifying webhook signatures |
Get an app's public key with `GET /v2/projects/{project_id}/apps/{app_id}/public_api_keys` or on the app's dashboard page. Create secret keys on **API keys** or with `POST /v2/projects/{project_id}/api_keys`. The key is returned once. See [Authentication](https://raw.githubusercontent.com/revenuedot/docs/main/api/authentication.md).
## Related
- [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md)
- [REST API v2: apps](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#apps)
---
# How do products and entitlements work?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md
Description: A product is one item on one store. An entitlement is the access your app checks, such as pro. Attach every product that should unlock it; the app then checks the entitlement, never a product id.
A **product** is one thing a store sells, such as `pro_monthly` on the App Store. An **entitlement** is the access your app checks, such as `pro`. You attach products to an entitlement, and any purchase of any attached product unlocks it. Your app checks `customerInfo.entitlements["pro"]`, so adding a yearly plan or a Google Play product later needs no app update.
```text
Entitlement "pro"
├── pro_monthly App Store app subscription P1M
├── pro_annual App Store app subscription P1Y
├── pro:monthly Google Play app subscription (base plan "monthly")
└── pro_lifetime Test Store app non_consumable
```
## Products
A product belongs to one app. Already set up in App Store Connect, Google Play or Stripe? **Import products** brings them over with their type, duration and name ([Import products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md)). Otherwise create each one in the dashboard (**Products**) or with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/products" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"store_identifier":"pro_monthly","app_id":"'$APP_ID'","type":"subscription","display_name":"Pro monthly","subscription":{"duration":"P1M"}}'
```
| Field | What to put there |
|---|---|
| `store_identifier` | The store's product id, exactly as in App Store Connect or Play Console. For Google Play subscriptions use `subscriptionId:basePlanId`, for example `pro:monthly`. A plain `pro` also matches every base plan of that subscription. For an App Store monthly billing plan with a 12-month commitment (iOS 26.4) use `productId:monthly`; a plain product id also matches it ([offline entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/offline-entitlements.md)) |
| `type` | `subscription`, `non_consumable` (a lifetime unlock), `consumable` (coins, credits), `non_renewing_subscription` or `one_time` |
| `subscription.duration` | ISO 8601 period: `P1W`, `P1M`, `P3M`, `P6M`, `P1Y`, or any other such as `P3D`. The Test Store uses it as the period length, and MRR uses it for every store |
| `display_name` | Your own label for the dashboard |
- **Store ids must match.** RevenueDot matches purchases to products by `store_identifier`. A purchase of an unknown product is still saved and still appears in customer info, but it unlocks nothing.
- **Consumables never unlock an entitlement.** The Android SDK consumes them when RevenueDot answers `should_consume: true`, so they can be bought again.
- **Archive instead of delete** when a product is retired: `POST .../products/{product_id}/actions/archive`. Archived products leave offerings. Deleting a product detaches it from entitlements and packages; purchase history keeps the store id.
## Entitlements
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/entitlements" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"lookup_key":"pro","display_name":"Pro access"}'
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/entitlements/$ENTITLEMENT_ID/actions/attach_products" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"product_ids":["'$MONTHLY_ID'","'$ANNUAL_ID'"]}'
```
The `lookup_key` is the name apps see. The entitlement's `id` (`entl...`) is what REST API v2 uses, for example in `grant_entitlement`.
## How RevenueDot decides whether an entitlement is active
RevenueDot computes entitlements from every purchase the customer owns. The rules come from `packages/core/src/entitlements.ts`:
1. **Each attached purchase is a candidate.** Subscriptions, non-consumable one-time purchases and promotional grants count. Consumables do not.
2. **Access ends at the right time.** For a subscription, access ends at the refund time if it was refunded, else at the end of the grace period if the store granted one, else at the store's expiry. A lifetime purchase never ends unless it is refunded.
3. **The best candidate wins.** A lifetime unlock beats everything. Otherwise the purchase whose access ends last wins.
4. **Expired entitlements stay listed.** Customer info lists every entitlement a customer ever had, with its `expires_date`. The SDK's `isActive` compares that date with the server time, so an entitlement with a past `expires_date` is inactive.
```json
"entitlements": {
"pro": { "expires_date": "2026-10-30T20:41:54Z", "grace_period_expires_date": null, "product_identifier": "pro_monthly", "purchase_date": "2026-09-30T20:41:54Z" }
}
```
## Give access without a purchase
Grant promotional access to a customer, for example for support or a partnership. It appears as a subscription from the `promotional` store and unlocks the entitlement until it ends.
```bash
# REST API v2: until a date (epoch milliseconds)
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/customers/user_42/actions/grant_entitlement" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"entitlement_id":"'$ENTITLEMENT_ID'","expires_at":1830000000000}'
# REST API v1: by lookup key, for a fixed duration
curl -s -X POST "$REVENUEDOT_URL/v1/subscribers/user_42/entitlements/pro/promotional" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" -d '{"duration":"monthly"}'
```
A grant that ends within 2 hours of an existing grant for the same entitlement is treated as a duplicate and changes nothing. Revoke grants with `revoke_granted_entitlement` (v2) or `revoke_promotionals` (v1).
## Related
- [Offerings and packages](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/offerings-and-packages.md)
- [Why is my entitlement not active?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/entitlement-not-active.md)
- [REST API v2: products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
---
# How do offerings and packages decide what my paywall shows?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/offerings-and-packages.md
Description: An offering is a set of packages, and each package holds one product per app. The SDK shows the current offering, so you change the paywall's products on the server without an app update.
The SDK asks RevenueDot for **offerings** and shows the **current** one. An offering holds **packages** such as "Monthly" and "Yearly". Each package holds one product per app, so the same offering serves your iOS and Android apps. To change prices or plans, change the current offering on the server; the app picks it up on its next `getOfferings()` call.
```text
Offering "default" (current) metadata: {"headline":"Go Pro"}
├── $rc_monthly "Monthly" → pro_monthly (App Store) · pro:monthly (Google Play)
├── $rc_annual "Yearly" → pro_annual (App Store) · pro:annual (Google Play)
└── $rc_lifetime "Lifetime" → pro_lifetime (App Store)
```
## What the SDK receives
`GET /v1/subscribers/{app_user_id}/offerings` answers only the packages whose product belongs to the calling app (the app is known from the public key):
```json
{"current_offering_id":"default","offerings":[{"description":"Standard plans","identifier":"default","metadata":null,"packages":[{"identifier":"$rc_monthly","platform_product_identifier":"pro_monthly"},{"identifier":"$rc_annual","platform_product_identifier":"pro_annual"},{"identifier":"$rc_lifetime","platform_product_identifier":"pro_lifetime"}]}]}
```
The SDK then loads prices and titles from the store (or from RevenueDot for Test Store products) and builds `Offerings`, `Offering` and `Package` objects. For Google Play products stored as `subscription:basePlan`, the package also carries `platform_product_plan_identifier`.
## Build an offering
```bash
B="$REVENUEDOT_URL/v2/projects/$PROJECT_ID"; H="Authorization: Bearer $SECRET_KEY"
# 1. The offering. The project's first offering becomes current.
curl -s -X POST "$B/offerings" -H "$H" -H "Content-Type: application/json" -d '{"lookup_key":"default","display_name":"Standard plans"}'
# 2. A package, placed first.
curl -s -X POST "$B/offerings/$OFFERING_ID/packages" -H "$H" -H "Content-Type: application/json" -d '{"lookup_key":"$rc_monthly","display_name":"Monthly","position":0}'
# 3. One product per app in the package.
curl -s -X POST "$B/packages/$PACKAGE_ID/actions/attach_products" -H "$H" -H "Content-Type: application/json" \
-d '{"products":[{"product_id":"'$IOS_MONTHLY'","eligibility_criteria":"all"},{"product_id":"'$ANDROID_MONTHLY'","eligibility_criteria":"all"}]}'
```
- **Use the standard package lookup keys** (`$rc_weekly`, `$rc_monthly`, `$rc_two_month`, `$rc_three_month`, `$rc_six_month`, `$rc_annual`, `$rc_lifetime`) so the SDK's shortcuts such as `offering.monthly` work. Any other key is a custom package.
- **Order** follows `position`, lowest first, then creation time.
- **One product per app per package.** Two products of the same app can share a package only when their `eligibility_criteria` do not overlap (`google_sdk_lt_6` and `google_sdk_ge_6`); otherwise the API answers 409.
- **Metadata** is free-form JSON on the offering (`metadata`). Use it for paywall copy or feature flags; the SDK exposes it as `offering.metadata`.
## Change the paywall without an app update
- **Make another offering current:** `POST .../offerings/{offering_id}` with `{"is_current": true}`. Exactly one offering is current. An archived offering cannot be made current.
- **Show one customer a different offering:** `POST .../customers/{customer_id}/actions/assign_offering` with `{"offering_id": "ofrng..."}` (v2), or `POST /v1/subscribers/{app_user_id}/offerings/{offering}/override` (v1). That customer's `current_offering_id` becomes this offering. Send `null` (v2) or `DELETE /v1/subscribers/{app_user_id}/offerings/override` to undo it.
- **Retire an offering:** archive it (`.../actions/archive`). The current offering cannot be archived; make another one current first.
**Paywalls, targeting and experiments** also change what customers see without an app update:
- **Paywalls:** build a paywall in the dashboard from a template, in the visual editor or with AI, and publish it to an offering. RevenueDot sends it in the offerings response and in remote config, and RevenueCatUI's `PaywallView` renders it. An offering has at most one paywall. See [Paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md).
- **Targeting:** an audience is a set of conditions such as country, platform, app version or active entitlements. A targeting rule gives that audience its own current offering and its own offerings for placements, which the app reads with `offerings.current` and `currentOffering(forPlacement:)`. See [Targeting and experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md).
- **Experiments:** an experiment splits customers between two to four offerings (each with its own placement offerings), keeps each customer in the same variant, and reports conversion, revenue and retention per variant with the chance that each treatment beats the control. See [Experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md).
An offering assigned to one customer through the API wins over targeting rules and experiments.
## Related
- [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md)
- [Paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md)
- [Targeting and experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md)
- [Experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md)
- [REST API v2: offerings and packages](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
- [SDK endpoints: offerings](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md)
---
# How do customers, app user IDs and logIn work?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md
Description: A customer is one person with one or more app user IDs. The SDK starts with an anonymous ID; logIn attaches your own ID; the project's transfer behaviour decides who owns a restored purchase.
A **customer** is one person. They can have several **app user IDs**: the anonymous ID the SDK made on first launch and the ID you pass to `logIn`. Purchases belong to the customer, so they follow the person across IDs. When a purchase that already belongs to someone else is restored, the project's **transfer behaviour** decides who gets it.
## Anonymous app user IDs
Without an ID, the SDK generates one like `$RCAnonymousID:4f2c9a...` and stores it on the device. RevenueDot creates the customer the first time the SDK asks for customer info (`GET /v1/subscribers/{id}` answers 201 for a new customer).
- Anonymous IDs are fine for apps without accounts. Restores then move purchases to the device's current anonymous ID.
- An anonymous ID is lost when the app is deleted, so give users an account if they buy on several devices.
## logIn: attach your own ID
`Purchases.logIn("user_42")` calls `POST /v1/subscribers/identify` with the current and the new ID. What happens depends on who already exists (`apps/server/src/repo/customers.ts`):
| Current ID | `user_42` already exists? | Result | Status |
|---|---|---|---|
| Anonymous, with no other IDs | No | The anonymous customer takes `user_42` as a second ID and keeps its purchases | 201 |
| Anonymous, with no other IDs | Yes | The anonymous customer is merged into `user_42`, unless `user_42` already has an anonymous ID of its own | 200 |
| A known ID (not anonymous) | No | A new, empty customer `user_42` | 201 |
| A known ID | Yes | Switches to `user_42`; nothing is merged | 200 |
`logOut` makes the SDK generate a new anonymous ID. `GET /v2/projects/{project_id}/customers/{customer_id}/aliases` lists every ID of a customer, and any of them works as `customer_id` in REST API v2.
## Who owns a restored purchase
A store purchase has one owner. When a different customer posts the same receipt (a restore or `syncPurchases()` on a second account, or after reinstalling), RevenueDot applies these rules in order (`apps/server/src/services/purchases.ts`):
1. **The owner is anonymous only:** the old anonymous customer is merged into the one posting the receipt. No setting changes this.
2. **The poster is anonymous only and the owner has a real ID:** the poster's anonymous ID is merged into the owner, like logging in as them.
3. **Otherwise** the project's `transfer_behavior` decides:
| `transfer_behavior` | What happens | Event |
|---|---|---|
| `transfer` (default) | The purchase moves to the customer who restored it | `TRANSFER` |
| `transfer_if_no_active` | It moves only if the current owner has no active subscription; otherwise the receipt post fails with 7102 "receipt already in use" | `TRANSFER` when it moves |
| `keep` | It stays with the first owner; the receipt post fails with 7102 | none |
| `share` | The two customers are merged, so both IDs have access | none |
Set it in the dashboard (**Project settings**) or with the API. `sandbox_transfer_behavior` overrides it for sandbox purchases; `null` uses the main setting.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"transfer_behavior":"transfer_if_no_active","sandbox_transfer_behavior":"transfer"}'
```
Store notifications never move a purchase: only a receipt posted from a device does. A `TRANSFER` webhook carries `transferred_from` and `transferred_to`, the ID lists of both customers.
## Attributes
Customers carry key-value **attributes**. The SDK sets them with `setEmail`, `setDisplayName`, `setAttributes` and similar calls (`POST /v1/subscribers/{app_user_id}/attributes`). Keys that start with `$` are reserved names such as `$email`; RevenueDot refuses an invalid `$email` with code 7263 and saves the others. Attributes appear in webhooks as `subscriber_attributes` and in REST API v2 under `/attributes`. A null value deletes an attribute.
## Related
- [How do I restore purchases?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/restore-purchases.md)
- [Subscriptions and events](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/subscriptions-and-events.md)
- [SDK endpoints: identity](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md)
---
# How does RevenueDot track a subscription's lifecycle and which events does it send?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/subscriptions-and-events.md
Description: RevenueDot keeps one record per subscription, updates it from receipts and store notifications, compares the old and new state, and records RevenueCat-style events such as RENEWAL and EXPIRATION.
RevenueDot keeps one record per subscription and updates it whenever the device posts a receipt or the store sends a notification. After each update it compares the old state with the new one, and every difference becomes an **event** with RevenueCat's name, such as `RENEWAL` or `CANCELLATION`. Events are stored, shown in the dashboard and sent to your webhooks.
```text
receipt (device) ─┐ ┌─▶ customer info (entitlements)
├─▶ subscription state ─┤
store notification┘ old vs new └─▶ events ─▶ webhooks, event log
▲
a job every 30 seconds records EXPIRATION when access runs out
```
## One record per subscription
A subscription is keyed by the store's own id, so every renewal updates the same record:
- **App Store:** the `original_transaction_id`.
- **Google Play:** the purchase token.
- **Test Store:** the `test_<ms>_<id>` token.
The record holds the product, the current period, the expiry, the grace period end, whether auto-renew is off (`unsubscribe_detected_at`), billing problems (`billing_issues_detected_at`), refunds, pauses, family sharing and the price.
## Which change produces which event
The rules live in `packages/core/src/events.ts`.
| What changed | Event |
|---|---|
| A subscription is seen for the first time (including a free trial) | `INITIAL_PURCHASE` |
| A new period started: a renewal, a trial converting, a lapsed customer coming back, a recovered billing problem | `RENEWAL` (`is_trial_conversion: true` after a trial) |
| Auto-renew was turned off | `CANCELLATION` with `cancel_reason` `UNSUBSCRIBE`, `BILLING_ERROR`, `PRICE_INCREASE`, `DEVELOPER_INITIATED` or `UNKNOWN` |
| Auto-renew was turned back on | `UNCANCELLATION` |
| The store refunded it | `CANCELLATION` with `cancel_reason: CUSTOMER_SUPPORT` and a negative price |
| A refund was reversed | `REFUND_REVERSED` |
| A renewal charge failed | `BILLING_ISSUE` (with `grace_period_expiration_at_ms`) |
| The product changed now (upgrade), or a change is scheduled for the next renewal (downgrade, crossgrade) | `PRODUCT_CHANGE` (with `new_product_id`) |
| The period got longer without a payment (App Store extension, Google Play deferral) | `SUBSCRIPTION_EXTENDED` |
| A Google Play pause was scheduled | `SUBSCRIPTION_PAUSED` (with `auto_resume_at_ms`) |
| The store asks for, or gets, consent to a price increase | `PRICE_INCREASE_CONSENT_REQUIRED`, `PRICE_INCREASE_CONSENT_APPROVED` |
| Access ended (including the grace period) | `EXPIRATION` with `expiration_reason` |
| A one-time purchase | `NON_RENEWING_PURCHASE` |
| A purchase moved to another customer on restore | `TRANSFER` |
`EXPIRATION` comes from a background job, not from the store: every 30 seconds (every minute on RevenueDot Cloud) the server records `EXPIRATION` for subscriptions whose access has ended and that were not refunded. The same job sends due webhooks and, once a day per Google Play app, checks Google's voided purchases for refunds.
Every event's payload is on [Webhook events](https://raw.githubusercontent.com/revenuedot/docs/main/api/webhook-events.md).
## States in REST API v2
REST API v2 reports each subscription's `status`, computed from the record (`apps/server/src/routes/v2/shapes.ts`):
| `status` | Meaning | `gives_access` |
|---|---|---|
| `trialing` | In a free trial | yes |
| `active` | Paid and current | yes |
| `in_grace_period` | The period ended, the charge failed, and the store grants a grace period | yes |
| `in_billing_retry` | Access ended while the store still retries the charge | no |
| `paused` | A Google Play subscription is paused | no |
| `expired` | Access ended | no |
`auto_renewal_status` is `will_renew`, `will_not_renew`, `will_change_product` or `will_pause`.
## Where changes come from
- **Receipts from the device** (`POST /v1/receipts`): every purchase, restore and `syncPurchases()`. With the App Store in-app purchase key, RevenueDot asks Apple's App Store Server API for the full history and renewal state. For Google Play it reads the purchase from the Play Developer API and acknowledges it within Google's 3-day limit.
- **App Store Server Notifications v2:** `SUBSCRIBED`, `DID_RENEW`, `DID_FAIL_TO_RENEW`, `GRACE_PERIOD_EXPIRED`, `DID_CHANGE_RENEWAL_STATUS`, `DID_CHANGE_RENEWAL_PREF`, `EXPIRED`, `REFUND`, `REFUND_REVERSED`, `REVOKE`, `RENEWAL_EXTENDED`, `OFFER_REDEEMED`, `ONE_TIME_CHARGE` and `PRICE_INCREASE` update the record. Other types are stored and acknowledged. See [App Store setup](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md).
- **Google Play real-time developer notifications:** each subscription or one-time product notification makes RevenueDot read the purchase again from the Play Developer API; voided-purchase notifications record refunds. See [Google Play setup](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md).
- **REST API actions:** grants, refunds, cancels, extensions and deferrals.
Store notifications about a purchase RevenueDot has never seen are stored but not applied, unless the app's **Track new purchases from server-to-server notifications** setting is on. The purchase appears when the device posts its receipt.
## Money in events
`price` (USD) and `price_in_purchased_currency` carry money only on `INITIAL_PURCHASE`, `RENEWAL`, `NON_RENEWING_PURCHASE`, `REFUND_REVERSED` and refunds (negative). Other events report 0. A free trial start reports 0. `price` is converted to USD at the exchange rate of the purchase date: the ECB reference rate for the about 30 currencies the ECB publishes (the last business day before it on weekends and holidays), and the [currency-api](https://github.com/fawazahmed0/exchange-api) daily rate for every other currency.
## Related
- [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)
- [Customers and app user IDs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md): produce each event on purpose
---
# How does RevenueDot keep sandbox purchases apart from real ones?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/sandbox.md
Description: Every purchase carries an environment, sandbox or production, taken from the store. Metrics count production by default, and each webhook can receive one environment or both.
Every purchase and every event carries an **environment**: `sandbox` or `production`. RevenueDot takes it from the store, so you never set it yourself. Sandbox purchases unlock entitlements exactly like real ones, but metrics count production only by default, and each webhook chooses which environment it receives.
## Where sandbox purchases come from
| Source | Environment |
|---|---|
| App Store sandbox accounts and TestFlight | `sandbox` (from Apple's signed transaction) |
| StoreKit testing in Xcode | `sandbox`, accepted only when the app has the StoreKit test certificate (`xcode_certificate`) |
| Google Play license testers and test tracks | `sandbox` (Google's test purchase flag) |
| The RevenueDot [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md) (`test_` keys) | always `sandbox` |
| Real purchases | `production` |
## What changes with the environment
- **Customer info:** each subscription has `is_sandbox`. Entitlements do not care about the environment.
- **Webhooks:** `event.environment` is `SANDBOX` or `PRODUCTION`. A webhook with `environment: "production"` receives only real events; `null` receives both. Use a separate webhook URL for sandbox while you develop.
- **Metrics:** `GET /v2/projects/{project_id}/metrics/overview` counts production. Add `?environment=sandbox` to see test purchases (a RevenueDot extension).
- **REST API v2:** subscriptions and purchases have `environment`, and customer lists of subscriptions, purchases and events accept `?environment=`.
- **Restores:** a project can use a different transfer behaviour for sandbox purchases (`sandbox_transfer_behavior`). See [who owns a restored purchase](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md#who-owns-a-restored-purchase).
- **Store notifications:** App Store Connect has one production URL and one sandbox URL. Point both at the same RevenueDot notification URL; each notification says its environment.
## Related
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
- [Test with App Store sandbox and Google Play testers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md)
- [How do I test purchases without real money?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/test-sandbox-purchases.md)
=== SDK guides ===
# Which SDKs does RevenueDot have?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md
Description: RevenueDot has an SDK for iOS and the other Apple platforms, Android, React Native and Expo, Flutter, the web, Capacitor, Kotlin Multiplatform, Unity and Cordova. Install it and pass your app's key; on RevenueDot Cloud nothing else is needed.
RevenueDot has an SDK for every platform: iOS and the other Apple platforms, Android, React Native and Expo, Flutter, the web, Capacitor and Ionic, Kotlin Multiplatform, Unity and Cordova. Install the one for your platform and pass your app's API key to `configure`. On RevenueDot Cloud nothing else is needed, because each SDK already calls `https://api.revenuedot.app`. **All of them are released** (2026-10-02).
The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `RevenueCat` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
## Install the RevenueDot SDK for your platform
| Platform | Install (versions checked 2026-10-05) | Configure on RevenueDot Cloud | Guide |
|---|---|---|---|
| iOS, macOS, tvOS, watchOS, visionOS | Swift Package Manager: `https://github.com/revenuedot/purchases-ios`, exact version `5.91.0-revenuedot`, product `RevenueCat` (`RevenueCatUI` for paywalls). CocoaPods: `pod 'RevenueDotPurchases', '5.91.0'` (`RevenueDotPurchasesUI` for paywalls) | `Purchases.configure(withAPIKey: "appl_...")` | [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md) |
| Android | Maven Central: `implementation("app.revenuedot.purchases:purchases:10.23.3")` (`purchases-ui` for paywalls) | `Purchases.configure(PurchasesConfiguration.Builder(this, "goog_...").build())` in `Application.onCreate()` | [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md) |
| React Native and Expo | `npm install react-native-purchases@npm:@revenuedot/react-native-purchases@10.10.2`. The alias keeps `import Purchases from "react-native-purchases"`. Paywalls: `react-native-purchases-ui@npm:@revenuedot/react-native-purchases-ui@10.10.2` | `Purchases.configure({ apiKey: Platform.OS === "ios" ? "appl_..." : "goog_..." })`, with `Platform` from `react-native` | [React Native](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/react-native.md) |
| Flutter | Git dependency in `pubspec.yaml`: `https://github.com/revenuedot/purchases-flutter.git` at `10.13.2-revenuedot`. The pub.dev names belong to RevenueCat | `await Purchases.configure(PurchasesConfiguration(kIsWeb ? 'test_...' : defaultTargetPlatform == TargetPlatform.iOS ? 'appl_...' : 'goog_...'))`, with `kIsWeb` and `defaultTargetPlatform` from `package:flutter/foundation.dart` | [Flutter](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/flutter.md) |
| Web (purchases-js) | `npm install @revenuedot/purchases-js@1.67.0` | `Purchases.configure({ apiKey: "test_...", appUserId })`. Only Test Store keys buy through purchases-js today | [Web](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/web.md) |
| Capacitor and Ionic | `npm install @revenuecat/purchases-capacitor@npm:@revenuedot/purchases-capacitor@13.6.1`. The alias keeps the native names | `await Purchases.configure({ apiKey: ... })` | [Capacitor](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/capacitor.md) |
| Kotlin Multiplatform | Maven Central: `implementation("app.revenuedot.purchases:purchases-kmp-core:3.10.1")` | `Purchases.configure(PurchasesConfiguration(apiKey))` | [Kotlin Multiplatform](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/kotlin-multiplatform.md) |
| Unity | OpenUPM: `openupm add com.google.external-dependency-manager` (the External Dependency Manager, which fetches the native libraries), then `openupm add com.revenuedot.purchases-unity` (9.11.1), or git tag `9.11.1-revenuedot` | API keys on the **Purchases** component | [Unity](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/unity.md) |
| Cordova | `cordova plugin add @revenuedot/cordova-plugin-purchases@8.2.3` | `Purchases.configureWith({ apiKey: ... })` | [Cordova](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/cordova.md) |
The cross-platform SDKs (React Native, Flutter, Capacitor, Unity and Cordova) share a native layer, [purchases-hybrid-common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md). The install pulls in RevenueDot's build of it (pods `RevenueDotPurchasesHybridCommon`, Maven `app.revenuedot.purchases:purchases-hybrid-common`, both 19.4.1). Apps never install it directly.
**Self-hosting:** also set the SDK's proxy URL to your server before `configure`, and set entitlement verification to `disabled`. Each SDK trusts RevenueDot Cloud's response-signing key, and a self-hosted server signs with its own key. The iOS, Android, Capacitor and Unity SDKs default to informational mode, so they need the setting. React Native, Flutter and Kotlin Multiplatform already default to `disabled`. Cordova has no setting for it, so it logs each response as a failed check and still grants access. Each guide shows the code. To verify against your own server, build the SDKs with your key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Switching from RevenueCat? Keep your SDK and change one line
All nine RevenueCat app SDKs work with RevenueDot in **proxy mode**: you keep the SDK you ship, set one proxy URL before `configure`, and turn off signature checks. The RevenueCat SDK checks response signatures against RevenueCat's key, so every RevenueDot response reads as "verification failed" unless you turn the check off. The [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) copies each app's public key into RevenueDot, so builds you already shipped keep the same `appl_` or `goog_` key. See [Connect your app](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md) and [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
| SDK | Proxy mode today | How to set the proxy URL | Signature check default (RevenueCat SDK) | Guide |
|---|---|---|---|---|
| iOS, macOS, tvOS, watchOS, visionOS | Yes | `Purchases.proxyURL = URL(string: "...")!` | Informational: logs a failure, still grants access. Set `.disabled` | [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md) |
| Android | Yes. Diagnostics, paywall events and ad events still go to RevenueCat | `Purchases.proxyURL = URL("...")` | Informational. Set `DISABLED` | [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md) |
| React Native and Expo | Yes, on iOS, Android, Expo Go and web | `await Purchases.setProxyURL("...")` | Disabled | [React Native](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/react-native.md) |
| Flutter | Yes on iOS and Android. **Not on Flutter web** with RevenueCat's package | `await Purchases.setProxyURL('...')` | Disabled | [Flutter](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/flutter.md) |
| Web (purchases-js) | Yes, with Test Store (`test_`) keys only | `httpConfig: { proxyURL: "..." }` in `configure` | No signature checks | [Web](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/web.md) |
| Capacitor and Ionic | Yes | `await Purchases.setProxyURL({ url: "..." })` | No default passed, so the native informational default applies. Pass `DISABLED` | [Capacitor](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/capacitor.md) |
| Kotlin Multiplatform | Yes | `Purchases.proxyURL = "..."` (a `String`) | Disabled | [Kotlin Multiplatform](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/kotlin-multiplatform.md) |
| Unity | Yes | The **Proxy URL** field on the Purchases component | Informational. Set **Disabled** in the Inspector | [Unity](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/unity.md) |
| Cordova | Yes | `Purchases.setProxyURL("...")` before `configureWith` | No option: logs a failure, still grants access | [Cordova](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/cordova.md) |
**Never use `ENFORCED` mode with a RevenueCat SDK against RevenueDot.** Every call would fail, because RevenueDot cannot sign with RevenueCat's key. After the update ships, call `syncPurchases()` once on its first launch, so current subscribers keep access. Each SDK guide shows the call.
## The RevenueDot SDKs are RevenueCat's releases plus RevenueDot's patches
Each RevenueDot SDK lives in `github.com/revenuedot/<repo>`. Releases are upstream release tags plus RevenueDot's patch commits, tagged `<upstream version>-revenuedot`; the branch `revenuedot/main-patches` follows upstream `main`. The patches change only these things:
- The default API host becomes `https://api.revenuedot.app`, which is RevenueDot Cloud (live since 2026-09-30). Self-hosters still set the proxy URL.
- The SDK trusts RevenueDot's response-signing key instead of RevenueCat's.
- Registry names change (first table above). Module and package names that your code imports stay the same, so `import RevenueCat` and `com.revenuecat.purchases.*` work.
- Android: diagnostics, paywall events and ad events follow the proxy URL.
- purchases-js: analytics events follow `httpConfig.proxyURL`, and checkout reads "Secure checkout by RevenueDot".
- Flutter web: `Purchases.setProxyURL` works.
- Each README gets a banner saying the SDK is maintained by RevenueDot and not affiliated with RevenueCat.
Source: [`prd/sdk-forks/PRD.md`](https://github.com/revenuedot/revenuedot/blob/main/prd/sdk-forks/PRD.md).
## Three SDKs bought a Test Store subscription on the web, and the native builds carry RevenueDot's host and key
- **Purchases on the web (2026-10-02).** purchases-js from npm, Flutter web from its git tag and `@revenuedot/react-native-purchases` from npm, running on the web, each bought a Test Store subscription against a RevenueDot server, and the server shows `pro` active.
- **Native builds.** iOS apps built with the published pods and Swift packages (Flutter, Capacitor and Cordova) carry `api.revenuedot.app` and RevenueDot's signing key, and no RevenueCat host. The Android artifacts on Maven Central and the Kotlin Multiplatform iOS library do the same.
- **Not run yet.** The Unity package has not run in the Unity editor, and the React Native SDK's native iOS and Android builds are not verified.
- The unmodified RevenueCat iOS SDK 5.92 on an iPhone simulator and Android SDK 10.24 on an Android emulator pass configure, customer info, offerings, a Test Store purchase and `logIn` against RevenueDot ([`scripts/e2e`](https://github.com/revenuedot/revenuedot/tree/main/scripts/e2e)).
- A real App Store sandbox purchase ran end to end on a physical iPhone on 2026-10-02: Apple's purchase sheet, Apple's notification into RevenueDot, an `INITIAL_PURCHASE` webhook, access unlocked in the app. Google Play sandbox purchases have not run end to end yet; Play handling is tested against a copy of Google's API.
- The [React Native Expo example](https://github.com/revenuedot/examples/tree/main/mobile/react-native-expo) and the [purchases-js Vite example](https://github.com/revenuedot/examples/tree/main/web/purchases-js-vite) run against RevenueDot with a Test Store key.
## Related
- [Connect your app](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
- [SDK changes when you migrate](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/sdk-changes.md)
- [SDK endpoints](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md)
---
# How do I add in-app purchases to an iOS app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md
Description: Add the RevenueDot SDK with Swift Package Manager or CocoaPods, then call Purchases.configure with your app's key. On RevenueDot Cloud nothing else is needed. The same SDK covers iPadOS, macOS, tvOS, watchOS and visionOS.
Add the RevenueDot SDK to your app with Swift Package Manager or CocoaPods, then call `Purchases.configure(withAPIKey:)` with your app's key from RevenueDot. On RevenueDot Cloud nothing else is needed. The same SDK covers iOS, iPadOS, macOS, tvOS, watchOS and visionOS apps.
## Install the RevenueDot SDK and pass your key
**Version 5.91.0 is published** on CocoaPods trunk and as a Swift package tag. The source is [github.com/revenuedot/purchases-ios](https://github.com/revenuedot/purchases-ios).
```swift
// Package.swift (or Xcode > File > Add Package Dependencies, exact version 5.91.0-revenuedot)
.package(url: "https://github.com/revenuedot/purchases-ios", exact: "5.91.0-revenuedot")
// Products: "RevenueCat", and "RevenueCatUI" for paywalls
```
```ruby
# Podfile
pod 'RevenueDotPurchases', '5.91.0'
pod 'RevenueDotPurchasesUI', '5.91.0' # only for paywalls (module RevenueCatUI)
```
Release tags are `<upstream version>-revenuedot`, because the repository also carries RevenueCat's own tags.
```swift
import RevenueCat
// Once, at launch: in your App's init() or in application(_:didFinishLaunchingWithOptions:).
Purchases.configure(withAPIKey: "appl_...")
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `RevenueCat` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- Use the app's public key from RevenueDot: `appl_...`, `mac_...` for a Mac App Store app, or `test_...` for the Test Store. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set. It trusts RevenueDot Cloud's response-signing key, so entitlement verification reports `VERIFIED`.
**Self-hosting:** set `Purchases.proxyURL` to your server **before** `configure`, and set entitlement verification to `.disabled`. Your server signs with its own key (`REVENUEDOT_SIGNING_KEY`), which this build does not trust.
```swift
import RevenueCat
Purchases.proxyURL = URL(string: "https://revenuedot.example.com")!
Purchases.configure(
with: Configuration.Builder(withAPIKey: "appl_...")
// A self-hosted server signs with its own key. The default, .informational, would log every response as a failed check, so set .disabled unless you build the SDK with your key.
.with(entitlementVerificationMode: .disabled)
.build()
)
```
- `proxyURL` is a static property on `Purchases`.
- For local testing, the simulator reaches your Mac at `http://localhost:8787`.
- To get `VERIFIED` against your own server, build the SDK with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```swift
let customerInfo = try await Purchases.shared.customerInfo()
let isPro = customerInfo.entitlements["pro"]?.isActive == true
let offerings = try await Purchases.shared.offerings()
if let package = offerings.current?.availablePackages.first {
let result = try await Purchases.shared.purchase(package: package)
if !result.userCancelled, result.customerInfo.entitlements["pro"]?.isActive == true {
// Unlock pro features.
}
}
```
The purchase goes to `POST /v1/receipts`. RevenueDot verifies it with Apple, which needs the App Store in-app purchase key on the app. See [Connect the App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md).
## Web purchases: redemption links and web checkout
Customers who buy on the web through a RevenueDot [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) or [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md) unlock the app with a redemption link, `<scheme>://redeem_web_purchase?redemption_token=…`. Register the scheme in `Info.plist` (`CFBundleURLTypes`), then pass the URL to the SDK:
```swift
.onOpenURL { url in
guard let redemption = url.asWebPurchaseRedemption else { return }
Task {
switch await Purchases.shared.redeemWebPurchase(redemption) {
case .success: break // The entitlement is active.
case .expired(let email): print("Expired. A new link went to \(email).")
case .invalidToken, .purchaseBelongsToOtherUser, .error: print("Could not redeem.")
}
}
}
```
A paywall's **web checkout** button (module `RevenueCatUI`) also works: it opens a Stripe Checkout on your Stripe account for the app's current user, and the purchase lands on that user with no redemption link. Full setup: [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md) and [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md).
## Test Store
Create a `test_store` app in RevenueDot and pass its `test_...` key to `configure`. The SDK then shows a Test Store alert instead of the App Store sheet.
- **Test Store keys only work in Debug builds.** In a Release build the SDK shows a "Wrong API Key" alert and stops the app on purpose.
- **Known issue on older servers:** the native iOS SDK could not load Test Store products from RevenueDot and reported "No base price found for product". The server sent `cycle_count: null` in `GET /rcbilling/v1/subscribers/{id}/products`. The server's `main` branch fixed this on 2026-09-30. If you see the error, update your server. See [Known issues](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/known-issues.md).
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
- To test with Apple's sandbox or Xcode's StoreKit testing instead, see [Sandbox testing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md).
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's iOS SDK 5.x can keep it. Set `Purchases.proxyURL` to RevenueDot before you call `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud, or your own server), and set the entitlement verification mode to `.disabled`. The rest of your code stays the same.
```swift
import RevenueCat
// Point the SDK at your RevenueDot server; nothing else in the app changes.
Purchases.proxyURL = URL(string: "https://revenuedot.example.com")!
Purchases.configure(
with: Configuration.Builder(withAPIKey: "appl_...")
// The default (.informational) logs every RevenueDot response as a failed signature check.
.with(entitlementVerificationMode: .disabled)
.build()
)
```
- Set `proxyURL` **before** `configure`. It is a static property on `Purchases`.
- Use the app's public key from RevenueDot. If you ran the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md), your existing RevenueCat key keeps working.
- **Turn entitlement verification off.** RevenueCat's SDK checks signatures with RevenueCat's key, so RevenueDot responses read as failed. The default mode, `.informational`, logs the failure and still grants access. Set `.disabled` to stop the noise. **Never use `.enforced` with RevenueCat's SDK**: every request would fail. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Or install the RevenueDot SDK in the same release.** It keeps the `RevenueCat` and `RevenueCatUI` modules, so the swap is a dependency change. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#install-the-revenuedot-sdk-and-pass-your-key).
**Call `syncPurchases()` once** on the first launch of the update. It sends the device's existing App Store purchases to RevenueDot, so current subscribers keep access even if their history was not imported.
```swift
// Once, after this update: send purchases made while the app talked to RevenueCat.
if !UserDefaults.standard.bool(forKey: "revenuedotSynced") {
_ = try? await Purchases.shared.syncPurchases()
UserDefaults.standard.set(true, forKey: "revenuedotSynced")
}
```
The whole app change fits in one diff:
```diff
import RevenueCat
+// Point the SDK at your RevenueDot server; nothing else in the app changes. Set it before configure.
+Purchases.proxyURL = URL(string: "https://revenuedot.example.com")!
-Purchases.configure(withAPIKey: "appl_...")
+Purchases.configure(
+ with: Configuration.Builder(withAPIKey: "appl_...")
+ // The default (informational) logs every RevenueDot response as failed signature verification.
+ .with(entitlementVerificationMode: .disabled)
+ .build()
+)
+// Once, after this update: send purchases made while the app talked to RevenueCat.
+_ = try? await Purchases.shared.syncPurchases()
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
- [mobile/ios-swiftui](https://github.com/revenuedot/examples/tree/main/mobile/ios-swiftui): a SwiftUI paywall app. It builds for the iOS simulator; its README says exactly what was run.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Connect the App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
- [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md)
- [Restore purchases](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/restore-purchases.md)
- [Receipt errors: 4xx vs 5xx](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/receipt-errors-4xx-vs-5xx.md)
---
# How do I add in-app purchases to an Android app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md
Description: Add app.revenuedot.purchases:purchases from Maven Central and call Purchases.configure with your app's key in Application.onCreate(). On RevenueDot Cloud nothing else is needed, and diagnostics and events go to RevenueDot too.
Add the RevenueDot SDK, `app.revenuedot.purchases:purchases`, from Maven Central, then call `Purchases.configure` in `Application.onCreate()` with your app's key from RevenueDot. On RevenueDot Cloud nothing else is needed. Purchases, customer info, offerings, diagnostics, paywall events and ad events all go to RevenueDot.
## Install the RevenueDot SDK and pass your key
**It is on Maven Central** under the group `app.revenuedot.purchases`, with upstream's artifact ids and version numbers (10.23.3 is the newest; 10.23.0 and 10.22.1 are there for the wrappers that pin them). The source is [github.com/revenuedot/purchases-android](https://github.com/revenuedot/purchases-android).
```kotlin
// build.gradle.kts
implementation("app.revenuedot.purchases:purchases:10.23.3")
implementation("app.revenuedot.purchases:purchases-ui:10.23.3") // only for paywalls
```
```kotlin
import com.revenuecat.purchases.Purchases
import com.revenuecat.purchases.PurchasesConfiguration
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
Purchases.configure(PurchasesConfiguration.Builder(this, "goog_...").build())
}
}
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `com.revenuecat.purchases.*` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- Use the app's `goog_...` key from RevenueDot, or `test_...` for the Test Store. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set. It trusts RevenueDot Cloud's response-signing key.
**Self-hosting:** set `Purchases.proxyURL` to your server **before** `configure`, and set `EntitlementVerificationMode.DISABLED`. Your server signs with its own key, which this build does not trust. Diagnostics, paywall events and ad events follow the proxy URL to your server.
```kotlin
import com.revenuecat.purchases.EntitlementVerificationMode
import java.net.URL
Purchases.proxyURL = URL("https://revenuedot.example.com")
Purchases.configure(
PurchasesConfiguration.Builder(this, "goog_...")
// A self-hosted server signs with its own key. The default, INFORMATIONAL, would log every response as a failed check, so set DISABLED unless you build the SDK with your key.
.entitlementVerificationMode(EntitlementVerificationMode.DISABLED)
.build()
)
```
- The Android emulator reaches your computer at `http://10.0.2.2:8787`. Plain `http` also needs a network security config that allows cleartext traffic to that host.
- To get verified responses from your own server, build the SDK with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows. These are the coroutine helpers.
```kotlin
val customerInfo = Purchases.sharedInstance.awaitCustomerInfo()
val isPro = customerInfo.entitlements["pro"]?.isActive == true
val offerings = Purchases.sharedInstance.awaitOfferings()
val pkg = offerings.current?.availablePackages?.firstOrNull() ?: return
try {
val result = Purchases.sharedInstance.awaitPurchase(PurchaseParams.Builder(activity, pkg).build())
val nowPro = result.customerInfo.entitlements["pro"]?.isActive == true
} catch (e: PurchasesTransactionException) {
if (e.userCancelled) return
}
```
The purchase goes to `POST /v1/receipts` with the Google Play purchase token. RevenueDot verifies it with Google, which needs the app's service account. See [Connect Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md).
## Web purchases: redemption links
Customers who buy on the web through a RevenueDot [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) or [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md) unlock the app with a redemption link, `<scheme>://redeem_web_purchase?redemption_token=…`. Add an intent filter for the scheme to your activity, then pass the intent to the SDK:
```kotlin
val redemption = intent.asWebPurchaseRedemption() ?: return
Purchases.sharedInstance.redeemWebPurchase(redemption) { result ->
when (result) {
is RedeemWebPurchaseListener.Result.Success -> Unit // The entitlement is active.
is RedeemWebPurchaseListener.Result.Expired -> showMessage("Expired. A new link went to ${result.obfuscatedEmail}.")
else -> showMessage("Could not redeem.")
}
}
```
Call it from `onCreate` and `onNewIntent`. Full setup: [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md) and [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md).
## Test Store
Create a `test_store` app in RevenueDot and pass its `test_...` key to `configure`. The SDK shows a Test Store dialog instead of Google Play's purchase sheet.
- **Test Store keys only work in debug builds.** In a release build the SDK shows an error screen and stops the app on purpose. Ship with the `goog_` key.
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
- For Google Play test tracks and license testers, see [Sandbox testing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md).
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's Android SDK can keep it. Set `Purchases.proxyURL` to RevenueDot before `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud, or your own server), and set `EntitlementVerificationMode.DISABLED`. Purchases, customer info and offerings then go to RevenueDot. **RevenueCat's Android SDK still sends diagnostics, paywall events and ad events to RevenueCat's hosts**, even with a proxy URL; the RevenueDot SDK sends them to RevenueDot.
```kotlin
import com.revenuecat.purchases.EntitlementVerificationMode
import com.revenuecat.purchases.Purchases
import com.revenuecat.purchases.PurchasesConfiguration
import java.net.URL
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
// Point the SDK at your RevenueDot server; nothing else in the app changes.
Purchases.proxyURL = URL("https://revenuedot.example.com")
Purchases.configure(
PurchasesConfiguration.Builder(this, "goog_...")
// The default (INFORMATIONAL) logs every RevenueDot response as a failed signature check.
.entitlementVerificationMode(EntitlementVerificationMode.DISABLED)
.build()
)
}
}
```
- Set `proxyURL` **before** `configure`.
- Use the app's `goog_...` key from RevenueDot, or your old RevenueCat key if the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) kept it.
- **Turn entitlement verification off.** RevenueCat's SDK checks signatures with RevenueCat's key, so RevenueDot responses read as failed. The default, `INFORMATIONAL`, logs the failure and still grants access. Set `DISABLED`. **Never use `ENFORCED` with RevenueCat's SDK**: every request would fail. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Or install the RevenueDot SDK in the same release.** Kotlin packages stay `com.revenuecat.purchases.*`, so imports do not change. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md#install-the-revenuedot-sdk-and-pass-your-key).
**Call `syncPurchases()` once** on the first launch of the update. It sends the device's Google Play purchases, with their purchase tokens, to RevenueDot. That is also how RevenueDot gets any purchase token the importer could not find.
```kotlin
// Once, after this update: send purchases made while the app talked to RevenueCat.
Purchases.sharedInstance.syncPurchases()
```
The whole app change fits in one diff:
```diff
override fun onCreate() {
super.onCreate()
+ // Point the SDK at your RevenueDot server; nothing else in the app changes. Must be set before configure.
+ Purchases.proxyURL = URL("https://revenuedot.example.com")
Purchases.configure(
PurchasesConfiguration.Builder(this, "goog_...")
+ // The default (INFORMATIONAL) logs every RevenueDot response as failed signature verification.
+ .entitlementVerificationMode(EntitlementVerificationMode.DISABLED)
.build()
)
+ // Once, after this update: send purchases made while the app talked to RevenueCat.
+ Purchases.sharedInstance.syncPurchases()
}
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
- [mobile/android-compose](https://github.com/revenuedot/examples/tree/main/mobile/android-compose): a Jetpack Compose paywall app. It is written but has not been compiled yet.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Connect Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
- [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md)
- [What differs from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/what-differs.md)
---
# How do I add in-app purchases to a React Native or Expo app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/react-native.md
Description: Install the RevenueDot SDK with an npm alias, so your code imports react-native-purchases, then call Purchases.configure with your app's key. On RevenueDot Cloud nothing else is needed. Expo Go and web buy with a Test Store key.
Install the RevenueDot SDK for React Native with an npm alias, so your code imports `Purchases` from `"react-native-purchases"`, then call `Purchases.configure` with your app's key from RevenueDot. On RevenueDot Cloud nothing else is needed. It runs in iOS and Android builds. In Expo Go and on the web it runs in browser mode, which buys with a Test Store (`test_`) key.
## Install the RevenueDot SDK and pass your key
**Version 10.10.2 is on npm** as `@revenuedot/react-native-purchases`. The npm alias installs it under the name `react-native-purchases`, so every `import ... from "react-native-purchases"` works. Run the same command in an Expo app.
```bash
npm install react-native-purchases@npm:@revenuedot/react-native-purchases@10.10.2
# Only for paywalls:
npm install react-native-purchases-ui@npm:@revenuedot/react-native-purchases-ui@10.10.2
```
Your `package.json` then reads:
```json
{
"dependencies": {
"react-native-purchases": "npm:@revenuedot/react-native-purchases@10.10.2",
"react-native-purchases-ui": "npm:@revenuedot/react-native-purchases-ui@10.10.2"
}
}
```
```ts
import { Platform } from "react-native";
import Purchases from "react-native-purchases";
Purchases.configure({
apiKey: Platform.OS === "ios" ? "appl_..." : "goog_...",
});
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `react-native-purchases` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- Use each app's public key from RevenueDot, or the `test_...` key for the Test Store. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set.
- **Entitlement verification is off by default** (`ENTITLEMENT_VERIFICATION_MODE.DISABLED`). In Expo Go and on the web, the SDK runs in browser mode and does not check signatures.
- The source is [github.com/revenuedot/react-native-purchases](https://github.com/revenuedot/react-native-purchases). It depends on RevenueDot's [hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md) 19.4.1, which is published (CocoaPods `RevenueDotPurchasesHybridCommon`, Maven `app.revenuedot.purchases:purchases-hybrid-common`, npm `@revenuedot/purchases-typescript-internal`).
Installed from npm into the [Expo example](https://github.com/revenuedot/examples/tree/main/mobile/react-native-expo) and run on the web against a RevenueDot server, it passes configure, customer info, offerings, a Test Store purchase and the `pro` entitlement turning active, with every request going to the server.
**Self-hosting:** await `Purchases.setProxyURL` with your server's address before `configure`. Leave the verification mode at its default, `DISABLED`, because your server signs with its own key, which this build does not trust.
```ts
import { Platform } from "react-native";
import Purchases from "react-native-purchases";
// setProxyURL returns a promise. Await it before configure.
await Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configure({ apiKey: Platform.OS === "ios" ? "appl_..." : "goog_..." });
```
To verify responses from your own server, build the SDKs with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```ts
const customerInfo = await Purchases.getCustomerInfo();
const isPro = customerInfo.entitlements.active["pro"] !== undefined;
const offerings = await Purchases.getOfferings();
const pkg = offerings.current?.availablePackages[0];
if (pkg) {
try {
const { customerInfo: after } = await Purchases.purchasePackage(pkg);
const nowPro = after.entitlements.active["pro"] !== undefined;
} catch (e: any) {
if (!e.userCancelled) throw e;
}
}
```
## Test Store
Create a `test_store` app in RevenueDot and use its `test_...` key.
- **Expo Go and web:** `react-native-purchases` runs in browser mode there and only accepts `test_` and `rcb_` keys. RevenueDot accepts only `test_` of those two today. Tap a package, then **Test valid purchase** in the dialog.
- **Native iOS builds:** see the iOS Test Store note in [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#test-store). Servers older than the 2026-09-30 fix could not serve Test Store products to the native iOS SDK.
- **Native builds** accept `test_` keys only in debug builds. Ship with the `appl_` and `goog_` keys.
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's `react-native-purchases` can keep it. Call `await Purchases.setProxyURL("https://revenuedot.example.com")` before `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud). That is the whole change: `react-native-purchases` already defaults to `ENTITLEMENT_VERIFICATION_MODE.DISABLED`. It works on iOS and Android builds, and in Expo Go and on the web with a Test Store (`test_`) key.
```ts
import { Platform } from "react-native";
import Purchases from "react-native-purchases";
// Point the SDK at your RevenueDot server; nothing else in the app changes.
await Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configure({
apiKey: Platform.OS === "ios" ? "appl_..." : "goog_...",
// Leave entitlementVerificationMode unset: DISABLED is the React Native default.
});
```
- `setProxyURL` returns a promise. Await it before `configure`.
- Use each app's public key from RevenueDot, or your old RevenueCat keys if the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) kept them.
- **Keep entitlement verification off.** RevenueCat's SDK checks signatures with RevenueCat's key. `DISABLED`, the default, is what you want against RevenueDot. `INFORMATIONAL` logs every response as a failed signature check, and **`ENFORCED` would fail every request**. If your code sets either one, remove it. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Or install the RevenueDot SDK in the same release.** The npm alias keeps every import. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/react-native.md#install-the-revenuedot-sdk-and-pass-your-key).
**Sync once** on the first launch of the update. It sends the device's store purchases to RevenueDot, so current subscribers keep access.
```ts
// Once, after this update: send purchases made while the app talked to RevenueCat.
await Purchases.syncPurchasesForResult();
```
`Purchases.syncPurchases()` does the same and returns nothing.
The whole app change fits in one diff:
```diff
import { Platform } from "react-native";
import Purchases from "react-native-purchases";
+// Point the SDK at your RevenueDot server; nothing else in the app changes. Await it before configure.
+await Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configure({
apiKey: Platform.OS === "ios" ? "appl_..." : "goog_...",
- entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL,
+ // DISABLED is the React Native default; RevenueDot does not sign responses with RevenueCat's key.
});
+// Once, after this update: send purchases made while the app talked to RevenueCat.
+await Purchases.syncPurchasesForResult();
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
- [mobile/react-native-expo](https://github.com/revenuedot/examples/tree/main/mobile/react-native-expo): an Expo app that loads offerings, buys through the Test Store and shows the entitlement. It was run on the web against RevenueDot; native builds are not verified yet.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
---
# How do I add in-app purchases to a Flutter app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/flutter.md
Description: Add the RevenueDot SDK to pubspec.yaml as a git dependency, then call Purchases.configure with your app's key. On RevenueDot Cloud nothing else is needed. It works on iOS, Android and Flutter web.
Add the RevenueDot SDK for Flutter to `pubspec.yaml` as a git dependency, then call `Purchases.configure` with your app's key from RevenueDot. On RevenueDot Cloud nothing else is needed. It works on iOS, Android and Flutter web. It is a git dependency because the pub.dev names belong to RevenueCat.
## Install the RevenueDot SDK and pass your key
The source is [github.com/revenuedot/purchases-flutter](https://github.com/revenuedot/purchases-flutter). Release tags are `<version>-revenuedot`.
```yaml
# pubspec.yaml
dependencies:
purchases_flutter:
git:
url: https://github.com/revenuedot/purchases-flutter.git
ref: 10.13.2-revenuedot
purchases_ui_flutter: # only if you use paywalls
git:
url: https://github.com/revenuedot/purchases-flutter.git
path: purchases_ui_flutter
ref: 10.13.2-revenuedot
```
```dart
import 'package:flutter/foundation.dart';
import 'package:purchases_flutter/purchases_flutter.dart';
// kIsWeb and defaultTargetPlatform work on every platform. Platform from dart:io throws on Flutter web.
final apiKey = kIsWeb
? 'test_...' // purchases-js buys only with Test Store keys today
: defaultTargetPlatform == TargetPlatform.iOS
? 'appl_...'
: 'goog_...';
Future<void> initPurchases() async {
await Purchases.configure(PurchasesConfiguration(apiKey));
}
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `package:purchases_flutter/purchases_flutter.dart` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- Use each app's public key from RevenueDot, or the `test_...` key for the Test Store. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set.
- **Entitlement verification is off by default** (`EntitlementVerificationMode.disabled`).
- Its native side comes from RevenueDot's [hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md) 19.4.1: the `RevenueDotPurchasesHybridCommon` pod (or its Swift package) on iOS and `app.revenuedot.purchases:purchases-hybrid-common` on Android. Its web bundle is built from RevenueDot's purchases-js 1.67.0.
Checked with the [Flutter example](https://github.com/revenuedot/examples/tree/main/mobile/flutter) on this tag: a Flutter web build bought the monthly package through the Test Store against a RevenueDot server and the server shows `pro` active, and iOS simulator builds succeed with both CocoaPods and Swift Package Manager.
**Self-hosting:** await `Purchases.setProxyURL` with your server's address before `configure`. It works on iOS, Android and Flutter web. Leave the verification mode at its default, `disabled`, because your server signs with its own key, which this build does not trust.
```dart
// apiKey as above: kIsWeb and defaultTargetPlatform pick the key on every platform.
await Purchases.setProxyURL('https://revenuedot.example.com');
await Purchases.configure(PurchasesConfiguration(apiKey));
```
To verify responses from your own server, build the SDKs with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```dart
import 'package:flutter/services.dart' show PlatformException;
final customerInfo = await Purchases.getCustomerInfo();
final isPro = customerInfo.entitlements.active.containsKey('pro');
final offerings = await Purchases.getOfferings();
final package = offerings.current?.availablePackages.first;
if (package != null) {
try {
final result = await Purchases.purchase(PurchaseParams.package(package));
final nowPro = result.customerInfo.entitlements.active.containsKey('pro');
} on PlatformException catch (e) {
if (PurchasesErrorHelper.getErrorCode(e) != PurchasesErrorCode.purchaseCancelledError) rethrow;
}
}
```
`Purchases.purchasePackage` still works but is deprecated in 10.x.
## Test Store
Create a `test_store` app in RevenueDot and use its `test_...` key. The Test Store dialog replaces the store sheet; tap **Test valid purchase**.
- **Native builds** accept `test_` keys only in debug builds. Ship with the `appl_` and `goog_` keys.
- **iOS:** servers older than the 2026-09-30 fix could not serve Test Store products to the native iOS SDK. See [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#test-store).
- **Flutter web** needs the RevenueDot SDK, because RevenueCat's web plugin ignores the proxy URL.
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's `purchases_flutter` from pub.dev can keep it on iOS and Android. Call `await Purchases.setProxyURL('https://revenuedot.example.com')` before `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud). Verification is already `disabled` by default in `purchases_flutter`, so there is nothing else to change. **Flutter web does not work with RevenueCat's package**: its web plugin ignores `setProxyURL`, so web calls still go to RevenueCat. The RevenueDot SDK fixes this.
```dart
import 'dart:io' show Platform;
import 'package:purchases_flutter/purchases_flutter.dart';
// iOS and Android only: RevenueCat's package ignores the proxy URL on Flutter web, so Platform from dart:io is fine here.
Future<void> initPurchases() async {
// Point the SDK at your RevenueDot server; nothing else in the app changes.
await Purchases.setProxyURL('https://revenuedot.example.com');
await Purchases.configure(
PurchasesConfiguration(Platform.isIOS ? 'appl_...' : 'goog_...'),
// entitlementVerificationMode stays at its default, EntitlementVerificationMode.disabled.
);
}
```
- Await `setProxyURL` before `configure`.
- Use each app's public key from RevenueDot, or your old RevenueCat keys if the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) kept them.
- **Keep entitlement verification off.** RevenueCat's package checks signatures with RevenueCat's key. `disabled`, the default, is right for RevenueDot. `informational` logs every response as a failed signature check, and **`enforced` would fail every request**. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Or install the RevenueDot SDK in the same release.** The package names stay `purchases_flutter` and `purchases_ui_flutter`, so every import keeps working. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/flutter.md#install-the-revenuedot-sdk-and-pass-your-key).
**Sync once** on the first launch of the update, so current subscribers keep access:
```dart
// Once, after this update: send purchases made while the app talked to RevenueCat.
await Purchases.syncPurchases();
```
The whole app change fits in one diff:
```diff
import 'package:purchases_flutter/purchases_flutter.dart';
Future<void> initPurchases() async {
+ // Point the SDK at your RevenueDot server; nothing else in the app changes. Await it before configure.
+ await Purchases.setProxyURL('https://revenuedot.example.com');
await Purchases.configure(PurchasesConfiguration(Platform.isIOS ? 'appl_...' : 'goog_...'));
+ // Once, after this update: send purchases made while the app talked to RevenueCat.
+ await Purchases.syncPurchases();
}
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
- [mobile/flutter](https://github.com/revenuedot/examples/tree/main/mobile/flutter): a Flutter paywall app. It is written but has not been analyzed or run on a device yet.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
- [What differs from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/what-differs.md)
---
# How do I add RevenueDot to a web app with purchases-js?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/web.md
Description: Install @revenuedot/purchases-js and call Purchases.configure with a Test Store key and your user's ID. It buys with Test Store (test_) keys; to take real payments on the web, send buyers to a RevenueDot purchase link or funnel on your Stripe account.
Install `@revenuedot/purchases-js`, the RevenueDot SDK for the web, and call `Purchases.configure` with a Test Store (`test_`) key and your user's ID. On RevenueDot Cloud nothing else is needed. **purchases-js buys only with Test Store keys today.** To take real payments on the web, send buyers to a RevenueDot [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) or [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md), which run Stripe Checkout on your own Stripe account ([web billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)). Purchases from your own Stripe checkout are posted by your backend with the Stripe app's `strp_` key ([Stripe guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md)).
## Install the RevenueDot SDK and pass your key
**Version 1.67.0 is on npm** as `@revenuedot/purchases-js`. The source is [github.com/revenuedot/purchases-js](https://github.com/revenuedot/purchases-js).
```bash
npm install @revenuedot/purchases-js@1.67.0
```
```ts
import { Purchases } from "@revenuedot/purchases-js";
const purchases = Purchases.configure({
apiKey: "test_...",
appUserId: "user_123",
});
```
- The RevenueDot SDK for the web is built from RevenueCat's open-source purchases-js (MIT license), so your code calls `Purchases` the same way. It sends every request, including analytics events, to RevenueDot and needs no RevenueCat account. Its checkout reads "Secure checkout by RevenueDot".
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set.
- purchases-js needs an `appUserId`. Pass your signed-in user's id, or one from `Purchases.generateRevenueCatAnonymousAppUserId()`. See [Anonymous app user IDs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md#anonymous-app-user-ids).
- purchases-js does not check response signatures, so there is no verification setting. The server still signs `/v1` and `/rcbilling` responses when `REVENUEDOT_SIGNING_KEY` is set, for the native SDKs. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
**Self-hosting:** pass your server's address as `httpConfig.proxyURL`. Your RevenueDot server allows browser calls to `/v1` and `/rcbilling` from any origin.
```ts
const purchases = Purchases.configure({
apiKey: "test_...",
appUserId: "user_123",
// Your server's address. No trailing slash: the SDK rejects a proxy URL that ends with "/".
httpConfig: { proxyURL: "https://revenuedot.example.com" },
});
```
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```ts
const customerInfo = await purchases.getCustomerInfo();
const isPro = "pro" in customerInfo.entitlements.active;
const offerings = await purchases.getOfferings();
const rcPackage = offerings.current?.availablePackages[0];
if (rcPackage) {
const { customerInfo: after } = await purchases.purchase({ rcPackage });
const nowPro = "pro" in after.entitlements.active;
}
```
With a `test_` key, `purchase` opens the Test Store modal instead of a payment form.
## Which web purchases work
- **Test Store** inside purchases-js: create a `test_store` app in RevenueDot and use its `test_...` key. See [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
- Test Store purchases are always sandbox purchases.
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
- **Real payments** go through RevenueDot's hosted checkout on your Stripe account, not through purchases-js. Link to a purchase link with `?app_user_id=` set to the same app user id you pass to `Purchases.configure`; after payment, `getCustomerInfo()` shows the entitlement, because entitlements belong to the customer, not to one app. See [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md).
- RevenueCat Billing (`rcb_`) and Paddle (`pdl_`) apps can be created, but RevenueDot does not accept their purchases: it answers their receipts with error 7662, and purchases-js's own Web Billing checkout answers an error. See [What differs from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/what-differs.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's `@revenuecat/purchases-js` can keep it. Pass `httpConfig: { proxyURL: "https://revenuedot.example.com" }` to `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud), and set `flags: { collectAnalyticsEvents: false }` so RevenueCat's SDK does not send analytics events to RevenueCat.
```ts
import { Purchases } from "@revenuecat/purchases-js";
const purchases = Purchases.configure({
apiKey: "test_...",
appUserId: "user_123",
// Point the SDK at your RevenueDot server; nothing else in the app changes. No trailing slash.
httpConfig: { proxyURL: "https://revenuedot.example.com" },
// RevenueCat's SDK sends analytics events to RevenueCat even with a proxy URL; turn them off.
flags: { collectAnalyticsEvents: false },
});
```
- There is no store history to sync on the web, so no `syncPurchases` step is needed after a migration.
- **Or install the RevenueDot SDK under the same name.** An npm alias keeps every `@revenuecat/purchases-js` import, and you can leave `collectAnalyticsEvents` on:
```json
{
"dependencies": {
"@revenuecat/purchases-js": "npm:@revenuedot/purchases-js@1.67.0"
}
}
```
The [purchases-js Vite example](https://github.com/revenuedot/examples/tree/main/web/purchases-js-vite), installed with this alias from npm, passes its four Playwright tests against a RevenueDot server: a Test Store purchase that unlocks `pro` on the server, sign-in keeping `pro`, a canceled purchase, and the preview plans.
The whole app change fits in one diff:
```diff
const purchases = Purchases.configure({
apiKey: "test_...",
appUserId,
+ // Point the SDK at your RevenueDot server; nothing else in the app changes. No trailing slash.
+ httpConfig: { proxyURL: "https://revenuedot.example.com" },
+ // Analytics events do not use the proxy URL; turn them off to keep all traffic on your server.
+ flags: { collectAnalyticsEvents: false },
});
```
If you sell through RevenueCat Web Billing today, keep those subscriptions on RevenueCat: the importer copies their current access, but renewals stay with RevenueCat. New web sales can start on RevenueDot's [hosted checkout](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md). See [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
- [web/purchases-js-vite](https://github.com/revenuedot/examples/tree/main/web/purchases-js-vite): a Vite page that configures purchases-js with a proxy URL, buys through the Test Store and shows the entitlement.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)
- [Customers and app user IDs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md)
- [What differs from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/what-differs.md)
---
# How do I add in-app purchases to a Capacitor or Ionic app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/capacitor.md
Description: Install the RevenueDot SDK for Capacitor through its npm alias, run npx cap sync, then call Purchases.configure with your app's key. On RevenueDot Cloud nothing else is needed.
Install the RevenueDot SDK for Capacitor through its npm alias, run `npx cap sync`, then call `Purchases.configure` with your app's key from RevenueDot. On RevenueDot Cloud nothing else is needed. The SDK works in Capacitor's iOS and Android apps; it has no web implementation.
## Install the RevenueDot SDK and pass your key
**Version 13.6.1 is on npm** as `@revenuedot/purchases-capacitor`. Install it **only through the alias** below. Capacitor derives the native pod and Swift package names from the npm package name, so the alias keeps them as `RevenuecatPurchasesCapacitor`.
```bash
npm install @revenuecat/purchases-capacitor@npm:@revenuedot/purchases-capacitor@13.6.1
# Only for paywalls:
npm install @revenuecat/purchases-capacitor-ui@npm:@revenuedot/purchases-capacitor-ui@13.6.1
npx cap sync
```
Your `package.json` then reads:
```json
{
"dependencies": {
"@revenuecat/purchases-capacitor": "npm:@revenuedot/purchases-capacitor@13.6.1",
"@revenuecat/purchases-capacitor-ui": "npm:@revenuedot/purchases-capacitor-ui@13.6.1"
}
}
```
```ts
import { Capacitor } from "@capacitor/core";
import { Purchases } from "@revenuecat/purchases-capacitor";
await Purchases.configure({
apiKey: Capacitor.getPlatform() === "ios" ? "appl_..." : "goog_...",
});
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `@revenuecat/purchases-capacitor` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- Use each app's public key from RevenueDot, or the `test_...` key for the Test Store. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set. It trusts RevenueDot Cloud's response-signing key.
- The source is [github.com/revenuedot/purchases-capacitor](https://github.com/revenuedot/purchases-capacitor). It depends on RevenueDot's [hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md) 19.4.1, which is published. Installed from npm, it builds into a Capacitor 8 iOS app: Swift Package Manager resolves `revenuedot/purchases-hybrid-common` 19.4.1 and `revenuedot/purchases-ios` 5.91.0, and the app binary carries `api.revenuedot.app` and RevenueDot's signing key.
**Self-hosting:** await `Purchases.setProxyURL({ url })` with your server's address before `configure`, and pass `entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED`. Your server signs with its own key, which this build does not trust. The Capacitor plugin passes no verification mode of its own, so without this line the native default (informational) logs every response from your server as a failed check.
```ts
import { Capacitor } from "@capacitor/core";
import { ENTITLEMENT_VERIFICATION_MODE, Purchases } from "@revenuecat/purchases-capacitor";
// setProxyURL takes an object { url }, not a string. Await it before configure.
await Purchases.setProxyURL({ url: "https://revenuedot.example.com" });
await Purchases.configure({
apiKey: Capacitor.getPlatform() === "ios" ? "appl_..." : "goog_...",
entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED,
});
```
To verify responses from your own server, build the SDKs with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```ts
const { customerInfo } = await Purchases.getCustomerInfo();
const isPro = customerInfo.entitlements.active["pro"] !== undefined;
const offerings = await Purchases.getOfferings();
const aPackage = offerings.current?.availablePackages[0];
if (aPackage) {
const result = await Purchases.purchasePackage({ aPackage });
const nowPro = result.customerInfo.entitlements.active["pro"] !== undefined;
}
```
`getCustomerInfo` resolves to `{ customerInfo }`, and `purchasePackage` takes `{ aPackage }`.
## Test Store
Create a `test_store` app in RevenueDot and use its `test_...` key on a debug build. The Test Store dialog replaces the store sheet.
- Native builds accept `test_` keys only in debug builds. Ship with the `appl_` and `goog_` keys.
- iOS: servers older than the 2026-09-30 fix could not serve Test Store products to the native iOS SDK. See [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#test-store).
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's `@revenuecat/purchases-capacitor` can keep it. Call `await Purchases.setProxyURL({ url: "https://revenuedot.example.com" })` before `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud), and pass `entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED`.
```ts
import { Capacitor } from "@capacitor/core";
import { ENTITLEMENT_VERIFICATION_MODE, Purchases } from "@revenuecat/purchases-capacitor";
// Point the SDK at your RevenueDot server; nothing else in the app changes.
await Purchases.setProxyURL({ url: "https://revenuedot.example.com" });
await Purchases.configure({
apiKey: Capacitor.getPlatform() === "ios" ? "appl_..." : "goog_...",
// Capacitor passes no default, so the native default (informational signature checks) would apply.
entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED,
});
```
- `setProxyURL` takes an object `{ url }`, not a string. Await it before `configure`.
- Use each app's public key from RevenueDot, or your old RevenueCat keys if the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) kept them.
- **Turn entitlement verification off.** RevenueCat's plugin checks signatures with RevenueCat's key. The native default, `INFORMATIONAL`, logs every RevenueDot response as a failed check but still grants access. **`ENFORCED` would fail every request.** See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Or install the RevenueDot SDK in the same release.** The npm alias keeps every import and the native names. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/capacitor.md#install-the-revenuedot-sdk-and-pass-your-key).
**Sync once** on the first launch of the update, so current subscribers keep access:
```ts
// Once, after this update: send purchases made while the app talked to RevenueCat.
await Purchases.syncPurchases();
```
The whole app change fits in one diff:
```diff
-import { Purchases } from "@revenuecat/purchases-capacitor";
+import { ENTITLEMENT_VERIFICATION_MODE, Purchases } from "@revenuecat/purchases-capacitor";
+// Point the SDK at your RevenueDot server; nothing else in the app changes. Await it before configure.
+await Purchases.setProxyURL({ url: "https://revenuedot.example.com" });
await Purchases.configure({
apiKey: isIOS ? "appl_..." : "goog_...",
+ // Capacitor passes no default, so the native default (informational signature checks) would apply.
+ entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED,
});
+// Once, after this update: send purchases made while the app talked to RevenueCat.
+await Purchases.syncPurchases();
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
There is no Capacitor example yet. The [React Native Expo example](https://github.com/revenuedot/examples/tree/main/mobile/react-native-expo) shows the same calls in a JavaScript app.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
---
# How do I add in-app purchases to a Kotlin Multiplatform app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/kotlin-multiplatform.md
Description: Add app.revenuedot.purchases:purchases-kmp-core from Maven Central to commonMain, then call Purchases.configure with your app's key in common code. On RevenueDot Cloud nothing else is needed on Android or iOS.
Add the RevenueDot SDK, `app.revenuedot.purchases:purchases-kmp-core`, from Maven Central to `commonMain`, then call `Purchases.configure` with your app's key in common code. On RevenueDot Cloud nothing else is needed on Android or iOS.
## Install the RevenueDot SDK and pass your key
**Version 3.10.1 is on Maven Central.** The source is [github.com/revenuedot/purchases-kmp](https://github.com/revenuedot/purchases-kmp).
```kotlin
// build.gradle.kts, commonMain
implementation("app.revenuedot.purchases:purchases-kmp-core:3.10.1")
implementation("app.revenuedot.purchases:purchases-kmp-ui:3.10.1") // only if you use paywalls
```
```kotlin
import com.revenuecat.purchases.kmp.Purchases
import com.revenuecat.purchases.kmp.PurchasesConfiguration
fun initPurchases(apiKey: String) {
Purchases.configure(PurchasesConfiguration(apiKey))
}
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports `com.revenuecat.purchases.kmp.*` and calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- Pass the `appl_...` key on iOS and the `goog_...` key on Android, from RevenueDot. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set.
- **Entitlement verification is off by default** (`EntitlementVerificationMode.DISABLED`).
- Its Android side is RevenueDot's purchases-android 10.22.1 from Maven Central, and its iOS side compiles RevenueDot's purchases-ios 5.90.2. Its iOS library on Maven Central embeds `api.revenuedot.app` and RevenueDot's signing key, with no RevenueCat host.
**Self-hosting:** set `Purchases.proxyURL` to your server before `configure`. In `purchases-kmp` the proxy URL is a `String`, not a `URL`, and it applies to both the Android and the iOS targets. Keep the verification mode at `DISABLED`, because your server signs with its own key, which this build does not trust.
```kotlin
import com.revenuecat.purchases.kmp.models.EntitlementVerificationMode
fun initPurchases(apiKey: String) {
Purchases.proxyURL = "https://revenuedot.example.com"
Purchases.configure(PurchasesConfiguration(apiKey) {
// DISABLED is the KMP default; keep it, because your server signs with its own key.
verificationMode = EntitlementVerificationMode.DISABLED
})
}
```
To verify responses from your own server, build the SDKs with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```kotlin
import com.revenuecat.purchases.kmp.ktx.awaitCustomerInfo
import com.revenuecat.purchases.kmp.ktx.awaitOfferings
import com.revenuecat.purchases.kmp.ktx.awaitPurchase
val customerInfo = Purchases.sharedInstance.awaitCustomerInfo()
val isPro = customerInfo.entitlements.active.containsKey("pro")
val offerings = Purchases.sharedInstance.awaitOfferings()
val pkg = offerings.current?.availablePackages?.firstOrNull() ?: return
val result = Purchases.sharedInstance.awaitPurchase(pkg)
val nowPro = result.customerInfo.entitlements.active.containsKey("pro")
```
`awaitPurchase` throws `PurchasesTransactionException` when the purchase fails or the user cancels; check its `userCancelled`.
## Test Store
Create a `test_store` app in RevenueDot and pass its `test_...` key on a debug build. The Test Store dialog replaces the store sheet.
- Native SDKs accept `test_` keys only in debug builds.
- iOS: servers older than the 2026-09-30 fix could not serve Test Store products to the native iOS SDK. See [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#test-store).
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's `purchases-kmp` can keep it. Set `Purchases.proxyURL = "https://revenuedot.example.com"` in common code before `Purchases.configure` (`https://api.revenuedot.app` on RevenueDot Cloud). The default verification mode is already `EntitlementVerificationMode.DISABLED`, so nothing else changes on Android or iOS.
```kotlin
import com.revenuecat.purchases.kmp.Purchases
import com.revenuecat.purchases.kmp.PurchasesConfiguration
import com.revenuecat.purchases.kmp.models.EntitlementVerificationMode
fun initPurchases(apiKey: String) {
// Point the SDK at your RevenueDot server; nothing else in the app changes.
Purchases.proxyURL = "https://revenuedot.example.com"
Purchases.configure(PurchasesConfiguration(apiKey) {
// DISABLED is the KMP default; keep it, RevenueDot does not sign responses with RevenueCat's key.
verificationMode = EntitlementVerificationMode.DISABLED
})
}
```
- Set `proxyURL` before `configure`. It applies to both the Android and the iOS targets.
- Pass the `appl_...` key on iOS and the `goog_...` key on Android, from RevenueDot or kept by the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md).
- **Keep entitlement verification off.** RevenueCat's SDK checks signatures with RevenueCat's key. `DISABLED`, the default, is right for RevenueDot. `INFORMATIONAL` logs every response as a failed check, and **`ENFORCED` would fail every request**. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- On Android, RevenueCat's native SDK underneath still sends diagnostics, paywall events and ad events to RevenueCat. See [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md).
- **Or install the RevenueDot SDK in the same release.** Kotlin packages stay `com.revenuecat.purchases.kmp.*`, so imports do not change. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/kotlin-multiplatform.md#install-the-revenuedot-sdk-and-pass-your-key).
**Sync once** on the first launch of the update, so current subscribers keep access:
```kotlin
// Once, after this update: send purchases made while the app talked to RevenueCat.
Purchases.sharedInstance.awaitSyncPurchases()
```
`awaitSyncPurchases` is a suspend function in `com.revenuecat.purchases.kmp.ktx`. The callback form is `syncPurchases(onError = { }, onSuccess = { })`.
The whole app change fits in one diff:
```diff
fun initPurchases(apiKey: String) {
+ // Point the SDK at your RevenueDot server; nothing else in the app changes. A String, set before configure.
+ Purchases.proxyURL = "https://revenuedot.example.com"
Purchases.configure(PurchasesConfiguration(apiKey) {
+ // DISABLED is the KMP default; keep it, RevenueDot does not sign responses with RevenueCat's key.
+ verificationMode = EntitlementVerificationMode.DISABLED
})
+ // Once, after this update (from a coroutine): send purchases made while the app talked to RevenueCat.
+ // Purchases.sharedInstance.awaitSyncPurchases()
}
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
There is no Kotlin Multiplatform example yet. The calls match the [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md) guide.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md)
- [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
---
# How do I add in-app purchases to a Unity game with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/unity.md
Description: Add the RevenueDot SDK for Unity from OpenUPM, put the Purchases component on a GameObject and fill in your app's keys. On RevenueDot Cloud nothing else is needed; a self-hosted server also goes in the Proxy URL field.
Add the RevenueDot SDK for Unity from OpenUPM, put the **Purchases** component on a GameObject, and fill in your app's Apple and Google keys from RevenueDot in the Inspector. On RevenueDot Cloud nothing else is needed. A self-hosted server also goes in the component's **Proxy URL** field.
## Install the RevenueDot SDK and pass your key
**Version 9.11.1 is on [OpenUPM](https://openupm.com/packages/com.revenuedot.purchases-unity/).** The source is [github.com/revenuedot/purchases-unity](https://github.com/revenuedot/purchases-unity).
Add Google's [External Dependency Manager for Unity](https://openupm.com/packages/com.google.external-dependency-manager/) (EDM4U) first, then the SDK. EDM4U downloads the native iOS and Android libraries the SDK calls. The SDK's package declares no dependencies, so it does not install EDM4U for you. RevenueCat's [Unity install guide](https://www.revenuecat.com/docs/getting-started/installation/unity) has the same step.
```bash
openupm add com.google.external-dependency-manager
openupm add com.revenuedot.purchases-unity
```
Or, without OpenUPM, import EDM4U from its [releases](https://github.com/googlesamples/unity-jar-resolver/releases), then open **Window > Package Manager > + > Add package from git URL** and enter:
```
https://github.com/revenuedot/purchases-unity.git?path=RevenueCat#9.11.1-revenuedot
```
The paywall package (`RevenueCatUI` folder) installs from git, as upstream. EDM4U pulls the native side, RevenueDot's [hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md) 19.4.1: the `RevenueDotPurchasesHybridCommon` pod and `app.revenuedot.purchases:purchases-hybrid-common`. We have not run the package in the Unity editor yet.
Then, on the GameObject with the **Purchases** component, set these Inspector fields:
| Inspector field | RevenueDot Cloud | Self-hosted server |
|---|---|---|
| Revenue Cat API Key Apple / Google | the `appl_` and `goog_` keys from RevenueDot | the same |
| Proxy URL (under **Advanced**) | empty | `https://revenuedot.example.com` |
| Entitlement Verification Mode | the default | Disabled |
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so the component and the C# namespace keep RevenueCat's names (`using RevenueCat;`) and your code calls `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so leave **Proxy URL** empty. It trusts RevenueDot Cloud's response-signing key.
- **Self-hosting:** set **Proxy URL** to your server and **Entitlement Verification Mode** to **Disabled**. Your server signs with its own key, which this build does not trust, so the default (Informational) would log every response as a failed check. To verify against your own server, build the SDKs with your public key. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- Unity has no public `SetProxyURL` method, so the field is the only way to set the proxy. The component applies it before it configures the SDK, also when you configure from code.
**Configure from code** if you prefer (**Use Runtime Setup** checked). The Proxy URL field still applies: `Purchases.Start()` sets it before it checks that box. The field's tooltip says otherwise, but the code applies it. Your script must run after `Purchases.Start()`, which also creates the native wrapper; calling `Configure` before it throws a `NullReferenceException`. `[DefaultExecutionOrder(100)]` makes Unity call your `Start()` after it.
```csharp
using UnityEngine;
// Runs after Purchases.Start(), which creates the native wrapper and applies the Proxy URL field.
[DefaultExecutionOrder(100)]
[RequireComponent(typeof(Purchases))]
public class Store : MonoBehaviour
{
void Start()
{
// Needs "Use Runtime Setup" checked on the Purchases component.
var purchases = GetComponent<Purchases>();
purchases.Configure(Purchases.PurchasesConfiguration.Builder.Init("appl_...")
// Only when you self-host: your server signs with its own key. On RevenueDot Cloud, leave this line out.
.SetEntitlementVerificationMode(Purchases.EntitlementVerificationMode.Disabled)
.Build());
}
}
```
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows.
```csharp
var purchases = GetComponent<Purchases>();
purchases.GetCustomerInfo((customerInfo, error) =>
{
if (error != null) return;
bool isPro = customerInfo.Entitlements.Active.ContainsKey("pro");
});
purchases.GetOfferings((offerings, error) =>
{
if (error != null || offerings.Current == null) return;
var package = offerings.Current.AvailablePackages[0];
purchases.PurchasePackage(package, result =>
{
if (result.UserCancelled || result.Error != null) return;
bool nowPro = result.CustomerInfo.Entitlements.Active.ContainsKey("pro");
});
});
```
## Test Store
Create a `test_store` app in RevenueDot and use its `test_...` key.
- Purchases only run on an iOS or Android device or simulator. In the Unity Editor the SDK uses a no-op wrapper and makes no requests.
- Native SDKs accept `test_` keys only in debug builds.
- iOS: servers older than the 2026-09-30 fix could not serve Test Store products to the native iOS SDK. See [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#test-store).
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
A game that ships RevenueCat's Unity SDK can keep it. In the Inspector, on the GameObject with the **Purchases** component, set **Proxy URL** to RevenueDot (`https://api.revenuedot.app` on RevenueDot Cloud, or your own server) and **Entitlement Verification Mode** to **Disabled**.
| Inspector field | Before | After |
|---|---|---|
| Proxy URL (under **Advanced**) | empty | `https://revenuedot.example.com` |
| Entitlement Verification Mode | Informational | Disabled |
| Revenue Cat API Key Apple / Google | your RevenueCat keys | the `appl_` and `goog_` keys from RevenueDot, or the RevenueCat keys if the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) kept them |
- **Turn entitlement verification off.** RevenueCat's SDK checks signatures with RevenueCat's key. The Inspector offers **Disabled** and **Informational**, and the default is Informational. It logs every RevenueDot response as a failed check but still grants access. Choose **Disabled**. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
- **Or install the RevenueDot SDK in the same release.** C# namespaces and assembly names stay the same, so `using RevenueCat;` keeps working. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/unity.md#install-the-revenuedot-sdk-and-pass-your-key).
**Sync once** on the first launch of the update, so current subscribers keep access:
```csharp
// Once, after this update: send purchases made while the app talked to RevenueCat.
GetComponent<Purchases>().SyncPurchases();
```
If you configure from code, the whole change fits in one diff:
```diff
var purchases = GetComponent<Purchases>();
-purchases.Configure(Purchases.PurchasesConfiguration.Builder.Init("appl_...").Build());
+purchases.Configure(Purchases.PurchasesConfiguration.Builder.Init("appl_...")
+ .SetEntitlementVerificationMode(Purchases.EntitlementVerificationMode.Disabled)
+ .Build());
+// Once, after this update: send purchases made while the app talked to RevenueCat.
+purchases.SyncPurchases();
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
There is no Unity example yet.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
---
# How do I add in-app purchases to a Cordova app with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/cordova.md
Description: Add the RevenueDot SDK with cordova plugin add @revenuedot/cordova-plugin-purchases, then call Purchases.configureWith with your app's key. On RevenueDot Cloud nothing else is needed, and the native SDK verifies each response.
Add the RevenueDot SDK with `cordova plugin add @revenuedot/cordova-plugin-purchases`, then call `Purchases.configureWith` with your app's key from RevenueDot. On RevenueDot Cloud nothing else is needed. The native SDK checks each Cloud response against RevenueDot's signing key.
## Install the RevenueDot SDK and pass your key
**Version 8.2.3 is on npm.** The source is [github.com/revenuedot/cordova-plugin-purchases](https://github.com/revenuedot/cordova-plugin-purchases).
```bash
cordova plugin add @revenuedot/cordova-plugin-purchases@8.2.3
```
```js
document.addEventListener("deviceready", () => {
Purchases.configureWith({
apiKey: device.platform === "iOS" ? "appl_..." : "goog_...",
});
});
```
- The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so the plugin id stays `cordova-plugin-purchases` and your code calls the global `Purchases`. It sends every request to RevenueDot and needs no RevenueCat account.
- `device.platform` comes from `cordova-plugin-device`.
- Use each app's public key from RevenueDot, or the `test_...` key for the Test Store. See [Which key goes where](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md#which-key-goes-where).
- **On RevenueDot Cloud** the SDK already calls `https://api.revenuedot.app`, so there is nothing else to set. `configureWith` takes no verification mode, so the native default, informational, applies, and the SDK trusts RevenueDot Cloud's signing key.
Its native side is RevenueDot's [hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md) 19.4.1, which is published. Installed from npm, it builds into a cordova-ios 8 app with the `RevenueDotPurchasesHybridCommon` 19.4.1 pod from CocoaPods trunk, and the app carries `api.revenuedot.app` and RevenueDot's signing key. **Xcode 27** rejects pods that target iOS 13, which RevenueCat's own plugin pods do too. Set `<preference name="deployment-target" value="15.0" />` in `config.xml`, and raise the pod targets with a `post_install` block in `platforms/ios/Podfile` (or a Cordova `after_prepare` hook, because `cordova prepare` rewrites the Podfile):
```ruby
post_install do |installer|
installer.pods_project.targets.each do |t|
t.build_configurations.each { |c| c.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0' }
end
end
```
**Self-hosting:** call `Purchases.setProxyURL` with your server's address before `configureWith`. It returns nothing. **The Cordova plugin has no option to turn off signature checks.** Your server signs with its own key, which this build does not trust, so the native SDKs log "failed verification" for every response from your server. Access is still granted, because the native default mode is informational. The log noise stays unless you build the SDKs with your own public key; see [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
```js
document.addEventListener("deviceready", () => {
Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configureWith({ apiKey: device.platform === "iOS" ? "appl_..." : "goog_..." });
});
```
## Check an entitlement and make a purchase
Check the entitlement your app unlocks, here `pro`, then buy a package from the current offering, the set of products your paywall shows. The plugin uses callbacks.
```js
Purchases.getCustomerInfo(
(customerInfo) => {
const isPro = customerInfo.entitlements.active["pro"] !== undefined;
},
(error) => console.error(error)
);
Purchases.getOfferings(
(offerings) => {
const aPackage = offerings.current && offerings.current.availablePackages[0];
if (!aPackage) return;
Purchases.purchasePackage(
aPackage,
({ customerInfo }) => {
const nowPro = customerInfo.entitlements.active["pro"] !== undefined;
},
({ error, userCancelled }) => { if (!userCancelled) console.error(error); }
);
},
(error) => console.error(error)
);
```
## Test Store
Create a `test_store` app in RevenueDot and use its `test_...` key on a debug build. The Test Store dialog replaces the store sheet.
- Native SDKs accept `test_` keys only in debug builds.
- iOS: servers older than the 2026-09-30 fix could not serve Test Store products to the native iOS SDK. See [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md#test-store).
- Test Store prices come from each product's Test Store price. Set it in the dashboard (Product catalog, Edit product) or with `test_store_price` on `POST /v2/projects/{project_id}/products`; a product without one shows 0.
More: [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
## Switching from RevenueCat? Keep your SDK and change one line
An app that ships RevenueCat's `cordova-plugin-purchases` can keep it. Call `Purchases.setProxyURL("https://revenuedot.example.com")` before `Purchases.configureWith` (`https://api.revenuedot.app` on RevenueDot Cloud). **RevenueCat's plugin has no option to turn off signature checks**, so the native SDKs log "failed verification" for every RevenueDot response. Access is still granted, because the native default mode is informational.
```js
document.addEventListener("deviceready", () => {
// Point the SDK at your RevenueDot server; nothing else in the app changes.
Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configureWith({
apiKey: device.platform === "iOS" ? "appl_..." : "goog_...",
});
});
```
- `setProxyURL` returns nothing. Call it before `configureWith`.
- Use each app's public key from RevenueDot, or your old RevenueCat keys if the [importer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md) kept them.
- **The verification log noise cannot be turned off from JavaScript.** `configureWith` takes no verification mode, so the native default, informational, applies. RevenueCat's SDK checks signatures with RevenueCat's key, so every RevenueDot response is logged as a failed check, and access is still granted. See [Signature verification failed](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/signature-verification-failed.md).
- **Or install the RevenueDot SDK in the same release.** The plugin id stays `cordova-plugin-purchases` and the global stays `Purchases`, so `config.xml` and your code do not change. On RevenueDot Cloud its checks pass. See [Install the RevenueDot SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/cordova.md#install-the-revenuedot-sdk-and-pass-your-key).
**Sync once** on the first launch of the update, so current subscribers keep access:
```js
// Once, after this update: send purchases made while the app talked to RevenueCat.
Purchases.syncPurchases();
```
The whole app change fits in one diff:
```diff
document.addEventListener("deviceready", () => {
+ // Point the SDK at your RevenueDot server; nothing else in the app changes. Call it before configure.
+ Purchases.setProxyURL("https://revenuedot.example.com");
Purchases.configureWith({ apiKey: device.platform === "iOS" ? "appl_..." : "goog_..." });
+ // Once, after this update: send purchases made while the app talked to RevenueCat.
+ Purchases.syncPurchases();
});
```
The full order of steps is in [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
## Examples
There is no Cordova example yet.
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [Hybrid common](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md)
- [Signature verification failed](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/signature-verification-failed.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
---
# What is purchases-hybrid-common, and do I need to install it?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/hybrid-common.md
Description: purchases-hybrid-common is the shared native and TypeScript layer under the React Native, Flutter, Capacitor, Unity and Cordova SDKs. App developers never install it directly; the wrapper pulls it in.
`purchases-hybrid-common` is the shared layer that the cross-platform SDKs (React Native, Flutter, Capacitor, Unity and Cordova) sit on. It turns their calls into calls on the native iOS and Android SDKs. **You never install it yourself**: your wrapper depends on it. Installing the RevenueDot SDK for React Native, Flutter, Capacitor, Unity or Cordova pulls in RevenueDot's build of it.
## What it contains
| Part | What it does | RevenueDot fork package (version 19.4.1) | Keeps the name |
|---|---|---|---|
| iOS layer | Swift bridge over the iOS SDK | pods `RevenueDotPurchasesHybridCommon`, `RevenueDotPurchasesHybridCommonUI` | modules `PurchasesHybridCommon`, `PurchasesHybridCommonUI` |
| Android layer | Kotlin bridge over the Android SDK | Maven `app.revenuedot.purchases:purchases-hybrid-common` (and `-ui`) | Kotlin packages |
| TypeScript types | Shared types and enums such as `ENTITLEMENT_VERIFICATION_MODE` | npm `@revenuedot/purchases-typescript-internal` and `-esm` | installed through npm aliases, so imports stay `@revenuecat/...` |
| Web mappings | Runs purchases-js in browser mode (Expo Go, React Native web, Flutter web) | npm `@revenuedot/purchases-js-hybrid-mappings` | installed through an npm alias |
The fork is [github.com/revenuedot/purchases-hybrid-common](https://github.com/revenuedot/purchases-hybrid-common); release 19.4.1 is the tag `19.4.1-revenuedot`, which Swift Package Manager also uses. Published: both pods on CocoaPods trunk, `purchases-hybrid-common`, `-ui` and `-store-galaxy` on Maven Central, and `@revenuedot/purchases-typescript-internal` and `@revenuedot/purchases-js-hybrid-mappings` and `@revenuedot/purchases-typescript-internal-esm` on npm.
## Which wrappers use it
| Wrapper | Native layer | TypeScript or web packages | Fork pin |
|---|---|---|---|
| [React Native](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/react-native.md) | Yes | `purchases-typescript-internal`, `purchases-js-hybrid-mappings` | 19.4.1 |
| [Flutter](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/flutter.md) | Yes | A copy of the web mappings for Flutter web | 19.4.1 |
| [Capacitor](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/capacitor.md) | Yes | `purchases-typescript-internal-esm` | 19.4.1 |
| [Unity](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/unity.md) | Yes, through EDM4U | none | 19.4.1 |
| [Cordova](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/cordova.md) | Yes | none | 19.4.1 |
[Kotlin Multiplatform](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/kotlin-multiplatform.md) does not use it: it builds on the iOS and Android SDKs directly. The native [iOS](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md), [Android](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md) and [web](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/web.md) SDKs do not use it either.
## How the forks fit together
The RevenueDot forks pin each other, so a wrapper fork gets the RevenueDot builds all the way down:
- The hybrid-common fork depends on RevenueDot's iOS fork (`RevenueDotPurchases` 5.91.0) and Android fork (`app.revenuedot.purchases:purchases` 10.23.0).
- The web mappings depend on RevenueDot's purchases-js fork through an npm alias.
- Every wrapper fork depends on hybrid-common 19.4.1.
Releases run in that order: iOS and Android first, then hybrid-common, then purchases-js and the web mappings, then the wrappers. All of them are published.
## Apps that keep RevenueCat's SDK change nothing here
- You do nothing here. The wrapper's `setProxyURL` and verification option pass through hybrid-common to the native SDK.
- With the stock wrappers, hybrid-common is RevenueCat's build, which trusts RevenueCat's signing key. That is why you turn verification off. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Related
- [All SDKs](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md)
- [SDK changes when you migrate](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/sdk-changes.md)
- [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md)
=== Guides: stores, web billing, webhooks, integrations, billing, team ===
# Which guide do I need?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/README.md
Description: Step-by-step guides for stores, web billing, webhooks, integrations, ads, attribution, benchmarks, growth insights, refunds, retention, support, testing, your team, Auth, moving, billing, Enterprise and its SLA, and, for teams that run their own server, self-hosting and high availability.
Each guide is one task, start to finish. Connect a store first, then receive webhooks.
| I want to | Guide |
|---|---|
| Accept App Store purchases and get Apple's notifications | [Connect the App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md) |
| Accept Google Play purchases and get real-time notifications | [Connect Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md) |
| Accept Amazon Appstore purchases on Fire tablets and Fire TV | [Connect the Amazon Appstore](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/amazon-appstore.md) |
| Track subscriptions sold with my own Stripe account | [Connect Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md) |
| Connect my Stripe account without copying a restricted key | [Connect with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe-connect.md) |
| Track web purchases sold through Paddle Billing | [Connect Paddle](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paddle.md) |
| Sell subscriptions in a Roku channel with Roku Pay | [Connect Roku](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/roku.md) |
| Accept Samsung Galaxy Store purchases | [Connect the Galaxy Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/galaxy-store.md) |
| Bring the products I already set up in App Store Connect, Google Play or Stripe into the catalog | [Import products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md) |
| Change App Store and Google Play prices in every territory from a CSV, or create store products, and see each product's store price and status | [Product editor](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/product-editor.md) |
| Sell my app's subscriptions on the web with a hosted Stripe checkout | [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md) |
| Share a checkout link for an offering | [Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) |
| Build a multi-step web-to-app funnel (quiz, email, paywall) | [Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md) |
| Unlock a web purchase in my app | [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md) |
| Give a discount or a code at web checkout | [Web discounts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md) |
| Put my purchase links and funnels on my own domain | [Custom domains](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md) |
| Ask questions about my revenue and customers, and make small changes from a chat, such as drafting products and offerings | [RevenueDot AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/revenuedot-ai.md) |
| Receive purchase events in my backend and verify them | [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md) |
| Send purchase events to any of RevenueCat's 37 integrations (Segment, Amplitude, AppsFlyer, Braze, Branch, Statsig, Superwall ...) or BigQuery, or export my data to S3, R2 or Google Cloud Storage | [Integrations and data exports](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md) |
| See ad revenue next to subscription revenue, verify rewarded ads on the server, or connect AdMob | [Ads](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/ads.md) |
| Have the SDK verify that responses come from my server | [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md) |
| Test purchases without any store account | [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md) |
| Test with App Store sandbox, Xcode or Google Play testers | [Sandbox testing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md) |
| Run my own server (advanced) | [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md) |
| Run several replicas behind a load balancer, on Kubernetes with Helm, or on AWS or Google Cloud with Terraform | [High availability](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/high-availability.md) |
| Upgrade my server | [Upgrades](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/upgrades.md) |
| Back up and restore | [Backups](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md) |
| Move a project between my own server and RevenueDot Cloud, or download everything a project owns | [Move projects and export everything](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/move-projects.md) |
| Know what RevenueDot Cloud costs, upgrade, or change my card | [Cloud billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/cloud-billing.md) |
| Check everything before real customers arrive | [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md) |
| Invite teammates to a project and set their roles | [Invite your team](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md) |
| Change your email or password, turn on two-factor authentication, sign out sessions, revoke AI assistants, pick summary and anomaly emails, a theme, a week start and a display currency | [Account settings](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/account-settings.md) |
| See which plan has organizations, custom roles, single sign-on and SCIM, and turn them on | [Plans and Enterprise](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md) |
| Know the uptime and support response times RevenueDot Enterprise promises | [Service level agreement](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sla.md) |
| Sign my team in with Okta, Microsoft Entra ID, Google Workspace or any SAML or OpenID Connect provider | [Single sign-on](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/single-sign-on.md) |
| Create, update and deactivate people from my identity provider and map its groups to roles | [SCIM](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/scim.md) |
| Keep data in the US or the EU | [Data location](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/data-location.md) |
| Keep audit logs for a set time and give auditors signed exports | [Audit retention and exports](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/audit-retention-and-exports.md) |
| Limit sandbox testing, hand a project to another admin, keep brand colours and fonts, block abusive users, or publish verified revenue numbers | [Project settings](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/project-settings.md) |
| Sign users in with Firebase or OpenID Connect and read their purchases and balances without a backend | [Auth](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/auth.md) |
| Build a paywall and show it in my app | [Paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md) |
| Show different offerings to different customers, by audience, placement or date | [Targeting and experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md) |
| Test two to four offerings, prices, trials or paywalls against each other and see which earns more | [Experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md) |
| Read MRR, revenue, churn, conversion and LTV, and know how each is calculated | [Charts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/charts.md) |
| See which ad networks and campaigns bring paying customers, with revenue by campaign and ROAS | [Attribution](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/attribution.md) |
| Compare my conversion, churn, refunds, LTV and prices with similar apps (RevenueDot Cloud) | [Benchmarks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/benchmarks.md) |
| Get 3 to 5 numbers-backed growth ideas every week, on the Overview and by email | [Growth insights](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/growth-insights.md) |
| Run RevenueDot from ChatGPT, Claude or Cursor | [Connect AI assistants](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/connect-ai-assistants.md) |
| Get an email when store notifications, webhooks or store credentials fail | [Alert emails](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md) |
| Win back lapsed App Store subscribers with Apple's win-back offers | [Win-back offers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/win-back-offers.md) |
| Know what happens to customers' access when the server is down | [Offline entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/offline-entitlements.md) |
| Answer Apple refund requests automatically and see my refund rate | [Refund Control](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/refund-control.md) |
| Choose what customers can do on the in-app subscription screen, its colours and its text in 33 languages | [Customer Center](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/customer-center.md) |
| Offer a discount when customers cancel, in my app or on Apple's cancel screen | [Retention offers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/retention.md) |
| Email subscribers whose payment failed a link to fix it, and see the revenue that comes back | [Payment recovery](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/payment-recovery.md) |
| Email churned subscribers an offer to come back | [Win-back campaigns](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/win-back-campaigns.md) |
| Get Customer Center support requests by email, or show subscriptions in the Intercom inbox or a Zendesk sidebar | [Support](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/support-integrations.md) |
| Filter, save and export lists of customers | [Customer lists](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/customer-lists.md) |
Moving from RevenueCat? Start with [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md). Looking for a specific endpoint? See the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/README.md).
---
# How do I connect the App Store to RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md
Description: Create an App Store app with your bundle ID, add an In-App Purchase key (.p8, key ID, issuer ID), then set RevenueDot's notification URL as the Server Notifications v2 URL in App Store Connect.
Three steps: create an App Store app in RevenueDot with your bundle ID, give it an **In-App Purchase key** so it can ask Apple about purchases, and paste its **notification URL** into App Store Connect as the Version 2 server notification URL. The dashboard's app page walks you through the same steps and checks each one.
## 1. Create the app
In the dashboard: **Apps → New app → App Store**, with your bundle ID. Or with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner (iOS)","type":"app_store","app_store":{"bundle_id":"com.example.scanner"}}'
```
The answer holds the app's `id`. Its public SDK key (`appl_...`) is on the app's page, or at `GET /v2/projects/{project_id}/apps/{app_id}/public_api_keys`. Use type `mac_app_store` (key `mac_...`) for a separate Mac App Store app.
## 2. Add the In-App Purchase key
RevenueDot uses this key to call Apple's App Store Server API: to confirm each StoreKit 2 purchase, read a customer's full history and renewal state (auto-renew, billing retry, grace period), and extend subscriptions.
1. Open [App Store Connect → Users and Access → Integrations → In-App Purchase](https://appstoreconnect.apple.com/access/integrations/api/subs).
2. Click **+**, name the key (for example RevenueDot) and click **Generate**.
3. Download the `.p8` file. Apple lets you download it only once.
4. Note the **Key ID** (10 characters) and the **Issuer ID** shown above the keys list.
5. In the dashboard, open the app → **In-app purchase key**, drop the `.p8` file, fill in the IDs and click **Check credentials**.
Or with the API. RevenueDot stores these under RevenueCat's field names and never returns them:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d "$(jq -n --rawfile key AuthKey_ABC123DEFG.p8 '{app_store: {subscription_private_key: $key, subscription_key_id: "ABC123DEFG", subscription_key_issuer: "57246542-96fe-1a63-e053-0824d011072a"}}')"
# Ask Apple whether the key works (one harmless API call).
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/actions/verify_credentials" -H "Authorization: Bearer $SECRET_KEY"
```
```json
{"object":"credentials_check","app_id":"appugfw01uy","store":"app_store","status":"valid","valid":true,"message":"Apple accepted the in-app purchase key.","checked_at":1790801342700,"key_id":"ABC123DEFG"}
```
**Without the key**, RevenueDot still verifies StoreKit 2 signed transactions against Apple's root certificate, but it knows only what the device sent: no renewal state and no history. **StoreKit 1 receipts need the key.** Without it RevenueDot answers 500 with code 7234, so the SDK keeps the purchase and retries after you add the key. (For development only, the `allow_unsigned_receipts` setting accepts StoreKit 1 receipts without checking them. Anyone could forge such a receipt, so never turn it on in production.)
## 3. Send App Store Server Notifications to RevenueDot
Notifications tell RevenueDot about renewals, cancellations, billing problems and refunds when they happen, not only when the app next opens.
1. Copy the app's notification URL from the dashboard, or from the API. It looks like `https://revenuedot.example.com/v1/notifications/apple/{app_id}`:
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/store_settings" -H "Authorization: Bearer $SECRET_KEY" | jq -r .notification_url
```
Behind a reverse proxy, RevenueDot builds the URL from `X-Forwarded-Host` and `X-Forwarded-Proto`. Check that it shows your public HTTPS address.
2. In App Store Connect, open your app → **App Information** → **App Store Server Notifications**.
3. Paste the URL as both the **Production Server URL** and the **Sandbox Server URL**, and choose **Version 2**.
4. Make a sandbox purchase. The app's notification status turns **Ready** when the first notification about a known purchase is processed.
How RevenueDot answers Apple:
- **200** for every verified notification, including ones about purchases it has not seen. Those are stored, and applied only when **Track new purchases from server-to-server notifications** is on (`track_new_purchases`).
- **400** when the signature is invalid, or the notification is for another bundle ID (or another Apple app ID, when you set `app_apple_id`). App Store Connect shows these as failed. These are counted as rejected requests and never turn the app's status to failing, because anyone who knows the app ID can send one (any App Store payload Apple signed for another app included).
- **500** when RevenueDot itself fails. Apple retries.
Check the status any time: `GET /v2/projects/{project_id}/setup_health` lists each app's `notification_status` (`ready`, `failing`, `received` or `waiting`) and the last error. See [store notifications not arriving](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/store-notifications-not-arriving.md).
## Monthly billing plans (iOS 26.4)
Apple lets a yearly subscription be paid monthly with a 12-month commitment. Each signed transaction names its plan in [`billingPlanType`](https://developer.apple.com/documentation/appstoreserverapi/billingplantype) (`MONTHLY` or `BILLED_UPFRONT`, App Store Server API 1.21). RevenueDot records `MONTHLY` as product plan `monthly`, the value the iOS SDK reports as `productPlanIdentifier`. A plain `pro_annual` matches monthly-plan purchases online and, through the SDK's offline entitlements, while RevenueDot is down. To give the monthly plan its own entitlements, add it as `productId:monthly` (for example `pro_annual:monthly`). See [offline entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/offline-entitlements.md).
## Optional settings
Set these in the app's `app_store` object with `POST /v2/projects/{project_id}/apps/{app_id}`, or in the dashboard under **More settings**:
| Field | What it does |
|---|---|
| `notification_forward_url` | Copies each notification, byte for byte, to another URL, such as RevenueCat's during a [dual run](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/dual-run.md). `null` turns it off |
| `track_new_purchases` | `true`: apply notifications about purchases RevenueDot has never seen. Useful during a migration |
| `app_apple_id` | Your app's Apple ID (a number). Production notifications for another app ID are refused |
| `xcode_certificate` | The StoreKit test certificate exported from Xcode (PEM). Lets RevenueDot accept purchases made with a StoreKit configuration file in the simulator. See [sandbox testing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md) |
| `allow_unsigned_receipts` | Development only: accept StoreKit 1 receipts without the In-App Purchase key |
| `app_store_connect_api_key`, `_id`, `_issuer`, `app_store_connect_vendor_number` | A separate App Store Connect API key with the App Manager role. Used to [import your products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md) and to create products in App Store Connect (below) |
| `shared_secret` | The legacy app-specific shared secret. Stored but not used: RevenueDot does not call Apple's deprecated verifyReceipt endpoint |
| `small_business_program` | Your dates in Apple's Small Business Program (below). `null` removes them |
## Apple Small Business Program
Apple keeps 15% instead of 30% while your app is in the [App Store Small Business Program](https://developer.apple.com/app-store/small-business-program/). Tell RevenueDot the dates, and proceeds use 15% for every purchase and renewal made inside them.
- **In the dashboard:** open the app, then **More settings → Apple Small Business Program**. Turn on **Enrolled**, set the entry date and, if you left, the exit date. **Add period** covers a second membership. **Use existing dates from …** copies the dates saved on another App Store app in the project.
- **With the API:**
```bash
curl -s -X POST "$B/apps/$APP_ID" -H "$H" -H "Content-Type: application/json" \
-d '{"app_store":{"small_business_program":{"enrolled":true,"periods":[{"entry_date":"2024-01-01","exit_date":null}]}}}'
```
Dates are `YYYY-MM-DD` (UTC). The exit date is the first day back at 30%. Up to 10 periods; they must not overlap.
- **What changes:** charts with revenue type **Proceeds**, metrics, exports and the REST API recompute past proceeds for the dates you enter. New webhook and integration events carry `commission_percentage` 0.15 (`takehome_percentage` 0.85). Events already sent keep their values, as in RevenueCat.
## What you can do from the server afterwards
- **Extend a subscription** by 1 to 90 days: `POST /v2/projects/{project_id}/subscriptions/{subscription_id}/actions/extend` with `extend_by_days` and `extend_reason_code`.
- **Extend every active subscriber of a product**, for example after an outage: `POST /v2/projects/{project_id}/apps/{app_id}/actions/mass_extend`.
- **Refunds** are Apple's decision; customers ask Apple. RevenueDot records Apple's `REFUND` notification as a `CANCELLATION` with a negative price.
- **Restore a purchase from its order id**, for a customer who sends you Apple's receipt email: `POST /v2/projects/{project_id}/customers/{customer_id}/actions/restore_purchase_by_order_id` with `{"order_id":"MK5TTTVWJH"}`. RevenueDot looks the order up with Apple (needs the In-App Purchase key) and gives the customer its subscriptions and purchases, under the project's transfer behaviour.
- **Create a product in App Store Connect** from your catalog: `POST /v2/projects/{project_id}/products/{product_id}/create_in_store`. A subscription needs `{"store_information":{"duration":"ONE_MONTH","subscription_group_name":"Pro"}}`; the group is reused by name or created. Other product types need no body. Add prices, a review screenshot and localizations in App Store Connect before you submit. Needs the App Store Connect API key above.
- **Win-back offers** work with no server setup beyond the In-App Purchase key and notifications. See [Win-back offers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/win-back-offers.md).
## Related
- [iOS SDK guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md)
- [Test with sandbox accounts and Xcode](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md)
- [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)
- [REST API v2: apps](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
---
# How do I connect Google Play to RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md
Description: Create a Google Play app with your package name, upload a Google Cloud service account key with Play Console access, then push real-time developer notifications to RevenueDot through Pub/Sub.
Three steps: create a Google Play app in RevenueDot with your package name, upload a **service account** key that Play Console lets read your orders, and point a **Pub/Sub push subscription** for real-time developer notifications at RevenueDot's notification URL. The dashboard's app page shows the same steps and checks each one.
## 1. Create the app
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner (Android)","type":"play_store","play_store":{"package_name":"com.example.scanner"}}'
```
The app's public SDK key starts with `goog_`. Create its products with `store_identifier` set to `subscriptionId:basePlanId` for subscriptions (for example `pro:monthly`) and the product ID for one-time products. See [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md).
## 2. Add a service account
RevenueDot uses the service account to read each purchase from the Google Play Developer API, **acknowledge** it (Google refunds purchases left unacknowledged for 3 days), look up refunds, and run store actions such as refund, cancel and defer.
1. In [Google Cloud](https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com), enable the **Google Play Android Developer API** for your project.
2. Under **IAM → Service accounts**, create a service account. Open it, choose **Keys → Add key → JSON**, and download the file.
3. In [Play Console → Users and permissions](https://play.google.com/console/developers/users-and-permissions), invite the service account's email with **View app information**, **View financial data** and **Manage orders and subscriptions**. View app information also lets RevenueDot [import your products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md).
4. In the dashboard, open the app → **Service account credentials**, drop the JSON file and click **Check credentials**. New Play Console permissions can take up to 36 hours to apply; until then the check says the account "works but cannot see this app yet".
With the API, send the file's contents as `play_service_account_credentials_json`:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d "$(jq -n --rawfile sa service-account.json '{play_store: {play_service_account_credentials_json: $sa}}')"
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/actions/verify_credentials" -H "Authorization: Bearer $SECRET_KEY"
```
Without a service account, Google Play receipts cannot be verified and RevenueDot answers 503 (code 7101), so the SDK keeps the purchase and retries once you add it.
## 3. Push real-time developer notifications to RevenueDot
Google Play publishes notifications to a Pub/Sub topic. A push subscription delivers them to RevenueDot.
1. Copy the app's notification URL, `https://revenuedot.example.com/v1/notifications/google/{app_id}`, from the dashboard or from `GET /v2/projects/{project_id}/apps/{app_id}/store_settings` (`notification_url`).
2. In [Google Cloud → Pub/Sub](https://console.cloud.google.com/cloudpubsub/topic/list), create a topic. Give `google-play-developer-notifications@system.gserviceaccount.com` the **Pub/Sub Publisher** role on it.
3. Add a subscription to the topic with delivery type **Push** and the notification URL as the endpoint.
4. In Play Console → **Monetize with Play → Monetization setup**, paste the full topic name (`projects/<project>/topics/<topic>`) and turn on subscriptions, voided purchases and one-time products.
5. Click **Send test notification**. The app's notification status turns **Ready** when it arrives.
For each notification RevenueDot stores the raw message once (by message ID), copies it to `notification_forward_url` when set, and reads the purchase again from the Play Developer API. Voided-purchase notifications record refunds. How it answers Pub/Sub:
- **200** when the message is handled, a duplicate, for another package name, or about an invalid purchase token. These never succeed on a retry, so Pub/Sub should stop.
- **500 or 503** for temporary failures, such as Google's API not answering. Pub/Sub delivers the message again.
Once a day RevenueDot also asks Google for voided purchases of the last 30 days, as a backup for missed refund notifications. This needs the service account.
## Optional: authenticate Pub/Sub pushes
By default anyone who knows the URL can post to it, but RevenueDot only trusts what Google's API returns for a purchase token, so a fake message cannot unlock anything. To also reject unsigned pushes:
1. Edit the push subscription, turn on **Enable authentication**, choose a service account, and set an **audience** (for example the notification URL).
2. Save the same values on the app. The dashboard has no field for this yet, so use the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"play_store":{"pubsub_audience":"https://revenuedot.example.com/v1/notifications/google/'$APP_ID'","pubsub_service_account":"pubsub-push@your-project.iam.gserviceaccount.com"}}'
```
From then on, a push without a valid Google-signed token for that audience (and that service account) gets 401.
## Google Play service fee
Proceeds use Google's [service fees](https://support.google.com/googleplay/android-developer/answer/112622) with nothing to set up:
- **Subscriptions:** 15%.
- **One-time purchases:** 15% on the app's first $1M of Google Play sales in a calendar year, then 30% for the rest of that year. Under Google's 2026 fees, a purchase above $1M by a customer who first opened the app after the fees started in their country is 25%.
RevenueDot counts the $1M from the purchases it has recorded for the app, so purchases made before you moved to RevenueDot count only if you [imported](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md) them.
## What you can do from the server afterwards
- **Refund and revoke** a subscription: `POST /v2/projects/{project_id}/subscriptions/{subscription_id}/actions/refund`.
- **Cancel** (turn auto-renew off): `.../actions/cancel`.
- **Defer** the next renewal by up to 365 days: `.../actions/extend` with `extend_by_days`, or v1 `.../subscriptions/{product_id}/defer`.
- **Refund a one-time purchase**: `POST /v2/projects/{project_id}/purchases/{purchase_id}/actions/refund`.
- **Restore a purchase from its order id** (`GPA.1234-5678-9012-34567`, from the customer's Google receipt email): `POST /v2/projects/{project_id}/customers/{customer_id}/actions/restore_purchase_by_order_id`. RevenueDot finds the purchase token with Google's Orders API (the service account needs **View financial data**), verifies it, and gives the purchase to the customer under the project's transfer behaviour.
- **Create a subscription in Play Console** from your catalog: `POST /v2/projects/{project_id}/products/{product_id}/create_in_store`. Google gets the subscription id and a listing in your app's default language; add base plans and prices in Play Console. One-time products need a price, so create them in Play Console.
These call Google's API with the service account. They are tested against a mocked Google API only; run one in a sandbox before you rely on it.
## Related
- [Android SDK guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md)
- [Test with Play license testers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md)
- [Store notifications not arriving](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/store-notifications-not-arriving.md)
- [REST API v2](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
---
# How do I connect the Amazon Appstore to RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/amazon-appstore.md
Description: Create an Amazon app with your package name, save the Amazon shared key so RevenueDot can check receipts with Amazon's Receipt Verification Service, and add RevenueDot's URL as a Real-time Notifications endpoint.
Three steps: create an Amazon Appstore app in RevenueDot with your package name, save the **shared key** from the Amazon Developer Console, and add RevenueDot's URL as a **Real-time Notifications** endpoint. Your Android app keeps using the RevenueCat Android SDK built for Amazon; only its proxy URL changes. The dashboard's app page shows the same steps and checks each one.
## 1. Create the app
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner (Fire)","type":"amazon","amazon":{"package_name":"com.example.scanner"}}'
```
The app's public SDK key starts with `amzn_`. Create its products with `store_identifier` set to the **term SKU** for subscriptions (for example `pro.monthly`, the SKU of one subscription term) and the SKU for consumables and entitlements. See [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md).
In your app, configure the SDK for Amazon with this key and the proxy URL:
```kotlin
Purchases.proxyURL = URL("https://api.revenuedot.app") // or your own server
Purchases.configure(AmazonConfiguration.Builder(this, "amzn_…").build())
```
## 2. Save the shared key
RevenueDot sends every receipt to Amazon's [Receipt Verification Service](https://developer.amazon.com/docs/in-app-purchasing/iap-rvs-for-android-apps.html) (RVS) with your shared key. RVS is the only source of dates and state: what the device posts is never trusted for those.
1. Sign in to the [Amazon Developer Console → Settings → Identity](https://developer.amazon.com/settings/console/sdk/shared-key) and copy the **Shared Key**.
2. In the dashboard, open the app → **Amazon shared key**, paste it and click **Check credentials**. RevenueDot asks RVS about a made-up receipt: Amazon answers 496 for a wrong key, so a wrong key shows up here, not on a customer's purchase.
With the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"amazon":{"shared_secret":"<your shared key>"}}'
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/actions/verify_credentials" -H "Authorization: Bearer $SECRET_KEY"
```
### What the SDK sees
- The SDK first asks `GET /v1/receipts/amazon/{store_user_id}/{receipt_id}` for a subscription's term SKU, then posts the receipt to `POST /v1/receipts` with `fetch_token` = the receipt ID and `store_user_id` = the Amazon user ID.
- An unknown receipt or user answers **400** (code 7103), so the SDK stops trying.
- Amazon being down, throttling, a missing shared key or one Amazon rejects answer **5xx** (code 7101). The SDK keeps the purchase unfulfilled and retries, so nobody loses a purchase while you fix the key. A rejected key also marks the app's credentials as failing and sends an [alert email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md).
## 3. Add the Real-time Notifications endpoint
Amazon sends renewals, cancellations, grace periods, tier changes and refunds of one-time purchases through Amazon SNS.
1. Copy the app's notification URL, `https://revenuedot.example.com/v1/notifications/amazon/{app_id}`, from the dashboard or from `GET /v2/projects/{project_id}/apps/{app_id}/store_settings` (`notification_url`).
2. In the [Amazon Appstore Console](https://developer.amazon.com/apps-and-games/console/apps/list.html), open your app → **App Services** → **Real-time Notifications**, expand **Add an Endpoint**, paste the URL and click **Submit**.
3. RevenueDot confirms the SNS subscription by itself, and the console shows **Verified** within seconds. The app's notification status turns **Ready**.
For each message RevenueDot:
- checks the **SNS signature**: the signing certificate must come from an `sns.<region>.amazonaws.com` HTTPS URL, and the message must verify with it (SignatureVersion 1 or 2). Anything else gets 400 and changes nothing;
- stores the raw message once (by SNS message ID) and copies it to `notification_forward_url` when set;
- reads the receipt again from RVS with the notification's Amazon user ID and applies what Amazon says.
Optionally, pin the SNS topic so messages from any other topic are refused. Copy the `TopicArn` of the first notification (it is in the stored message) into **SNS topic ARN** on the app page, or with the API: `{"amazon":{"sns_topic_arn":"arn:aws:sns:us-east-1:…"}}`.
Notifications about a receipt RevenueDot has never seen answer 200 and are ignored, unless **Track new purchases from server-to-server notifications** is on. Amazon's notifications carry no app user ID, so such a purchase starts on an anonymous customer until the app posts its receipt.
## How Amazon states map to events
| What Amazon reports | Event |
|---|---|
| A new subscription receipt | `INITIAL_PURCHASE` (`TRIAL` while `freeTrialEndDate` is ahead, `INTRO` during an introductory promotion) |
| `renewalDate` moved one term later | `RENEWAL` (with `is_trial_conversion` after a trial) |
| Auto-renew off, or back on | `CANCELLATION` (`UNSUBSCRIBE`), `UNCANCELLATION` |
| A grace period | `BILLING_ISSUE` and `CANCELLATION` (`BILLING_ERROR`); access continues to `gracePeriodEndDate` |
| `cancelDate` reached, or grace over | `EXPIRATION` |
| A deferred tier change (`deferredSku`) | `PRODUCT_CHANGE` to the deferred SKU |
| An immediate tier change (new receipt, `cancelledReceiptId`) | `INITIAL_PURCHASE` on the new receipt, `PRODUCT_CHANGE` on the old one |
| A consumable or entitlement bought | `NON_RENEWING_PURCHASE` |
| A consumable or entitlement cancelled (`*_CANCELLED`, or RVS answers 410) | `CANCELLATION` (`CUSTOMER_SUPPORT`) with a negative price |
Webhooks report `store: AMAZON`. Amazon has no subscription pause, and like RevenueCat, RevenueDot does not detect refunds of Amazon subscriptions ([RevenueCat: refunds](https://www.revenuecat.com/docs/subscription-guidance/refunds)).
## Sandbox
- Purchases from **Live App Testing** (`betaProduct`) and Amazon's test transactions (`testTransaction`) are sandbox data and stay out of production numbers.
- Receipts from **App Tester** exist only in RVS's cloud sandbox. When production RVS does not know a receipt, RevenueDot asks the cloud sandbox, and a receipt found there is sandbox data.
- Amazon's accelerated test timelines are not supported; event times follow real time ([RevenueCat: Amazon sandbox](https://www.revenuecat.com/docs/test-and-launch/sandbox/amazon-store-sandbox-testing) has the same limit).
## Prices
RVS has no price. The price and currency the SDK posts (the marketplace's local price) are saved with the purchase and converted to USD at the purchase date's rate. Renewals that arrive by notification keep the last known price.
## Small Business Accelerator Program
Amazon keeps 20% instead of 30% while your app is in its [Small Business Accelerator Program](https://developer.amazon.com/apps-and-games/blogs/2021/06/small-business-accelerator-program). In the dashboard, open the app and use **More settings → Amazon Small Business Accelerator Program**: turn on **Enrolled** and set the entry and exit dates. With the API, send `{"amazon":{"small_business_accelerator":{"enrolled":true,"periods":[{"entry_date":"2024-01-01","exit_date":null}]}}}` to `POST /v2/projects/{project_id}/apps/{app_id}`. Proceeds for purchases inside the dates use 20%, in charts, metrics, exports and new webhook events.
## Related
- [Android SDK guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md)
- [Store notifications not arriving](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/store-notifications-not-arriving.md)
- [SDK endpoints: Amazon receipt details](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md)
- [REST API v2](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
---
# How do I track Paddle Billing purchases in RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paddle.md
Description: Create a Paddle app with your Paddle API key, let RevenueDot add its notification destination in Paddle, import your prices, and post each Paddle subscription or transaction from your backend so the same entitlements unlock in your apps.
Four steps: create a Paddle app with a Paddle **API key**, click **Apply in Paddle** so Paddle sends its notifications to RevenueDot, import your **prices** as products, and post each purchase from your backend. Paddle is the merchant of record, so it handles tax; RevenueDot reads every subscription, transaction and refund from your own Paddle account with your key and unlocks the same entitlements as your App Store and Google Play purchases. It works like [RevenueCat's Paddle integration](https://www.revenuecat.com/docs/web/integrations/paddle).
## 1. Create the app and save the API key
1. In Paddle, open **Developer tools → Authentication** and create an API key. Use the sandbox dashboard for a sandbox key.
2. Give it **Read** access to Subscriptions, Transactions, Adjustments, Customers, Products and Prices, and **Write** access to Notification settings (for Apply in Paddle) and Customer portal sessions (for management links). Set no expiry: Paddle keys expire after 90 days by default.
3. In the dashboard, **Apps → Add app → Paddle**, paste the key and click **Check credentials**.
With the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner Web","type":"paddle","paddle":{"paddle_api_key":"pdl_live_apikey_…"}}'
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/actions/verify_credentials" -H "Authorization: Bearer $SECRET_KEY"
```
- The key decides the environment: `pdl_sdbx_apikey_…` records **sandbox** purchases, `pdl_live_apikey_…` production ones. A key made before May 2025 (50 characters) carries no environment; set `paddle_is_sandbox` for a sandbox one. Use one Paddle app per Paddle account.
- The key is sealed on the server and never returned; the app page shows only its environment and last four characters.
- The check calls Paddle's event types, then reads one product and one subscription. Paddle answers 403 for a wrong, revoked or other-environment key, and names the permission a key lacks.
## 2. Apply in Paddle
On the app page, **Paddle notifications → Apply in Paddle** creates a notification destination in your Paddle account that sends the subscription, transaction and adjustment events to `https://<your server>/v1/notifications/paddle/{app_id}`, and saves its secret key. Clicking it again updates the same destination.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/actions/apply_notification_settings" -H "Authorization: Bearer $SECRET_KEY"
```
To set it up by hand instead, create a destination with that URL and the events listed on the app page, then paste its **secret key** (`pdl_ntfset_…`) into the app's settings.
Every notification must carry a valid `Paddle-Signature`: an HMAC-SHA256 of `"<ts>:<raw body>"` with the secret key, within 5 minutes. Anything else gets 400 and changes nothing. Paddle's simulated events are accepted, show as received and change nothing.
Notifications are optional for subscriptions, which you post anyway, but needed for refunds of one-time purchases.
## 3. Import your prices
A RevenueDot product of a Paddle app is a **Paddle price** (`pri_…`), as in RevenueCat. **Import products** lists every active price with its product's name, as a subscription with the billing cycle's duration or as a one-time product, and attaches them to entitlements you pick. A catalog product made with the Paddle product id (`pro_…`) also matches when no product has the price id.
## 4. Post purchases from your backend
After Paddle's `transaction.completed`, post the subscription id or the transaction id with the customer's app user ID and the Paddle app's public key (`pdl_…`):
```bash
curl -s -X POST "$REVENUEDOT_URL/v1/receipts" \
-H "Authorization: Bearer pdl_…" -H "X-Platform: paddle" -H "Content-Type: application/json" \
-d '{"app_user_id":"user_123","fetch_token":"sub_01h…"}' # or "txn_01h…"
```
- A transaction of a subscription is recorded as that subscription; a transaction without one is a one-time purchase.
- A checkout that is not finished (`draft` or `ready`) answers **503**, so post it again later. An unknown id answers **400**.
- Also put the app user ID into the checkout's `customData` (for example `{ "app_user_id": "user_123" }`). With **Track new purchases from server-to-server notifications** on, a purchase first seen in a notification is given to that app user ID (the key is set under **Purchases first seen in a notification**), or to an anonymous ID.
## What each Paddle event does
| Paddle | Event |
|---|---|
| First paid transaction (or a trial) | INITIAL_PURCHASE |
| A renewal transaction completed | RENEWAL (`is_trial_conversion` after a trial) |
| Cancel scheduled (`scheduled_change.action: cancel`), taken back | CANCELLATION, UNCANCELLATION |
| Renewal payment failed (`past_due`) | BILLING_ISSUE; access continues for a 30-day grace period, as RevenueCat shows |
| Canceled | EXPIRATION (BILLING_ERROR when the last renewal was never paid) |
| Paused with a resume date, resumed | SUBSCRIPTION_PAUSED, RENEWAL |
| The subscription's price changed | PRODUCT_CHANGE |
| Approved full refund or chargeback | CANCELLATION (CUSTOMER_SUPPORT), access ends |
Webhooks report `store: PADDLE`. Take-home estimates use Paddle's standard 5% fee (the 50¢ per transaction is not included). The v2 [authenticated management URL](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md) of a Paddle subscription is a short-lived Paddle customer portal link.
---
# How do I connect a Roku channel to RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/roku.md
Description: Create a Roku app with your Roku Pay API key and channel ID, point RevenueCat's Roku SDK at RevenueDot, and set RevenueDot's URL as the Roku Pay push notification URL so renewals, failed payments, cancellations and refunds arrive.
Three steps: create a Roku app with your **Roku Pay API key** and **channel ID**, set the Roku SDK's `proxyUrl` to RevenueDot, and set RevenueDot's URL as the **push notification URL** in the Roku developer dashboard. Your channel keeps using [RevenueCat's Roku SDK](https://github.com/RevenueCat/purchases-roku) unchanged; RevenueDot checks every purchase with Roku Pay's web services, as [RevenueCat does](https://www.revenuecat.com/docs/getting-started/installation/roku).
## 1. Create the app
1. In the [Roku developer dashboard → Roku Pay web services](https://developer.roku.com/rpay-web-services), copy the **API key**.
2. In the dashboard, **Apps → Add app → Roku**, paste the key, click **Check credentials**, and add the channel ID and name from your channel's page.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner TV","type":"roku","roku":{"roku_api_key":"<your Roku Pay API key>","roku_channel_id":"123456","roku_channel_name":"Scanner"}}'
```
- The key is sealed and never returned. The check validates a made-up transaction: Roku answers `UNAUTHORIZED` for a wrong key.
- Create products with `store_identifier` set to each product's **code** from the Roku dashboard. Roku has no API that lists a channel's products, so they cannot be imported.
## 2. Point the SDK at RevenueDot
```brightscript
Purchases().configure({
apiKey: "roku_…",
proxyUrl: "https://api.revenuedot.app/v1/" ' or your own server, ending in /v1/
})
```
The SDK posts each purchase to `POST /v1/receipts` with the Roku transaction id as `fetch_token`. RevenueDot validates it with `validate-transaction` and takes the price and currency from Roku, because the SDK sends a formatted price and no currency.
- **Sandbox:** a sideloaded (developer) channel sends `X-Is-Sandbox: true` and its purchases are sandbox; beta and published channels are production, even for test users who pay nothing. This is RevenueCat's rule.
- An unknown transaction answers **400**; Roku being down or a rejected key answers **5xx**, so the SDK can try again, and a rejected key marks the app's credentials as failing.
## 3. Set the push notification URL
1. Copy the app's URL, `https://<your server>/v1/notifications/roku/{app_id}`, from the app page.
2. In **Roku Pay web services**, set it as the **Push notification URL**. Roku has one URL per developer account: pushes for your other channels go to the project's Roku app with that channel ID.
Every push is a JWT signed by Roku; RevenueDot checks it with Roku's published keys (the test key set for the dashboard's test endpoint), stores it once, validates its transaction again and applies what Roku says. A push that is not signed by Roku gets 400.
## What each Roku push does
| Roku | Event |
|---|---|
| `Sale` (first) | INITIAL_PURCHASE (TRIAL for a free trial) |
| `Sale` (renewal), `GraceRecovered`, `OnHoldRecovered` | RENEWAL |
| `GraceInitiated` | BILLING_ISSUE; access continues 3 days |
| `OnHoldInitiated` | Access ends: EXPIRATION (BILLING_ERROR) |
| `Cancellation`, `Resubscribe` | CANCELLATION, UNCANCELLATION |
| `Refund` | CANCELLATION (CUSTOMER_SUPPORT), access ends |
| `UpgradeSale` | A new subscription for the same customer; the old one is cancelled and expires |
| `DowngradeSale` | The current plan does not renew; the downgraded plan starts when Roku charges it |
| `Credit`, chargebacks | Stored, no change |
RevenueCat lists PRODUCT_CHANGE, REFUND_REVERSED and SUBSCRIPTION_PAUSED as not supported for Roku, and so does RevenueDot. Roku never sends "expired": the subscription expires when its date passes. Webhooks report `store: ROKU`; take-home estimates use Roku Pay's standard 20% share.
---
# How do I connect the Samsung Galaxy Store to RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/galaxy-store.md
Description: Create a Galaxy Store app with your package name and a Seller Portal service account, build your Android app with the RevenueCat SDK's Galaxy module pointed at RevenueDot, and set RevenueDot's URL for Samsung's server notifications.
Three steps: create a Galaxy Store app with your **package name** and a Seller Portal **service account**, build the app with the RevenueCat SDK's Galaxy module pointed at RevenueDot, and set RevenueDot's URL for Samsung's **server notifications**. Purchases from the Galaxy Store unlock the same entitlements as Google Play. Setup mirrors [RevenueCat's Galaxy Store guide](https://www.revenuecat.com/docs/platform-resources/galaxy-platform-resources/galaxy-setup-guide).
## 1. Create the app and the service account
1. In [Samsung Seller Portal](https://seller.samsungapps.com), open **Assistance → API Service → Create Service Account**, select the **Publishing & Item** and **GSS** scopes, and click **Download Key**. Samsung shows the key only once.
2. In the dashboard, **Apps → Add app → Galaxy Store**, enter the package name, then paste the service account ID, drop the key file and click **Check credentials**.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner Galaxy","type":"galaxy","galaxy":{"package_name":"com.example.scanner","galaxy_service_account_id":"<id>","galaxy_service_account_private_key":"-----BEGIN PRIVATE KEY-----\n…"}}'
```
- `galaxy` is a RevenueDot extension of the v2 API: RevenueCat's v2 API has no Galaxy app object. The app's public key starts with `galx_`, the prefix the SDK requires.
- The private key is sealed and never returned. RevenueDot signs a JWT with it for Samsung's access tokens; the check then reads a made-up subscription, so a wrong account or a missing scope shows up here.
- Create products with `store_identifier` set to each item ID: subscriptions, consumables and non-consumables. **Import products** lists your in-app items; Samsung's API does not list subscriptions, so add those with **New product**.
## 2. Build the app with the Galaxy module
```kotlin
// build.gradle: implementation("com.revenuecat.purchases:purchases-store-galaxy:<version>")
Purchases.proxyURL = URL("https://api.revenuedot.app") // or your own server, before configure
Purchases.configure(GalaxyConfiguration.Builder(this, "galx_…").build())
```
React Native: add `react-native-purchases-store-galaxy` and configure with `store: "GALAXY"`.
The SDK posts each purchase to `POST /v1/receipts` with Samsung's purchase ID as `fetch_token`. RevenueDot reads the receipt from Samsung (no credentials needed), and a subscription's state with the service account. Answers:
- `purchased_products.<item>.should_consume` is true for products the catalog marks consumable, so the SDK consumes them; everything else is acknowledged.
- An unknown purchase or another app's purchase answers **400**. Samsung being down, or a subscription without a service account, answers **5xx**: the SDK leaves the purchase unfinished and tries again.
- Purchases made in IAP test mode by license testers are **sandbox**.
## 3. Server notifications
1. Copy the app's URL, `https://<your server>/v1/notifications/galaxy/{app_id}`, from the app page and set it in Seller Portal for the app's in-app purchases.
2. Send Samsung's test notification; the app page turns green.
3. Optional but recommended: paste the seller's **IAP public key** (Assistance → API Service → IAP Key). Every notification's signature is then checked. Without it, RevenueDot trusts nothing in a notification and reads the purchase from Samsung instead, which is also how RevenueCat works.
| Samsung | Event |
|---|---|
| `ARS_SUBSCRIBED`, a new purchase | INITIAL_PURCHASE (TRIAL or INTRO for free and tiered first periods) |
| `ARS_RENEWED`, `ARS_OUT_GRACE_PERIOD` | RENEWAL |
| `ARS_UNSUBSCRIBED`, `ARS_RESUBSCRIBED` | CANCELLATION, UNCANCELLATION |
| `ARS_IN_GRACE_PERIOD` | BILLING_ISSUE; access continues to the grace end |
| The end date passes | EXPIRATION |
| `ARS_UPDOWNGRADED` | PRODUCT_CHANGE on the old subscription; the new plan is its own subscription for the same customer |
| `ARS_REFUNDED`, `ITEM_REFUNDED` | CANCELLATION (CUSTOMER_SUPPORT), access ends |
| `ARS_PRICECHANGE_AGREED` | PRICE_INCREASE_CONSENT_APPROVED |
Refunds and cancellations also work from the API, through Samsung: `POST /v2/projects/{project_id}/subscriptions/{id}/transactions/{transaction_id}/actions/refund` (RevenueCat's "refund a Play Store or Galaxy subscription's transaction") and `…/subscriptions/{id}/actions/cancel`. Webhooks report `store: GALAXY`; take-home estimates use Samsung's standard 30% share.
---
# How do I track Stripe subscriptions from my own Stripe account in RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md
Description: Create a Stripe app, save a restricted API key and a webhook signing secret from your own Stripe account, post each new subscription or Checkout Session to /v1/receipts, and let Stripe's webhooks keep it current.
Four steps: create a Stripe app in RevenueDot, save a **restricted API key** from your Stripe account, add a **webhook endpoint** in Stripe and save its signing secret, then have your backend **post each purchase** to `POST /v1/receipts`. Customers who pay on your website then get the same entitlements in your apps when they use the same app user ID. For this, RevenueDot only reads from Stripe: it never charges, refunds or changes anything there.
**No checkout of your own?** RevenueDot can host one on the same Stripe app: purchase links, funnels and redemption links, with products, prices and coupons it creates in your account. That needs write permissions on the key. See [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md).
## 1. Create the app
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner (Web)","type":"stripe"}'
```
The app's public key starts with `strp_`. Create its products with `store_identifier` set to the **Stripe product ID** (`prod_…`). To sell several prices of one Stripe product as separate products, use the **price ID** (`price_…`) instead; a price ID wins over its product ID. See [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md).
## 2. Connect your Stripe account
Save a restricted key, then add the webhook endpoint in step 3. **On RevenueDot Cloud this is the only way today:** Connect with Stripe is not available there yet, so its button is greyed out. On a self-hosted server with a Stripe Connect platform, you can instead select **Connect with Stripe** on the app's page and skip to step 4. See [Connect with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe-connect.md).
### Save a restricted API key
1. In the [Stripe Dashboard → Developers → API keys](https://dashboard.stripe.com/apikeys/create), click **Create restricted key**.
2. Give it **Read** access to Subscriptions, Invoices, Checkout Sessions, Charges, Customers, Products and Prices. Leave everything else at None. For [web billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md#1-connect-stripe), give Products, Prices, Checkout Sessions, Coupons and Promotion Codes **Write** instead.
3. In the dashboard, open the app → **Stripe account**, paste it under **Or use a restricted key** and click **Check credentials**. RevenueDot lists one subscription and one Checkout Session: a wrong key says so, and a key without a permission names the one it lacks.
With the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"stripe":{"stripe_secret_key":"rk_live_…"}}'
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/actions/verify_credentials" -H "Authorization: Bearer $SECRET_KEY"
```
A publishable key (`pk_…`) is refused. Using a Stripe Connect platform key for one connected account? Also save `stripe_account_id` (`acct_…`); RevenueDot sends it as `Stripe-Account`.
**Test mode.** The key decides the environment: a test-mode key (`rk_test_…`) or a [Stripe sandbox](https://docs.stripe.com/sandboxes) records sandbox data, kept out of production numbers. Use one Stripe app per Stripe account, mode or sandbox, as [RevenueCat recommends](https://www.revenuecat.com/docs/web/integrations/stripe) too.
## 3. Add the webhook endpoint
1. Copy the app's webhook URL, `https://revenuedot.example.com/v1/notifications/stripe/{app_id}`, from the dashboard or from `store_settings` (`notification_url`).
2. In the [Stripe Dashboard → Developers → Webhooks](https://dashboard.stripe.com/webhooks/create), add an endpoint with that URL and these events: `customer.subscription.created`, `customer.subscription.updated`, `customer.subscription.deleted`, `customer.subscription.paused`, `customer.subscription.resumed`, `invoice.paid`, `invoice.payment_failed`, `invoice.updated`, `charge.refunded`, `checkout.session.completed`. Other events are accepted and ignored. For [web billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md), `checkout.session.completed` also records purchases from RevenueDot's hosted checkout, and `checkout.session.async_payment_succeeded` records the ones paid with delayed methods.
3. Reveal the endpoint's **Signing secret** (`whsec_…`) and paste it on the app page, or save it as `stripe_webhook_secret`.
Every event must carry a valid `Stripe-Signature`: RevenueDot computes the HMAC-SHA256 of `"<t>.<body>"` with the signing secret, the way [Stripe documents it](https://docs.stripe.com/webhooks#verify-manually), and refuses a timestamp more than 5 minutes off. A missing secret or a bad signature answers 400. Each event is stored once (by event ID), copied to `notification_forward_url` when set, and applied by reading the subscription from Stripe again, so events arriving out of order cannot roll a subscription back. Temporary failures answer 500, and Stripe retries.
## 4. Post each purchase from your backend
After Stripe confirms a purchase (`customer.subscription.created` or `checkout.session.completed`), post its subscription ID or Checkout Session ID with the customer's app user ID:
```bash
curl -X POST "$REVENUEDOT_URL/v1/receipts" \
-H "Authorization: Bearer strp_…" -H "X-Platform: stripe" -H "Content-Type: application/json" \
-d '{"app_user_id":"user_123","fetch_token":"sub_1Abc…"}'
```
- A **subscription ID** (`sub_…`) records the subscription.
- A **Checkout Session ID** (`cs_…`) records the session's subscription, or, for a payment-mode session, each line item as a one-time purchase (consumable or not, by your catalog). One-time purchases need a Checkout Session.
- The answer is the customer's [customer info](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/customers-and-app-user-ids.md). Posting the same ID again changes nothing.
- **400** (code 7103) means it can never succeed: an unknown ID, an expired session, a subscription whose first payment never completed. **5xx** (code 7101) means try again later: Stripe was unavailable, the key was rejected, or the first invoice is not paid yet.
### When a subscription counts
By default a subscription counts once its latest invoice is **paid**. Set `register_on` to `invoice_created` (on the app page: "When the invoice is created") to grant access while the first invoice is still open, as RevenueCat's ["Subscription purchase recognition"](https://www.revenuecat.com/docs/web/integrations/stripe/track-external-purchases) setting does.
### Purchases you never posted
Turn on **Track new purchases from server-to-server notifications** to record subscriptions and Checkout purchases that RevenueDot first hears about from a webhook. The customer is found by `app_user_id_source`:
- `metadata` (default): the metadata key `app_user_id_metadata_key` (default `app_user_id`) on the Checkout Session or the subscription. Set it in both when a session creates a subscription.
- `customer_id`: the Stripe customer ID becomes the app user ID.
- `anonymous`: an anonymous ID.
## How Stripe states map to events
| What Stripe reports | Event |
|---|---|
| An active subscription with a paid invoice | `INITIAL_PURCHASE` (`TRIAL` while `trialing`, at price 0) |
| A new paid invoice for the next period | `RENEWAL` (with `is_trial_conversion` after a trial) |
| `cancel_at_period_end` or a future `cancel_at`; undone | `CANCELLATION` (`UNSUBSCRIBE`); `UNCANCELLATION` |
| `past_due`: the renewal invoice failed | `BILLING_ISSUE`, `CANCELLATION` (`BILLING_ERROR`); access to the end of the paid period, grace until Stripe's next payment attempt |
| Paid after `past_due` | `RENEWAL` |
| `unpaid`, or retries run out | `EXPIRATION` (`BILLING_ERROR`) |
| `canceled` (`customer.subscription.deleted`) | `CANCELLATION` if not seen before, then `EXPIRATION` at `ended_at` |
| `pause_collection` with `resumes_at` | `SUBSCRIPTION_PAUSED` |
| Another price or product on the subscription | `PRODUCT_CHANGE`; a proration invoice in the middle of a period is not a renewal and adds no revenue |
| `charge.refunded` in full for the latest period | `CANCELLATION` (`CUSTOMER_SUPPORT`), a negative transaction, and access ends at the refund. A later paid period is a `RENEWAL` |
| A payment-mode Checkout Session | `NON_RENEWING_PURCHASE`; a full refund is `CANCELLATION` (`CUSTOMER_SUPPORT`) |
Webhooks report `store: STRIPE` with no store commission. Revenue is what each invoice charged (`amount_paid`), so coupons show in revenue; it is converted to USD at the period start's rate. Zero-decimal currencies such as JPY are not divided by 100.
Both Stripe API shapes work: before 2025-03-31 (period fields on the subscription, `invoice.subscription`) and after (period fields on the subscription item, `invoice.parent.subscription_details`).
## Not supported yet
- Subscription schedules, metered and tiered prices, and subscriptions with several items.
- A scheduled re-check without webhooks: without the webhook endpoint, a cancellation shows only when your backend posts the subscription again.
## Related
- [Connect with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe-connect.md): link your account without a restricted key
- [Payment recovery](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/payment-recovery.md): email customers whose renewal failed a link to the Stripe customer portal
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md): hosted checkout, purchase links, funnels and redemption links
- [Webhooks out of RevenueDot](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)
- [Sandbox and production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/sandbox.md)
- [SDK endpoints: POST /v1/receipts](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md)
- [REST API v2](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
---
# How do I import my products from App Store Connect, Google Play or Stripe?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md
Description: Click Import products, pick the store products you already set up, and RevenueDot creates them in the catalog with their type, duration and name, attached to the entitlements you choose. Works with App Store Connect, Google Play and Stripe; Amazon products are added by SKU.
Open **Product catalog → Products** and click **Import products** (or **Import** next to one app, or **Import products** on the app's own page). RevenueDot reads the store with the credentials the app already has, lists every product with its type and duration, marks the ones already in the catalog, and creates the ones you pick. Nothing changes in the store. RevenueCat's dashboard has the same button under **+ New → Import Products** ([RevenueCat docs](https://www.revenuecat.com/docs/offerings/products-overview)).
## What each store needs
| Store | Credential on the app | Permission |
|---|---|---|
| App Store, Mac App Store | **App Store Connect API key**: the `.p8` file, its key ID and the issuer ID (app page → App Store Connect API key). The In-App Purchase key cannot read the product list. | A team key with the **App Manager** role ([Users and Access → Integrations → App Store Connect API](https://appstoreconnect.apple.com/access/integrations/api)) |
| Google Play | The **service account JSON** you already use for purchases | **View app information and download bulk reports (read-only)** for the app in [Play Console → Users and permissions](https://play.google.com/console/developers/users-and-permissions) |
| Stripe | The app's **restricted key** | **Products: Read** (it covers prices) |
| Amazon Appstore | Not possible | Amazon has no API that lists an app's in-app items. Add each product with **New product**: a subscription by its term SKU, a one-time product by its SKU. |
When a credential is missing or the store refuses it, the dialog says which one and which role or permission it needs, with a link to the app's settings.
**App Store Connect answers 401?** The most common cause is saving the **In-App Purchase key** (a `SubscriptionKey_….p8` file, used for purchases and notifications) in the App Store Connect API key fields. Apple accepts that key only on the App Store Server API, never on the App Store Connect API, so the product list stays closed. Create a separate team key under [Users and Access → Integrations → App Store Connect API](https://appstoreconnect.apple.com/access/integrations/api) with the App Manager role and save that one. The app can keep both.
## What gets imported
- **App Store Connect:** every subscription, grouped by subscription group, and every in-app purchase. The product ID becomes the store identifier, the reference name the display name. Subscription periods become durations (`ONE_MONTH` is `P1M`, `ONE_YEAR` is `P1Y`). Consumable, non-consumable and non-renewing types carry over.
- **Google Play:** one product per **base plan**, as `subscription_id:base_plan_id` (for example `premium:monthly`), with the base plan's billing period; prepaid and installment plans are marked. One-time products come in as `one_time` by product ID. A subscription without a base plan is listed but cannot be imported until it has one. A one-time product with no backwards-compatible purchase option is importable, with a note: SDK versions that predate purchase options cannot buy it. RevenueCat asks you to add those by hand.
- **Stripe:** one product per **active price** (`price_…`), named after its Stripe product. Recurring prices become subscriptions with their interval; one-time prices become non-consumables (change them to consumable if they can be bought again). Prices whose product ID is already in the catalog count as imported. Metered prices and products without a price cannot be imported. Flat-rate prices can also be sold through [web billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md) right away. RevenueCat imports the Stripe product and has you pick one price ([RevenueCat docs](https://www.revenuecat.com/docs/web/integrations/stripe)); importing prices lets a monthly and a yearly price of one Stripe product both be in the catalog.
The import does not copy prices into the catalog. The Products page reads each App Store and Google Play product's price and status separately, and the [product editor](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/product-editor.md) changes them; see [Store prices and status](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/product-editor.md#store-prices-and-status-on-the-products-page).
## In the dashboard
1. Click **Import products** and choose the app.
2. Search, tick products, or tick the box in the header to **select all** that can be imported. Products already in the catalog show **In catalog** and cannot be ticked.
3. Optionally tick **entitlements** to attach every imported product to, such as `pro`.
4. Click **Import N products**. The summary lists what was created, what was already there and anything that failed.
Importing the same products again changes nothing.
## With the API
List what the store has (every page of the store's lists is read; `next_page` is always null):
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/store_products" -H "Authorization: Bearer $SECRET_KEY"
```
```json
{
"object": "list", "next_page": null, "app_id": "app1a2b3c4d", "store": "play_store", "warnings": [],
"items": [
{ "object": "store_product_listing", "store_identifier": "premium:monthly", "type": "subscription", "display_name": "Premium (monthly)",
"duration": "P1M", "store_state": "ACTIVE", "group": { "id": "premium", "name": "Premium" }, "price": null,
"importable": true, "note": null, "in_catalog": true, "product_id": "prod1a2b3c4d5e" }
]
}
```
Import the ones you want, attached to entitlements:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/store_products/actions/import" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"store_identifiers":["premium:annual","gems_50"],"entitlement_ids":["entl1a2b3c4d5e"]}'
```
The answer has `created`, `existing` (left unchanged) and `failed` (`not_in_store` or `not_importable`, with a message). It is 201 when something was created, else 200. The key needs `project_configuration:products:read_write`, and `project_configuration:entitlements:read_write` too when you pass `entitlement_ids`. Reference: [List the products in the app's store](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#list-the-products-in-the-apps-store) and [Import products from the app's store](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#import-products-from-the-apps-store).
## Related
- [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md)
- [App Store setup](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md), [Google Play setup](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md), [Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md)
---
# How do I change App Store and Google Play prices with the product editor?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/product-editor.md
Description: Download a CSV of your App Store or Google Play products with a price per territory, change prices or add products, upload it, review every change, and commit it to the store. The Products page shows each product's store price and status.
**The product editor changes prices in App Store Connect and Google Play from one CSV file.** It works in three steps:
1. **Update product file.** Download a CSV of the products you pick, with one row per product and territory. Change the `price` column, or add rows for new products, and upload the file.
2. **Review changes.** RevenueDot reads the store again and checks every line. It lists every problem with its line number, or shows every price change and every new product next to the current price.
3. **Commit to store.** RevenueDot sends the changes to App Store Connect or Google Play and shows each row's result. You can retry the rows that failed.
Open it from **Product catalog → Products → Product editor** (marked Beta). Nothing changes in the store until you commit. RevenueCat's dashboard has a product editor with the same download, review and commit steps ([RevenueCat docs](https://www.revenuecat.com/docs/offerings/products-overview)).
The product editor works with App Store, Mac App Store and Google Play apps. Test Store prices are set on each product in RevenueDot, and Stripe prices come with the [imported web products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md).
## Each store needs a key that can change prices
| Store | Credential on the app | To read prices | To change prices and create products |
|---|---|---|---|
| App Store, Mac App Store | The **App Store Connect API key**: the `.p8` file, its key ID and the issuer ID (app page → App Store Connect API key) | A team key with the **App Manager** role | The same key |
| Google Play | The **service account JSON** you already use for purchases | **View app information and download bulk reports (read-only)** | **Manage store presence** |
The **In-App Purchase key** (a `SubscriptionKey_….p8` file) cannot read or change prices, because App Store Connect accepts it only on the App Store Server API. Create a team key under [Users and Access → Integrations → App Store Connect API](https://appstoreconnect.apple.com/access/integrations/api) with the App Manager role, and save it in the app's App Store Connect API key fields. The app can keep both keys. Google Play permissions are set in [Play Console → Users and permissions](https://play.google.com/console/developers/users-and-permissions).
When a key is missing or the store refuses it, the product editor says which key and which role or permission it needs, and links to the app's settings.
## 1. Download a CSV of the products you pick
1. Pick **App Store** or **Play Store**, and the app when you have more than one.
2. On the **Products** tab, tick the products to change, or tick the box in the header to select them all. The list shows each product's price, how many territories have a price, and its store status.
3. Click **Download .csv**. The download reads the store again, so the file has today's prices.
Google Play one-time products are listed with their prices, but they cannot be selected: Play Store one-time purchases aren't supported yet. Change their prices in Play Console.
The file is named after the app, the store and the date, for example `scanner-ios-app-store-products-2026-10-02.csv`.
## The CSV has one row per product and territory
The first line names the columns. RevenueDot reads the columns by name, so their order does not matter, and it ignores columns it does not know (with a note). `store_identifier`, `territory`, `currency` and `price` are required.
| Column | What it holds |
|---|---|
| `store_identifier` | The product's ID in the store. App Store: the product ID, such as `com.example.pro.monthly`. Google Play: `subscription_id:base_plan_id`, such as `pro:monthly` |
| `display_name` | The store name: the reference name in App Store Connect, or the subscription's title in Play Console. Read only for new products |
| `type` | `subscription`, `consumable`, `non_consumable` or `non_renewing_subscription`. Read only for new products |
| `duration` | The period of a subscription as an ISO 8601 period, such as `P1M` or `P1Y`. Read only for new products |
| `group` | The App Store subscription group's reference name. Read only for new App Store subscriptions; Google Play ignores it |
| `territory` | Where the price applies. App Store: App Store Connect's three-letter territory code, such as `USA`, `GBR` or `JPN`. Google Play: the two-letter region code, such as `US`, `GB` or `JP` |
| `currency` | The currency the store uses in that territory, such as `USD`, `GBP` or `JPY` |
| `price` | The customer price in that currency, with a period as the decimal point and no thousands separator: `9.99`, or `1740` for yen |
| `action` | Empty (or `update`) to change an existing product's prices. `create` to add a new product |
A downloaded file lists each product's base territory first (the United States when the product has a price there), then the other territories by code. A product with no price yet gets one row with empty `territory`, `currency` and `price`.
**Prices have as many decimals as the currency allows**: two for USD, EUR and GBP, none for JPY and KRW, and three for KWD. Trailing zeros are fine, so `9.990` is `9.99` and `1740.00` is `1740`. A price must be above 0 and at most 100,000,000.
**Only rows that change something count.** A row whose price already matches the store is unchanged. A row with no territory, currency and price is skipped. A row with a price in a territory where the product has no price yet adds that territory.
**The product editor changes prices only.** A new name, type, period or group on an existing product is ignored with a note; change those in the store.
**Spreadsheets are fine.** A file saved with semicolons or tabs instead of commas is read too, as long as the header line has no comma. Quoted cells, Windows line endings and a UTF-8 byte order mark are fine. In the download, a name or group that starts with `=`, `+`, `-` or `@` gets a leading apostrophe so a spreadsheet does not run it as a formula, and the upload removes the apostrophe again.
### Example: two price changes and a new App Store subscription
```csv
store_identifier,display_name,type,duration,group,territory,currency,price,action
pro_monthly,Pro Monthly,subscription,P1M,Pro,USA,USD,10.99,
pro_monthly,Pro Monthly,subscription,P1M,Pro,GBR,GBP,9.99,
pro_monthly,Pro Monthly,subscription,P1M,Pro,DEU,EUR,9.99,
pro_weekly,Pro Weekly,subscription,P1W,Pro,USA,USD,3.99,create
pro_weekly,,,,,GBR,GBP,3.99,create
```
The first three rows set `pro_monthly`'s price in the United States, the United Kingdom and Germany; a row whose price is already in the store counts as unchanged. The last two rows create `pro_weekly` in the `Pro` subscription group with a price in two territories. Later rows of a new product may leave the product columns empty.
### Example: a new Google Play base plan
```csv
store_identifier,display_name,type,duration,group,territory,currency,price,action
premium:monthly,Premium,subscription,P1M,Premium,US,USD,7.99,
premium:yearly,Premium,subscription,P1Y,,US,USD,59.99,create
premium:yearly,,,,,DE,EUR,59.99,create
```
The first row changes the US price of the `monthly` base plan. The other rows add a `yearly` base plan to the existing `premium` subscription, priced in the United States and Germany.
### New products need a type, a period and a name
Set `action` to `create` on every row of a new product. The first row names the product; later rows may leave `display_name`, `type`, `duration` and `group` empty, but a different value is an error. A new product needs a price in at least one territory.
**App Store**
- The product ID uses letters, digits, periods and underscores, up to 100 characters.
- `type` is `subscription`, `consumable`, `non_consumable` or `non_renewing_subscription`.
- A subscription needs a `duration` of `P1W`, `P1M`, `P2M`, `P3M`, `P6M` or `P1Y`, and a `group`: the subscription group's reference name. RevenueDot uses the group with that name, or creates it.
- `display_name` is required, up to 64 characters. It becomes the reference name.
- The App Store sells a subscription only in the territories where it has a price. The check notes when a new subscription has a price in fewer territories than the App Store has.
**Google Play**
- `store_identifier` is `subscription_id:base_plan_id`. The subscription ID starts with a lowercase letter or digit and uses lowercase letters, digits, periods and underscores, up to 40 characters. The base plan ID starts with a lowercase letter or digit and uses lowercase letters, digits and hyphens, up to 63 characters.
- `type` is `subscription`. Play Store one-time purchases aren't supported yet; create them in Play Console.
- `duration` is `P1W`, `P1M`, `P2M`, `P3M`, `P4M`, `P6M` or `P1Y`.
- `display_name` is required, up to 55 characters. It becomes the subscription's title when the subscription is new.
- A new base plan of an existing subscription works too: it is added to that subscription.
## The check names every problem with its line
When you upload a file, RevenueDot reads the store again and checks the whole file. A file with problems is kept with the status **Has errors**, and the page lists every problem (up to 500) with its line number. Nothing changes in the store. Fix the file and upload it again.
**The file**
- It is not a CSV file, for example because a quote is never closed.
- It is empty, has a header but no rows, or has more than 20,000 rows. The upload itself refuses files over 1 MB.
- A column appears twice, or the first line does not name `store_identifier`, `territory`, `currency` and `price`.
- It changes nothing, because every price already matches the store.
**A row**
- `store_identifier` is empty or has a space in it.
- `action` is not `create`, `update` or empty.
- The product is not in the store for this app. Check the identifier, or set `action` to `create` to add it. On Google Play, a subscription ID without a base plan gets a hint with the right `subscription_id:base_plan_id`.
- `action` is `create`, but the product already exists. Leave `action` empty to change its prices.
- The product is a Google Play one-time product, or another product the product editor cannot change.
- The territory is not a three-letter App Store code (or a two-letter Google Play code), or the store does not sell in it.
- The currency is empty or is not the territory's currency, for example `EUR` for `GBR`.
- The price is not a number such as 9.99 (use a dot for decimals and no thousands separators, also in spreadsheets that write `10,99`), has more decimals than the currency allows, is 0 or less, or is above 100,000,000. A price left as it was downloaded always counts as unchanged.
- The same product and territory appear twice. The error names both lines.
- A new product has no price, or a row of it has no territory, currency or price.
- A new product breaks a rule from the list above: an invalid ID, an unknown type, a missing period, group or name, a name that is too long, or values that differ from its first row.
- A new product's name or group has characters that could not be read, because the file was not saved as UTF-8 (Excel's plain **CSV** format on Windows). Save it as **CSV UTF-8** and upload it again.
### Notes do not stop a commit
The review also lists notes to check. They never block the file:
- A column RevenueDot does not use.
- A row with a territory but no price, which changes nothing.
- A new name, type, period or group for an existing product, which is ignored.
- A price that changes by more than 50%, in case it is a typo.
- A new subscription priced in fewer territories than the store has.
## 2. Review every change before it reaches the store
A valid file gets the status **Ready to commit**. The page shows:
- Four counts: price changes, new products, unchanged rows and products.
- One table per product with each territory's current price, the new price and the change in percent ("new" for a new territory or a new product).
- The notes to check.
Two store rules decide who pays the new price:
- **App Store subscriptions** keep existing subscribers on their current price by default. This is Apple's `preserveCurrentPrice` option, shown as **Keep existing subscribers on their current price**. Turn it off to move existing subscribers to the new price too; Apple tells them about an increase first and asks some of them to agree ([Apple's rules](https://developer.apple.com/help/app-store-connect/manage-subscriptions/manage-pricing-for-auto-renewable-subscriptions)). The option does not apply to in-app purchases.
- **Google Play base plan prices** apply to new subscribers. Existing subscribers keep their price until you move them to the new price in Play Console ([Google's price changes](https://developer.android.com/google/play/billing/price-changes)).
**Discard file** removes a file you do not want to commit. Nothing was sent to the store.
## 3. Commit sends each change to the store
Click **Commit N changes to App Store Connect** (or **to Google Play**) and confirm. RevenueDot works through the file one product at a time, and each row ends **Committed** or **Failed** with the store's message. The file ends **Committed**, **Partly committed** or **Failed**. Afterwards RevenueDot reads the store again, so the Products page shows the new prices.
### App Store prices use Apple's price points
- **Subscriptions:** for each territory, RevenueDot finds Apple's price point with exactly that customer price and schedules it with no start date, so Apple applies it as soon as it can. A price that has no price point fails, and the message names the two nearest App Store prices. Upload a new file with one of them. Apple keeps one scheduled price change per territory, and a new price replaces it, so a territory with a price change scheduled for a later date is left alone: its row fails and says so. Change that price in App Store Connect, or remove the scheduled change and retry. Dates follow App Store Connect, which counts days in US Pacific time.
- **In-app purchases** (consumable, non-consumable and non-renewing): RevenueDot sends one price schedule per product with its base territory and every manual price: the ones it already had plus the ones you changed. Manual prices nobody changed stay as they are, and territories without a manual price keep following the base territory's price. A new in-app purchase gets the United States as its base territory when the file prices it there, else the first territory in the file. Writing a schedule replaces the whole schedule, so an in-app purchase that has a price change scheduled for a later date in App Store Connect is left alone: its rows fail and name the territories with the scheduled change. Change its prices in App Store Connect, or remove the scheduled change and retry. Changing the base territory's price also moves Apple's automatic prices in every territory without a manual price; the review notes it for the in-app purchase's real base territory, which may differ from the United States.
### Google Play changes one subscription at a time
RevenueDot sends one update per subscription with the changed regional prices of its base plans, and sends the rest of the subscription back as it was. All rows of one subscription share that update's result, except rows that were already at their price.
### New products are created, then priced
- **App Store:** RevenueDot finds the app in App Store Connect by its bundle ID, creates the subscription in its group (or the in-app purchase), and then sets its prices as above. Add a review screenshot and localizations in App Store Connect before you submit it for review.
- **Google Play:** RevenueDot creates the subscription with its base plan and regional prices, or adds the base plan to the existing subscription, and then activates the base plan. When the activation fails, the row says so and the base plan stays a draft; retry, or activate it in Play Console. A base plan that someone created in Play Console after the file was uploaded is left alone: RevenueDot does not change its prices or activate it, and its rows fail and say so.
- Every new product is added to RevenueDot's catalog, like an [import](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md). Attach it to an entitlement and a package to sell it.
### Details that matter for large files
- Rows that share one store call share its result. On the App Store those are the rows of one in-app purchase; on Google Play, the rows of one subscription.
- A row whose store price already equals the new price succeeds without a write and says "Already at this price."
- A row whose store price changed after the upload (it is neither the file's current price nor its new one, because someone changed it in App Store Connect or Play Console meanwhile) is not written: it fails and names both prices. Upload a new file to change it.
- When the store refuses the key during a commit, every remaining row fails with that message. Rows written before the refusal keep their result.
- One commit request writes for up to 20 seconds. The dashboard keeps going until every row has a result, and it continues when you open the file again; another tab follows its progress. Only one file of an app commits at a time, because price schedules and Play subscriptions are read, changed and written back whole: a second file of the same app waits until the first is done.
## Failed rows can be retried
**Retry N failed** sets the failed rows back to pending and commits them again. Rows that went through are not sent again, and new products are not created twice, even when the store created one but its answer never arrived.
## The Files tab keeps every upload
The **Files** tab lists every file uploaded for the app, newest first: its name, when and by whom it was uploaded (an email, or "API key"), its status (**Has errors**, **Ready to commit**, **Committing**, **Committed**, **Partly committed** or **Failed**), the number of changes or errors, and the results. Open a file to see its review or its results again.
## The audit log records every store write
Find these in **Project settings → Audit logs**, or with `GET /v2/projects/{project_id}/audit_logs`:
| Entry | Written when |
|---|---|
| `product_edit_created` | A file is uploaded |
| `product_edit_updated` | The App Store option changes |
| `product_edit_deleted` | A file is discarded |
| `product_edit_commit` | A commit request runs |
| `product_edit_retry` | A retry runs |
| `store_price_changed` | One per row that gets a result, with the app, store, file id, line, territory, currency, old and new price, and the result (and the error when it failed) |
| `store_product_created` | One per new product created in the store, with the app, store, file id, the store's id, type, period and name |
## Admins and developers commit; viewers read and download
- **Admins and developers** (API permission `project_configuration:products:read_write`) upload files, change the option, commit, retry, discard files and refresh prices.
- **Viewers** (`project_configuration:products:read`) see the product list, download the CSV and read past files.
## With the API
Every step of the dashboard is an API call. The reference is under [Store prices and product editor](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#store-prices-and-product-editor).
Download the file for two products, or pass `all=true` for every product the product editor can change:
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/store_products/export.csv?store_identifiers=pro_monthly,pro_annual" \
-H "Authorization: Bearer $SECRET_KEY" -o products.csv
```
Upload it after editing. The answer is 201 with the checked file: `status` is `ready` with every change in `rows`, or `invalid` with every problem in `errors`:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/product_edits" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d "$(jq -n --arg app "$APP_ID" --rawfile csv products.csv '{app_id: $app, file_name: "products.csv", csv: $csv}')"
```
```json
{
"object": "product_edit", "id": "pedit3k9x2m7q1z8w4c", "app_id": "app1a2b3c4d", "store": "app_store", "status": "ready",
"errors": [], "warnings": [],
"summary": { "price_changes": 1, "new_products": 0, "new_product_prices": 0, "unchanged": 2, "products": 1, "rows": 3 },
"options": { "preserve_current_price": true },
"results": { "pending": 1, "succeeded": 0, "failed": 0 },
"rows": [
{ "object": "product_edit_row", "idx": 0, "kind": "price_change", "line": 2, "store_identifier": "pro_monthly", "territory": "USA", "currency": "USD",
"old_amount_micros": 9990000, "new_amount_micros": 10990000, "change_percent": 10, "product": null, "status": "pending", "error": null, "attempts": 0, "updated_at": null }
]
}
```
To move existing App Store subscribers to the new price, turn the option off before you commit:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/product_edits/$EDIT_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" -d '{"preserve_current_price":false}'
```
Commit. One request writes for up to 20 seconds and answers `committing` while rows are left, so call it until the status changes:
```bash
while :; do
STATUS=$(curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/product_edits/$EDIT_ID/actions/commit" \
-H "Authorization: Bearer $SECRET_KEY" | jq -r .status)
[ "$STATUS" != "committing" ] && break
done
echo "$STATUS" # committed, partially_committed or failed
```
Retry the failed rows, read one file with every row's result, or list the files of an app:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/product_edits/$EDIT_ID/actions/retry" -H "Authorization: Bearer $SECRET_KEY"
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/product_edits/$EDIT_ID" -H "Authorization: Bearer $SECRET_KEY"
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/product_edits?app_id=$APP_ID" -H "Authorization: Bearer $SECRET_KEY"
```
`DELETE /v2/projects/{project_id}/product_edits/{edit_id}` discards a file that was never committed.
What the errors mean:
- **400** `parameter_error`: `csv` is empty or larger than 1 MB, `app_id` is not an app of the project, the download has neither `store_identifiers` nor `all=true` (or more than 2,000 identifiers), or `preserve_current_price` was sent for a Google Play file.
- **403**: the key lacks `project_configuration:products:read_write` (or `:read` for reads).
- **404**: the app or the file is not in the project.
- **409** `invalid_request`: the file has errors, is already committed, has no failed row to retry, or can no longer be changed or discarded. **409** `resource_locked_error`: a commit of the same file, or of another file of the same app, is running.
- **422** `unprocessable_entity_error`: the app is not an App Store, Mac App Store or Google Play app, or its key is missing or refused. The message names the key and the role or permission. **422** `store_error` with `retryable: true`: the store could not be reached; try again later.
A file with problems is not an error: it answers 201 with `status: "invalid"`.
## Store prices and status on the Products page
**The Products page shows what App Store Connect and Google Play charge for each product, and each product's state in the store.**
- **Price and period as the row label.** Each product row leads with its price and period, such as `$89.99/year` or `$3.99/week` (one-time products show the price alone), with the store identifier under it. Products with no known price show their name or identifier.
- **Status column.** The store's state: **Approved**, **Ready to submit**, **Waiting for review**, **In review**, **Rejected**, **Developer action needed**, **Missing metadata** or **Removed from sale** for App Store review, and **Active**, **Draft** or **Inactive** for Google Play base plans. Test Store products show "Test Store". A dash means the store was not read yet.
- **Refresh.** Each App Store and Google Play app group says where its prices come from and when they were read, such as "Prices and status from App Store Connect · read 5 minutes ago", with **Refresh prices** for admins and developers. When the app's key cannot read prices, the group says why and links to the app's settings. When the last read failed, it shows the error, and the prices from the read before stay.
- **Daily refresh.** RevenueDot also reads prices on every product editor download and upload, after every commit, once a day for apps not read in the last 24 hours (a few apps at a time), and the first time an admin or developer opens the Products page for an app that was never read.
- **Prices by territory.** A product's page shows its store price and store status, and a **Prices by territory** table with every territory's price, the base territory first. **Edit in Product editor** opens the product editor with that product selected.
What RevenueDot reads, with the keys from the table at the top:
- **App Store:** each subscription's current price in every territory (prices scheduled for a later date are left out), each in-app purchase's manual prices and the prices Apple sets from its base territory, and the review state.
- **Google Play:** every base plan's regional prices and its state, and one-time products' prices.
Reading never changes anything in the store. A product deleted in the store disappears on the next read.
### In the API
`expand=items.store_details` on `GET /v2/projects/{project_id}/products` (or `expand=store_details` on one product) adds `store_details`, a RevenueDot extension: the store's status, the base price and its territory, how many territories have a price, the period, and when it was read. It is null for products that were never read from App Store Connect or Google Play.
`expand=items.indicative_price` (RevenueCat's field) now also comes from the stores. RevenueDot uses the first price it knows:
1. The Test Store price set on the product.
2. The store price from the last read: the United States price when the product has one, else the in-app purchase's base territory, else the first territory with a price. `country` is `US` for a United States price, the region code for another Google Play region, and null otherwise.
3. The price of the Stripe web product.
It is null when none is known.
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/products?app_id=$APP_ID&expand=items.indicative_price&expand=items.store_details" -H "Authorization: Bearer $SECRET_KEY"
```
```json
{
"object": "product", "id": "prod1a2b3c4d5e", "store_identifier": "pro_annual", "type": "subscription", "state": "active",
"subscription": { "duration": "P1Y", "grace_period_duration": null, "trial_duration": null },
"created_at": 1790800900948, "app_id": "app1a2b3c4d", "display_name": "Pro Annual",
"indicative_price": { "object": "indicative_price", "currency": "USD", "country": "US", "amount_micros": 89990000 },
"store_details": {
"object": "store_details", "status": "approved", "store_state": "APPROVED",
"price": { "amount_micros": 89990000, "currency": "USD", "territory": "USA" },
"territories": 175, "duration": "P1Y", "display_name": "Pro Annual", "editable": true,
"refreshed_at": 1790971200000, "refresh_status": "ok"
}
}
```
`GET /v2/projects/{project_id}/store_prices` lists every cached store product with its price in every territory, and each app's last read. `POST /v2/projects/{project_id}/apps/{app_id}/store_prices/actions/refresh` reads one app again. See [List store prices](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#list-store-prices) and [Read an app's store prices again](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#read-an-apps-store-prices-again).
## Create products and offerings with AI
**New product** on the Products page and **New offering** on the Offerings page open a menu with two choices:
- **Create from scratch** opens the usual form.
- **Create with AI** asks what to create, such as "Pro: $9.99 monthly and $59.99 yearly on iOS and Android", and opens a [RevenueDot AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/revenuedot-ai.md) conversation with that request.
RevenueDot AI reads your apps, products and entitlements first, then drafts everything in one change:
- **Create products** (`create-products`) adds up to 50 products. Each has an app, a store identifier and a type, and optionally a period, a name and, on the Test Store, a price. It can also attach every product to one entitlement, which it creates when the lookup key is new. Products that already exist on their app are skipped and reported.
- **Create offering** (`create-offering`) adds an offering with its lookup key, name and metadata, its packages (RevenueCat's package IDs such as `$rc_monthly` and `$rc_annual`, or your own) and their products, and can make it the current offering. A product named by its store identifier is added once per app; names it cannot find are reported.
The approval card lists every value the change will write. **Approve** writes it once. **Deny** writes nothing. The tools call the API as you, so your role, the API's checks and the audit log apply, and the entries say "RevenueDot AI on behalf of" you.
These products are created in RevenueDot's catalog, not in the stores. To create App Store or Google Play products with their prices, add `create` rows to a product file.
**Create with AI** is greyed out, with the reason, when the server has no AI model, the project's AI setting is **Read only** or **Disabled**, or your role is Viewer. RevenueCat's dashboard offers its own assistant, Rico, for small product changes ([RevenueCat docs](https://www.revenuecat.com/docs/offerings/products-overview)).
## Related
- [Import products](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/import-products.md)
- [App Store setup](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md), [Google Play setup](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md)
- [Products and entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/products-and-entitlements.md)
- [RevenueDot AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/revenuedot-ai.md)
- [API reference: store prices and product editor](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#store-prices-and-product-editor)
---
# How do I sell my app's subscriptions on the web with Stripe?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md
Description: Connect your Stripe account with a restricted key and a webhook, add a web config, let RevenueDot create web products in Stripe, put them in an offering, then share a purchase link or publish a funnel. Buyers pay on Stripe Checkout and unlock the app with a redemption link.
RevenueDot hosts the checkout pages and runs every payment on **your own Stripe account**. Open **Web** in the dashboard and do four steps: connect Stripe, add a web config, create web products, and put them in an offering. Then share a [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) or publish a [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md). Buyers pay on Stripe Checkout. RevenueDot records the purchase like any Stripe purchase, sends the usual webhooks, and gives the buyer a [redemption link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md) that unlocks the app.
You need a Stripe account and a RevenueDot project with your app. You write no checkout code.
## How a web purchase works
1. A buyer opens a purchase link or a funnel, such as `https://api.revenuedot.app/pay/scanner/spring-sale`.
2. They pick a plan. RevenueDot creates a Stripe Checkout Session with your Stripe key and sends them to Stripe's payment page.
3. Stripe sends them back to the success page. RevenueDot reads the session from Stripe and records the purchase.
4. The success page shows **Open the app** and the store buttons. The buyer also gets the link by email.
5. The app opens the redemption link and calls `redeemWebPurchase`. The purchase moves to the app's user and the entitlement is active.
When the page already knows the buyer's app user id (`?app_user_id=` on a purchase link, or the iOS SDK's web checkout), step 5 is not needed: the purchase goes straight to that user.
## 1. Connect Stripe
On the **Web** page, click **Add web provider** and pick Stripe. Or create a Stripe app with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Scanner Web","type":"stripe"}'
```
Then give the app a **restricted key** and add the Stripe webhook (below). **On RevenueDot Cloud this is the only way today:** Connect with Stripe is not available there yet. On a self-hosted server whose operator has set up a Stripe Connect platform, you can instead select **Connect with Stripe** on the app's page and allow RevenueDot in Stripe: no keys and no webhook to set up. See [Connect with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe-connect.md).
Create a **restricted key** in the [Stripe Dashboard → Developers → API keys](https://dashboard.stripe.com/apikeys/create). Web billing needs more than [tracking Stripe subscriptions](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md) does, because RevenueDot creates products, prices, Checkout Sessions, coupons and promotion codes in your account:
| Stripe resource | Permission |
|---|---|
| Products | Write |
| Prices | Write |
| Checkout Sessions | Write |
| Coupons | Write |
| Promotion Codes | Write |
| Subscriptions | Read |
| Invoices | Read |
| Charges | Read |
| Customers | Read |
Leave everything else at None. Save the key on the Stripe app page, or with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"stripe":{"stripe_secret_key":"rk_test_…"}}'
```
**Check credentials** on the app page tests the read permissions. It does not test the write permissions: a key without them fails when you create the first web product, with a 422 `store_error` that says the key needs write access to Products and Prices.
### Add the Stripe webhook
Use the same webhook endpoint as the [Stripe guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md#3-add-the-webhook-endpoint): `https://<your server>/v1/notifications/stripe/{app_id}`, with its signing secret saved as `stripe_webhook_secret`. **Select `checkout.session.completed`.** Add `checkout.session.async_payment_succeeded` too if you accept payment methods that confirm later, such as bank debits.
The webhook is your backup for the success page. A buyer who closes the tab after paying still gets the purchase, because the webhook records it. A session that RevenueDot's checkout created is always recorded, even when **Track new purchases** is off.
## 2. Add a web config
The web config sets how the pages look and what happens after payment. One config per Stripe app. On the **Web** page, open the provider's menu and click **Add web config**.
| Field | What it does |
|---|---|
| `app_name` | Shown at the top of every page. Default: the Stripe app's name |
| `logo_url` | Logo at the top of every page |
| `theme` | `background`, `text`, `accent` and `button_text` as `#RRGGBB`, and `corner_radius` from 0 to 24. Presets: Ink, Night, Ocean, Forest, Sunset |
| `terms_url`, `privacy_url` | Links at the bottom of every page |
| `support_email` | A Support link on the pages, and the reply-to address of the redemption email |
| `success_mode` | `show_redemption` (RevenueDot's success page) or `redirect` (your own page) |
| `success_redirect_url` | Required for `redirect`. RevenueDot answers 303 to it and adds `redemption_url` to the query |
| `success_title`, `success_body` | The success page's title and text |
| `cancel_url` | Where a cancelled checkout goes. Default: back to the page, which says "Checkout was cancelled" |
| `app_scheme` | Your app's URL scheme for [redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md), such as `scanner`. Default: `rd-` and 10 hex characters. Schemes a browser opens itself (`https`, `javascript`, `mailto` and the like) are refused |
| `app_store_url`, `play_store_url` | Store buttons on the success and redemption pages |
| `redemption_link_hours` | How long a redemption link works, 1 to 720. Default 24 |
Every URL must be https. With the API, send only the fields you change:
```bash
curl -s -X PUT "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/web_config" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"app_name":"Scanner","support_email":"help@scanner.example","terms_url":"https://scanner.example/terms","privacy_url":"https://scanner.example/privacy","app_scheme":"scanner","app_store_url":"https://apps.apple.com/app/id123","play_store_url":"https://play.google.com/store/apps/details?id=com.example.scanner"}'
```
```json
{"object":"web_config","app_id":"appstrp8k2m9q4","saved":true,"updated_at":1790801342625,"app_name":"Scanner","logo_url":null,"theme":{"background":"#FFFFFF","text":"#0A0A0A","accent":"#0A0A0A","button_text":"#FFFFFF","corner_radius":0},"terms_url":"https://scanner.example/terms","privacy_url":"https://scanner.example/privacy","support_email":"help@scanner.example","success_mode":"show_redemption","success_redirect_url":null,"success_title":null,"success_body":null,"cancel_url":null,"app_scheme":"scanner","app_store_url":"https://apps.apple.com/app/id123","play_store_url":"https://play.google.com/store/apps/details?id=com.example.scanner","redemption_link_hours":24,"presets":["…"]}
```
`GET` on the same path returns the config, or the defaults with `saved: false` before the first save.
## 3. Create web products
A web product is a price you sell on the web. On the **Web** page, open the provider's menu and click **Create web product**. RevenueDot then, with your key:
1. Creates a **Stripe Product** named after the web product, with `metadata.revenuedot_project` set to your project id.
2. Creates a **Stripe Price** on it: the amount and currency, and for a subscription the billing period.
3. Creates a RevenueDot product whose **`store_identifier` is the Stripe price id** (`price_…`). Stripe purchases of that price map to this product, so each price is its own product.
4. Attaches it to the entitlements you pick.
Billing periods are `P1W` (week), `P1M` (month), `P3M` (3 months), `P6M` (6 months) and `P1Y` (year). `trial_days` adds a free trial to each checkout; it is not stored on the Stripe price. `type` is `subscription`, `consumable` or `non_consumable` (one-time prices).
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID/web_products" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"display_name":"Pro monthly","type":"subscription","price":{"amount":9.99,"currency":"USD"},"duration":"P1M","trial_days":7,"entitlement_ids":["entl1a2b3c4d5e"]}'
```
```json
{"object":"web_product","product":{"object":"product","id":"prod1a2b3c4d5e6f7g","store_identifier":"price_1QxR2nKc8Hn4AbCd","type":"subscription","state":"active","subscription":{"duration":"P1M","grace_period_duration":null,"trial_duration":null},"one_time":{"is_consumable":null},"created_at":1790800901115,"app_id":"appstrp8k2m9q4","display_name":"Pro monthly"},"stripe_product_id":"prod_RqA1b2C3d4E5f6","stripe_price_id":"price_1QxR2nKc8Hn4AbCd","price":{"amount":9.99,"amount_minor":999,"currency":"USD"},"interval":"month","interval_count":1,"trial_days":7,"created_at":1790800901115}
```
**Already have prices in Stripe?** Send `stripe_price_id` instead of `price` and `duration`. RevenueDot reads the amount and period from Stripe and creates nothing there. The price needs a fixed amount, and its type must match: recurring for `subscription`, one-time otherwise. A second product for the same price answers 409.
List them with `GET /v2/projects/{project_id}/apps/{app_id}/web_products`.
## 4. Put web products in an offering
Pages sell an offering's packages. A package can hold one product per app, so the same package can hold your App Store product, your Google Play product and your web product. The web pages show only the packages that have a web product of the Stripe app.
```bash
# Create the offering, a package, and attach the web product.
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/offerings" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d '{"lookup_key":"web","display_name":"Go Pro on the web"}'
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/offerings/$OFFERING_ID/packages" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d '{"lookup_key":"$rc_monthly","display_name":"Monthly","position":1}'
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/packages/$PACKAGE_ID/actions/attach_products" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d '{"products":[{"product_id":"prod1a2b3c4d5e6f7g","eligibility_criteria":"all"}]}'
```
The checklist on the **Web** page is now complete. Read it with the API:
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/web" -H "Authorization: Bearer $SECRET_KEY"
```
```json
{"object":"web_overview","pay_base":"https://api.revenuedot.app/pay","project_base":"https://api.revenuedot.app/pay/scanner","checklist":{"connect_stripe":true,"web_config":true,"web_products":true,"offering":true},"web_products":3,"offerings_with_web_products":["ofrngm2u3h89blc"],"providers":["…"],"domain":{"…":"…"}}
```
Now create a [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) or a [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md).
## The hosted checkout
A checkout starts from a purchase link, a funnel's paywall step, or the iOS SDK's paywall web checkout. RevenueDot checks the plan and any [discount](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md), then creates a Stripe Checkout Session:
- `mode` is `subscription` for a recurring price and `payment` for a one-time price, with one line item: the package's price.
- `subscription_data.trial_period_days` when the web product has a trial.
- `customer_email` when the page knows the email (`?email=`, or a funnel's email step).
- `discounts` with the code's promotion code, or the page's automatic coupon.
- `metadata` with `app_user_id`, `rd_checkout` (the web checkout id) and `rd_source`. A subscription gets the same metadata.
- `success_url` is the page's success page. `cancel_url` is the web config's `cancel_url`, or the page itself.
**Who the purchase belongs to.** When the page has an app user id, the purchase goes to that customer. Otherwise the buyer gets a new anonymous id, `$RCAnonymousID:` and 32 hex characters, and a redemption link later moves the purchase to the app's user. A funnel uses its visitor's anonymous id, unless a customer already has that id.
**How it is recorded.** The success page and the `checkout.session.completed` webhook both record the purchase; whichever comes first does it, once. Both read the session from Stripe and record it through the same path as [`POST /v1/receipts` with `X-Platform: stripe`](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md#4-post-each-purchase-from-your-backend). So you get the usual events: `INITIAL_PURCHASE` (`TRIAL` during a trial) or `NON_RENEWING_PURCHASE`, with `store: STRIPE` and `presented_offering_id` set to the offering. Renewals, cancellations and refunds then come from Stripe's webhooks as described in the [Stripe guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md#how-stripe-states-map-to-events).
**The buyer's email** becomes the customer's `$email` attribute. For an app user id that already exists, the email and funnel answers only fill in attributes the customer does not have; they never overwrite them. The redemption link is emailed to it when the server can send email. RevenueDot Cloud always can. A self-hosted server needs [SMTP settings](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email).
## The success page
After payment, Stripe sends the buyer to `<page>/success`. The page shows:
- **Paid, anonymous buyer:** the success title and text, **Open the app** (the [redemption link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md)), and the App Store and Google Play buttons.
- **Paid, buyer with an app user id:** "Your purchase is linked to your account. Open the app to use it." and the store buttons. No redemption link is needed.
- **Not confirmed yet:** "Your payment is processing. This page updates by itself." The page reloads until Stripe confirms.
With `success_mode: redirect`, the page answers 303 to your `success_redirect_url` and adds `redemption_url` (the https redemption link) to the query, so your own page can show it.
## The iOS SDK's web checkout
A RevenueCatUI paywall can have a purchase button that opens web checkout (see [Paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md)). The iOS SDK then calls `POST /rcbilling/v1/hosted-checkout` with the package. RevenueDot finds the Stripe app that sells that package and answers with a Stripe Checkout URL for the SDK's app user id. The SDK closes the page when it reaches the success or cancel URL, and the purchase is already on the customer. A package with no web product answers 400 with code 7000. Reference: [SDK endpoints](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md#start-a-hosted-web-checkout).
## Test before you go live
Use a test-mode key (`rk_test_…`), or on a server with Connect with Stripe, connect in **Test** mode. Purchases are then sandbox data, kept out of production charts, and webhooks carry `environment: SANDBOX`. Pay with [Stripe's test cards](https://docs.stripe.com/testing), such as `4242 4242 4242 4242`. For production, create a second Stripe app with a live key and its own webhook endpoint (or connected in **Live** mode) and its own web products: Stripe keeps test and live products apart.
## Not built yet
- **Paddle** as a web provider.
- **An embedded checkout** (Stripe Elements on your page) and the purchases-js Web Billing checkout for `rcb_` keys. RevenueDot's checkout is a hosted page.
- **Apple Pay domain registration** for your custom domain.
- No real Stripe account has run these flows yet. The tests run against an in-memory copy of Stripe's API. Run a purchase in Stripe test mode before you send buyers.
## Related
- [Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md), [Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md), [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md), [Web discounts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md), [Custom domains](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md)
- [Connect Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md): subscriptions from your own checkout, the webhook and the event mapping
- [Extensions: Web billing](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#web-billing)
---
# How do I share a checkout link for an offering?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md
Description: A purchase link is a hosted checkout page for one offering at /pay/<project>/<link>. Add ?app_user_id= to buy for a signed-in user, ?email= to pre-fill the email and ?code= to pre-fill a discount code. Links can expire and carry an automatic discount.
Create a **purchase link**. It is a checkout page for one offering that RevenueDot hosts, at an address such as `https://api.revenuedot.app/pay/scanner/spring-sale`. The page shows the offering's web plans, takes payment on Stripe Checkout, and ends on the success page with a redemption link. Put it in emails, ads, QR codes or your website.
First finish the four steps in [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md): Stripe connected, a web config, web products, and an offering with them.
## Create a link
In the dashboard, open **Funnels**, then **Purchase links → Create purchase link**. Pick the offering and give the link a name. With the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Spring sale","offering_id":"ofrngm2u3h89blc","slug":"spring-sale"}'
```
```json
{"object":"purchase_link","id":"plink_4k8m2q9x1z3c","name":"Spring sale","slug":"spring-sale","app_id":"appstrp8k2m9q4","offering_id":"ofrngm2u3h89blc","offering_lookup_key":"web","offering_display_name":"Go Pro on the web","discount_id":null,"expires_at":null,"disabled_at":null,"status":"active","url":"https://api.revenuedot.app/pay/scanner/spring-sale","checkouts":0,"purchases":0,"created_at":1790800901115}
```
| Field | What it does |
|---|---|
| `name` | Your name for the link. Buyers do not see it |
| `offering_id` | The offering whose packages the page sells |
| `slug` | The end of the address. Default: made from the name. 3 to 40 lower-case letters, digits or `-`, unique among the project's links and funnels. A few words are reserved, such as `api`, `r` and `success` |
| `app_id` | The Stripe app to sell through. Default: the project's first Stripe app |
| `discount_id` | An automatic [web discount](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md), applied without a code |
| `expires_at` | When the link stops working, in epoch milliseconds |
| `enabled` | `false` creates it turned off |
`checkouts` and `purchases` count the checkouts started and paid from the link.
## The URL
```
<pay base>/<project slug>/<link slug>
```
- On RevenueDot Cloud the pay base is `https://api.revenuedot.app/pay` today.
- On a self-hosted server it is `https://<your server>/pay`, or `REVENUEDOT_PAY_URL` when you set it.
- With a verified [custom domain](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md), the link is `https://<your domain>/<link slug>`.
The `url` field always holds the current address. Change the project slug or the domain, and every link follows.
### Query parameters
| Parameter | What it does |
|---|---|
| `?app_user_id=user_123` | Buys for this app user id. The purchase goes straight to that customer, so no redemption link is needed. Use it in emails or in-app links to signed-in users |
| `?email=ana@example.com` | Pre-fills the email. Stripe Checkout shows it and the receipt goes there |
| `?code=SPRING20` | Pre-fills a discount code. The page checks it at once and shows the result |
Combine them: `https://api.revenuedot.app/pay/scanner/spring-sale?app_user_id=user_123&code=SPRING20`. In the dashboard, **Copy link for a signed-in user** copies the link with an `app_user_id` placeholder.
The purchase goes to whatever `app_user_id` the link carries. Put your app's real user id there, the same one the app passes to `Purchases.logIn`.
## What the page shows
- The web config's logo, app name and colours.
- One card per package that holds a web product of the Stripe app: the package name, the price per period, and the trial ("7-day free trial, then $9.99 per month"). The plan with the lowest monthly price gets a "Save N%" badge when it saves 5% or more.
- A discount code field with a live check ("20% off for 3 months applied at checkout.").
- Your terms, privacy and support links.
A cancelled checkout returns to the page with `?canceled=1`, which says "Checkout was cancelled. Pick a plan to try again." Set `cancel_url` in the web config to send buyers elsewhere.
## Expiry and turning a link off
An expired or turned-off link answers **410** with a page that says "This link has expired". Starting a checkout from it also answers 410.
```bash
# Turn the link off, or set an expiry (null removes it).
curl -s -X PATCH "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links/plink_4k8m2q9x1z3c" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" -d '{"enabled":false}'
curl -s -X PATCH "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links/plink_4k8m2q9x1z3c" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" -d '{"expires_at":1793392914000}'
```
`status` is `active`, `expired` or `disabled`. A deleted link answers 404.
## Automatic discount
Set `discount_id` to apply a [web discount](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md) to every checkout from the link, with no code. A buyer who types a code gets the code's discount instead. The discount's own checks still apply: it must be enabled, not expired, under its cap, for the chosen plan, and the buyer must be eligible.
```bash
curl -s -X PATCH "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links/plink_4k8m2q9x1z3c" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" -d '{"discount_id":"disc8h3n1v6w0z2y4d"}'
```
## Other operations
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links" -H "Authorization: Bearer $SECRET_KEY"
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links/plink_4k8m2q9x1z3c" -H "Authorization: Bearer $SECRET_KEY"
curl -s -X DELETE "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/purchase_links/plink_4k8m2q9x1z3c" -H "Authorization: Bearer $SECRET_KEY"
```
The key needs `project_configuration:offerings:read_write` to change links. Reference: [Extensions: Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#purchase-links).
## Related
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)
- [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md): how an anonymous buyer unlocks the app
- [Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md): several steps before the plans
- [Custom domains](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md)
---
# How do I build a web-to-app funnel?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md
Description: Build a multi-step funnel (questions, info, email, paywall, success) in the dashboard or with AI, publish it to a public URL, sell on Stripe Checkout, and see where visitors drop off. Funnel events can go to webhooks, analytics tools and ad networks.
Open **Funnels** in the dashboard and click **Create funnel**. A funnel is a few screens in a row, such as a quiz, a proof point, an email field, the plans and a success page. Edit the steps in the builder, check them in the live preview, and click **Publish**. The funnel then lives at a public URL such as `https://api.revenuedot.app/pay/scanner/focus-quiz`. Visitors pay on Stripe Checkout and open the app with a [redemption link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md). The **Analytics** tab shows where they drop off.
First finish the four steps in [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md). A funnel's paywall step sells an offering's web products.
## Start a funnel
- **New funnel from the starter**: a question, an info step, an email step, the paywall and the success step, in your web config's colours.
- **New blank funnel**: the paywall and the success step only.
- **Build with AI**: describe the funnel, such as "A fitness app for beginners with an email step before the paywall". See [Build with AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md#build-with-ai).
## The builder
- **Steps** on the left: add, reorder, duplicate and delete steps.
- **Properties** in the middle: the selected step's texts and options, and the theme (colours and corner radius, with the presets Ink, Night, Ocean, Forest and Sunset).
- **Preview** on the right: the real page in a phone frame, showing the selected step with your web prices. Discount codes and payments only run on the public page.
- **Publish** (or **Publish changes**), **Unpublish**, the public URL with a copy button, and the **Analytics** tab.
Edits are saved as a draft. Visitors keep seeing the published copy until you publish again.
## Step types
| Type | What the visitor sees | Fields |
|---|---|---|
| `question` | A question with 1 to 8 answers | `options` (`id`, `label`, optional `next`), `multiple`, `attribute`, `button_label` |
| `info` | A short text, with an optional image | `body`, `image_url` (https), `button_label` |
| `email` | An email field | `placeholder`, `required` (default true), `button_label` |
| `paywall` | The offering's web plans and the pay button | `offering`, `features`, `highlight_package`, `discount_id`, `allow_codes`, `button_label` |
| `success` | The end page after payment | `body`, `show_redemption` |
Every step has an `id`, a `type`, a `title` and an optional `subtitle`.
- **Questions.** A single-choice question moves on as soon as the visitor taps an answer. With `multiple: true` the visitor picks several and taps the button.
- **Email.** The address goes to Stripe Checkout as `customer_email` and becomes the customer's `$email` attribute. The redemption link is emailed there.
- **Paywall.** `offering` is the offering's lookup key, or null for the current offering. `features` are up to 8 bullet lines. `highlight_package` is the package selected first, such as `$rc_annual`. `discount_id` applies a [web discount](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md) without a code. `allow_codes` shows the code field.
- **Success.** Shown after payment. With `show_redemption`, it shows **Open the app** and the store buttons. A visitor who arrived with `?app_user_id=` sees that the purchase is linked to their account instead.
## The funnel JSON
The builder edits a JSON document, the same one the API reads and writes:
```json
{
"theme": { "background": "#FFFFFF", "text": "#0A0A0A", "accent": "#0A0A0A", "button_text": "#FFFFFF", "corner_radius": 0 },
"steps": [
{ "id": "goal", "type": "question", "title": "What do you want to get done?", "attribute": "goal",
"options": [
{ "id": "focus", "label": "Focus on deep work" },
{ "id": "habits", "label": "Build better habits" },
{ "id": "sleep", "label": "Sleep better", "next": "sleep_tip" }
] },
{ "id": "plan", "type": "info", "title": "Your plan is ready", "body": "People with the same goal kept going 3 times longer with a daily plan." },
{ "id": "sleep_tip", "type": "info", "title": "Better sleep starts tonight", "body": "Most people fall asleep 15 minutes sooner in the first week." },
{ "id": "email", "type": "email", "title": "Where should we send your plan?", "placeholder": "you@example.com", "required": true },
{ "id": "paywall", "type": "paywall", "title": "Unlock your full plan", "offering": "web", "highlight_package": "$rc_annual",
"features": ["Your personal daily plan", "Reminders that adapt to you"], "allow_codes": true, "button_label": "Continue" },
{ "id": "success", "type": "success", "title": "You are in", "body": "Open the app to start your plan.", "show_redemption": true }
]
}
```
**Rules checked on every save:**
- 1 to 30 steps. Step ids are unique, 1 to 40 lower-case letters, digits, `-` or `_`.
- Titles up to 120 characters. Subtitles and bodies up to 600. Button labels up to 40.
- Questions have 1 to 8 options with unique ids and labels up to 80 characters.
- Every `next` names a step that exists.
- Colours are `#RRGGBB`. `corner_radius` is 0 to 24. `image_url` is https.
- An `attribute` uses letters, digits and `_ . - $`.
**Rules checked before publishing:** exactly one paywall step and exactly one success step, the paywall before the success step, and the success step last. The funnel's `problems` list says what is missing, and **Publish** stays off until it is empty.
## Paths
An answer can jump to another step: set the option's `next` to that step's id. Without `next`, the visitor goes to the next step in the list. In the example above, "Sleep better" skips to `sleep_tip`; the other answers go to `plan`. Paths work on single-choice questions. The back button returns along the path the visitor took.
## Answers become customer attributes
Give a question an `attribute`, such as `goal`. When the visitor pays, the answer is saved on the customer under that name. Only the question's own option labels are saved, so a visitor cannot write free text into an attribute. Several answers are joined with ", ". Attributes reach the app's user when the purchase is [redeemed](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md), and they appear in webhooks' `subscriber_attributes` and in the dashboard. Use them to personalize the app after sign-up.
## Publish
Click **Publish**, or call the API. A funnel needs a connected Stripe app to publish.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/funnels/fnl_7q2k9m4x1z8c/actions/publish" -H "Authorization: Bearer $SECRET_KEY"
```
The public URL is `<pay base>/<project slug>/<funnel slug>`, or `https://<your domain>/<funnel slug>` with a [custom domain](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md). A funnel's slug is unique among the project's funnels and [purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md). The page takes the same query parameters as a purchase link: `?app_user_id=`, `?email=` and `?code=`. `utm_*` parameters are kept with the funnel's events. **Unpublish** takes the page down (404) and keeps the draft.
## Events
The page records what each visitor does, once per page session:
| Event | When |
|---|---|
| `funnel_viewed` | The visitor opens the funnel |
| `step_viewed` | A step appears |
| `step_completed` | The visitor finishes a step. A question carries the answer; a paywall the package; an email step only `provided` or `skipped`, never the address |
| `checkout_started` | The paywall starts a Stripe Checkout (recorded by the server) |
| `purchase` | The checkout is paid (recorded by the server) |
### Webhooks and analytics tools
Three of them can also go to your [webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md) and [integrations](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md) as RevenueDot event types:
| Event type | Filter value | Analytics event name |
|---|---|---|
| `FUNNEL_VIEWED` | `funnel_viewed` | `rd_funnel_viewed` |
| `FUNNEL_STEP_COMPLETED` | `funnel_step_completed` | `rd_funnel_step_completed` |
| `FUNNEL_PURCHASE` | `funnel_purchase` | `rd_funnel_purchase` |
They are **opt-in**: only webhooks and integrations whose event filter names them receive them, so handlers that know only RevenueCat's event types never see them. Segment, Amplitude, Mixpanel and PostHog send them with the names above. Meta, Google Tag Manager, Branch and AppsFlyer send them to ad networks as web events, with the visitor's browser and ad click ids; see [Funnel events to ad networks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md#funnel-events-to-ad-networks).
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/integrations/webhooks" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Funnels","url":"https://api.example.com/webhooks/funnels","event_types":["funnel_viewed","funnel_step_completed","funnel_purchase","initial_purchase"]}'
```
Each event carries `funnel_id`, `funnel_name`, `funnel_slug`, `session_id`, `step_id`, `step_type`, `step_index`, `answer`, the page's `utm_*` parameters, the ad click ids from the landing URL (`click_ids`), `store: STRIPE` and the environment. `FUNNEL_PURCHASE` adds `product_id`, `revenue_usd`, `currency` and the buyer's `app_user_id`. While an integration asks for funnel events, events also carry `page_url`, and while that integration is Meta or Branch, the visitor's `client_ip` and `client_user_agent` (deleted after 7 days); otherwise no visitor IP address is stored. Visitors with Global Privacy Control on (`Sec-GPC: 1`) get none of these and no `click_ids`. Each visitor gets an anonymous app user id (`$RCAnonymousID:…`) when the page loads, unless the URL had `?app_user_id=`. Their events and their purchase use the same id, so analytics tools see one user from the first view to the purchase. `session_id` also joins one visit's events. Full fields: [Webhook events](https://raw.githubusercontent.com/revenuedot/docs/main/api/webhook-events.md#funnel_step_completed).
## Analytics
The **Analytics** tab, or the API, shows the last 7, 30 or more days:
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/funnels/fnl_7q2k9m4x1z8c/analytics?days=7" -H "Authorization: Bearer $SECRET_KEY"
```
```json
{"object":"funnel_analytics","funnel_id":"fnl_7q2k9m4x1z8c","days":7,"views":2,"checkouts":1,"purchases":1,"conversion":0.5,"revenue_usd":59.99,
"steps":[{"id":"goal","type":"question","title":"What do you want to get done?","viewed":2,"completed":1,"drop_off":0.5},"…"],
"daily":[{"date":"2026-09-30","views":2,"purchases":1},"…"]}
```
| Field | Meaning |
|---|---|
| `views` | Page sessions that opened the funnel |
| `steps[].viewed`, `steps[].completed` | Sessions that saw the step and finished it. For the success step, `completed` is purchases |
| `steps[].drop_off` | 1 minus completed divided by viewed, from 0 to 1 |
| `checkouts` | Sessions that started a Stripe Checkout |
| `purchases` | Paid checkouts |
| `conversion` | Purchases divided by views |
| `revenue_usd` | What the purchases paid, in US dollars |
| `daily` | Views and purchases per UTC day |
`days` is 1 to 365 (default 30). The funnel list shows `views_30d` and `purchases_30d`.
## Build with AI
Click **Build with AI** and describe the funnel: who it is for, the questions to ask and the offer. RevenueDot asks a language model for the funnel JSON, repairs what it can (ids, a missing paywall or success step, paths to steps that do not exist), checks it, and opens the result as a new funnel for you to edit. Nothing is published until you publish it.
It uses the same model and the same limits as [Generate with AI on paywalls](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md#ai-on-a-self-hosted-server), shared between the two: one generation every 5 seconds and 60 a day per project, 100 a day per person, and 5,000 a day per server. On RevenueDot Cloud it works without setup. On a self-hosted server it needs `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`; without one the button is hidden and the API answers 503.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/funnels/generate" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"prompt":"A sleep app quiz for people who wake up at night","app_name":"Drift"}'
```
The answer is `{ "object": "funnel_generation", "draft": {…}, "fixes": ["added a success step"], "provider", "model" }`. Create a funnel from it with `POST /funnels` and `"draft"`.
## Use the API
```bash
# Create from the starter, then change the draft and publish.
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/funnels" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d '{"name":"Focus quiz"}'
curl -s -X PATCH "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/funnels/fnl_7q2k9m4x1z8c" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d @funnel-draft.json # {"draft": {"theme": {…}, "steps": […]}}
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/funnels/fnl_7q2k9m4x1z8c/actions/publish" -H "Authorization: Bearer $SECRET_KEY"
```
`POST /funnels` takes `name`, and optionally `slug`, `app_id`, `template` (`starter` or `blank`) or a full `draft`. A draft that breaks a rule answers 400 and names the field, such as `draft.theme.accent`. Every operation: [Extensions: Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#funnels).
## Not built yet
- A/B tests of funnel steps, a template gallery, and image upload (use an https image URL).
- Adjust, Kochava, Singular, Tenjin and Airbridge do not get funnel events: they match people by mobile device ids, which a web visitor does not have.
## Related
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)
- [Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md): one page with the plans, no steps
- [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md)
- [Web discounts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md)
---
# How does a web purchase reach my app?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md
Description: An anonymous web buyer gets a redemption link, <scheme>://redeem_web_purchase?redemption_token=…. Register the scheme, pass the link to redeemWebPurchase, and the purchase moves to the app's user. The results are success, invalidToken, purchaseBelongsToOtherUser and expired.
Through a **redemption link**. A buyer who paid on the web without an app user id gets a link to open on their phone. The link opens your app, your app passes it to the SDK's `redeemWebPurchase`, and RevenueDot moves the purchase to the app's user. The entitlement is active at once, even if the buyer paid before they installed the app.
Buyers whose app user id the page already knew (`?app_user_id=` on a [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md), or the iOS SDK's web checkout) need no redemption link: their purchase is on their customer already.
## The two forms of the link
| Form | Looks like | Where it is used |
|---|---|---|
| Deep link | `scanner://redeem_web_purchase?redemption_token=rdrt_q8Xc…` | Opens the app. The SDK parses it |
| https link | `https://api.revenuedot.app/pay/r/rdrt_q8Xc…` | In emails and QR codes. It opens a page with **Open the app** (the deep link) and the App Store and Google Play buttons |
The scheme is the web config's `app_scheme` (see [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md#2-add-a-web-config)). Set it to your app's own scheme, such as `scanner`. The default is `rd-` and 10 hex characters, which works too once you register it in the app.
The buyer gets the link in three places:
- On the **success page** after payment: **Open the app**. On a phone, tapping it tries the deep link first.
- **By email**, when Stripe has the buyer's email and the server can send email. The subject is "Your Scanner purchase is ready", and replies go to the web config's `support_email`.
- On your own page, as `redemption_url`, when the web config's `success_mode` is `redirect`.
A link works for `redemption_link_hours` (default 24). The token is `rdrt_` and 43 random characters; RevenueDot stores only its SHA-256 hash.
## 1. Register the URL scheme
### iOS
Add the scheme to `Info.plist`:
```xml
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.example.scanner.redeem</string>
<key>CFBundleURLSchemes</key>
<array>
<string>scanner</string>
</array>
</dict>
</array>
```
### Android
Add an intent filter to the activity that opens the app:
```xml
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="scanner" />
</intent-filter>
</activity>
```
## 2. Redeem the link
Configure the SDK with its proxy URL pointing at RevenueDot, as usual. If your app has accounts, call `logIn` before you redeem, so the purchase lands on the signed-in user.
### iOS (Swift)
```swift
// RevenueDot: the RevenueCat SDK parses the redemption link and calls POST /v1/subscribers/redeem_purchase.
// Docs: https://revenuedot.app/docs/guides/redemption-links
import RevenueCat
import SwiftUI
struct ContentView: View {
var body: some View {
HomeView()
.onOpenURL { url in
// Only redemption links parse; other deep links return nil.
guard let redemption = url.asWebPurchaseRedemption else { return }
Task {
switch await Purchases.shared.redeemWebPurchase(redemption) {
case let .success(customerInfo):
print("Unlocked:", customerInfo.entitlements.active.keys)
case let .error(error):
print("Try again later:", error.localizedDescription)
case .invalidToken:
print("This link is not valid.")
case .purchaseBelongsToOtherUser:
print("This purchase is already linked to another account.")
case let .expired(obfuscatedEmail):
print("This link expired. We sent a new one to \(obfuscatedEmail).")
}
}
}
}
}
```
`Purchases.parseAsWebPurchaseRedemption(_:)` does the same as `url.asWebPurchaseRedemption`. In Objective-C or completion-handler code, call `redeemWebPurchase(webPurchaseRedemption:completion:)`. In a UIKit app, handle the URL in `scene(_:openURLContexts:)`.
### Android (Kotlin)
```kotlin
// RevenueDot: the RevenueCat SDK parses the redemption link and calls POST /v1/subscribers/redeem_purchase.
// Docs: https://revenuedot.app/docs/guides/redemption-links
import com.revenuecat.purchases.Purchases
import com.revenuecat.purchases.asWebPurchaseRedemption
import com.revenuecat.purchases.interfaces.RedeemWebPurchaseListener
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
redeem(intent)
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
redeem(intent)
}
private fun redeem(intent: Intent) {
// Only redemption links parse; other intents return null.
val redemption = intent.asWebPurchaseRedemption() ?: return
Purchases.sharedInstance.redeemWebPurchase(redemption) { result ->
when (result) {
is RedeemWebPurchaseListener.Result.Success -> showUnlocked(result.customerInfo)
is RedeemWebPurchaseListener.Result.Error -> showError(result.error.message)
RedeemWebPurchaseListener.Result.InvalidToken -> showError("This link is not valid.")
RedeemWebPurchaseListener.Result.PurchaseBelongsToOtherUser -> showError("This purchase is already linked to another account.")
is RedeemWebPurchaseListener.Result.Expired -> showError("This link expired. We sent a new one to ${result.obfuscatedEmail}.")
}
}
}
}
```
`Purchases.parseAsWebPurchaseRedemption(url)` parses a URL string instead of an intent.
### React Native and Flutter
Both call the same endpoint. In React Native, `await Purchases.parseAsWebPurchaseRedemption(url)` returns the redemption, and `await Purchases.redeemWebPurchase(redemption)` redeems it. Flutter has the same two methods on `Purchases`.
## What each result means
The SDK calls `POST /v1/subscribers/redeem_purchase` with `{ "app_user_id", "redemption_token" }` and the app's public key.
| SDK result | Server answer | What happened |
|---|---|---|
| `success` | 200, customer info | The purchase is on the app's user. A second redeem by the same customer also succeeds, so a retry is safe |
| `invalidToken` | 400, code 7849 | The token is unknown, malformed or from another project |
| `purchaseBelongsToOtherUser` | 400, code 7852 | Another customer already redeemed it. When two app users redeem one link at the same moment, exactly one gets the purchase and the other gets 7852. The https link page says "Already unlocked" |
| `expired` | 400, code 7853 | The link is older than `redemption_link_hours`, or a newer link replaced it. RevenueDot emails a new link and answers the address in a hidden form, such as `t***@e*****e.com` |
| `error` | 401, 5xx, no network | Show an error and let the buyer try again |
```json
{"code":7853,"message":"The link has expired.","purchase_redemption_error_info":{"obfuscated_email":"t***@e*****e.com"}}
```
**About expired links.** Redeeming an expired link emails a fresh link and answers `expired`. The old link keeps answering `expired`, so the app can always tell the buyer to check their email. A new email goes out at most once an hour per purchase. If the buyer gave no email, the answer has no `purchase_redemption_error_info` and no email is sent; ask them to contact support.
## What redeeming does
The anonymous customer who paid on the web (`$RCAnonymousID:…`) is merged into the app's user, the same way `logIn` merges an anonymous customer. Purchases and attributes move over, including `$email` and the answers from a [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md). If the app's user already has purchases, it keeps them and gains the web purchase. The SDK gets the updated customer info, so the entitlement is active at once.
RevenueDot then sends **`PURCHASE_REDEEMED`** to your [webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md) and integrations, once:
```json
{"api_version":"1.0","event":{"type":"PURCHASE_REDEEMED","id":"5B2E8C1D-9F3A-4E7B-A6C0-1D2E3F4A5B6C","app_id":"appstrp8k2m9q4","event_timestamp_ms":1790801342625,"store":"STRIPE","environment":"SANDBOX","redeemed_from":["$RCAnonymousID:7c1e9b2f4a6d48e3b05f9a8c2d1e3f47"],"redeemed_by":["user_1"],"redemption_outcome":"alias","redemption_platform":"ios","product_id":"price_1QxR2nKc8Hn4AbCd","entitlement_ids":["pro"],"workflow_id":"fnl_7q2k9m4x1z8c","workflow_step_id":null,"trace_id":"wco_8k2m9q4x7a1b3c5d","app_user_id":"user_1"}}
```
The fields follow RevenueCat's sample payload. `workflow_id` is the funnel id when the purchase came from a funnel, `trace_id` is the web checkout id, and `app_user_id` (a RevenueDot addition) is the user who redeemed it. Every field: [Webhook events](https://raw.githubusercontent.com/revenuedot/docs/main/api/webhook-events.md#purchase_redeemed).
## Test it
1. Buy with a test-mode Stripe key and the card `4242 4242 4242 4242`, without `?app_user_id=`.
2. Copy the deep link from the https link page, or the email.
3. Open it on a simulator: `xcrun simctl openurl booted "scanner://redeem_web_purchase?redemption_token=rdrt_…"` on iOS, or `adb shell am start -a android.intent.action.VIEW -d "scanner://redeem_web_purchase?redemption_token=rdrt_…"` on Android.
4. The app should show the entitlement, and the customer's history in the dashboard shows the purchase and `PURCHASE_REDEEMED`.
## Related
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)
- [Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) and [Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md)
- [iOS SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/ios.md), [Android SDK](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md)
- [SDK endpoints: redeem a web purchase](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md#redeem-a-web-purchase)
---
# How do I give discounts at web checkout?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-discounts.md
Description: Web discounts use RevenueCat's v2 discount fields and operations. Each discount is a Stripe coupon and each code a Stripe promotion code in your own account. Checkout checks that it is enabled, not expired, under its cap, for the plan, and that the buyer is eligible.
Create a **web discount**. It takes a percentage or a fixed amount off the first payment, every payment for some months, or every payment. Buyers use it in two ways: they type a **code** on a [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) or a [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md), or the page applies it **automatically**. RevenueDot creates each discount as a **Stripe coupon** and each code as a **Stripe promotion code** in your own Stripe account, so the discount shows on Stripe Checkout, the invoices and the receipts.
In the dashboard: **Product catalog → Web discounts → Create discount**. With the API, use RevenueCat's v2 discount operations, which RevenueDot implements with the same fields and answers.
## Discount fields
| Field | Values | Stripe coupon |
|---|---|---|
| `identifier` | Your id, unique in the project. Letters, digits, `_ . -` | `metadata.revenuedot_identifier` |
| `customer_facing_name` | What buyers see, such as "Spring sale" | `name` (first 40 characters) |
| `type` | `percentage` or `fixed_amount` | |
| `percentage` | 1 to 100, for `percentage` | `percent_off` |
| `fixed_amounts` | Amount off per currency, for `fixed_amount`: `{"USD":{"currency":"USD","amount":5}}` | `amount_off` and `currency` for USD (or else the first currency in alphabetical order), `currency_options` for the others |
| `duration_mode` | `one_time`, `time_window` or `forever` | `duration`: `once`, `repeating`, `forever` |
| `time_window` | For `time_window`: whole months or years, `P1M` to `P3Y` | `duration_in_months` |
| `eligibility` | `everyone`, `never_purchased`, `never_subscribed`, `never_subscribed_to_the_same_product` | Checked by RevenueDot |
| `product_identifiers` | The plans it applies to: a web product's store identifier (its Stripe price id) or its RevenueDot product id (`prod…`). Empty: every plan | `applies_to.products` |
| `max_redemptions` | RevenueDot addition. Paid checkouts it may be used in, across all codes | `max_redemptions` |
| `expires_at` | RevenueDot addition. The last moment it works, in epoch milliseconds | `redeem_by` (and `expires_at` on each promotion code) |
These are the field names of [RevenueCat's v2 discount operations](https://www.revenuecat.com/docs/api-v2), so existing scripts keep working. RevenueCat's `Discount` answer has no room for `max_redemptions` and `expires_at`, so read them back with the extension `GET /v2/projects/{project_id}/web_discounts`.
A fixed amount only applies to payments in the currencies it lists. A plan in another currency refuses it. Stripe repeats a coupon by whole months, so `time_window` accepts months and years only, up to 36 months.
## Create a discount and its codes
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/discounts" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"identifier":"spring20","customer_facing_name":"Spring sale","type":"percentage","percentage":20,"duration_mode":"time_window","time_window":"P3M","eligibility":"everyone","max_redemptions":100}'
```
```json
{"object":"discount","id":"disc5k2m9q4x7a1b3c","identifier":"spring20","customer_facing_name":"Spring sale","duration_mode":"time_window","eligibility":"everyone","time_window":"P3M","disabled_at":null,"type":"percentage","percentage":20,"created_at":1790800901115,"updated_at":1790800901115}
```
RevenueDot creates the coupon in every Stripe app of the project that has a key. Then add codes. Each becomes a Stripe promotion code:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/discounts/disc5k2m9q4x7a1b3c/discount_codes" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"codes":["SPRING20","friends"]}'
```
```json
[{"object":"discount_code","code":"SPRING20","created_at":1790800901115},{"object":"discount_code","code":"friends","created_at":1790800901115}]
```
Codes use letters, digits, `_` and `-`. They are unique in the project and buyers can type them in any case: `spring20` works for `SPRING20`, and `spring20` cannot be added as a second code (409).
A fixed amount in two currencies:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/discounts" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"identifier":"five_off","customer_facing_name":"$5 off","type":"fixed_amount","fixed_amounts":{"USD":{"currency":"USD","amount":5},"EUR":{"currency":"EUR","amount":4.5}},"duration_mode":"one_time","eligibility":"never_purchased"}'
```
## Apply it without a code
Set the discount as a purchase link's `discount_id`, or a funnel paywall step's `discount_id`. Every checkout from that page then gets the coupon. A buyer who types a code gets the code's discount instead.
## What checkout checks
When a buyer types a code, the page checks it at once and shows the answer. Checkout checks again before it creates the Stripe Checkout Session:
| Check | The buyer sees |
|---|---|
| The code exists in the project | "This code is not valid." |
| The discount is enabled | "This code is no longer active." |
| `expires_at` has not passed | "This code has expired." |
| Paid checkouts plus open checkouts are fewer than `max_redemptions` | "This code has been used the maximum number of times." |
| The plan is in `product_identifiers` (when set) | "This code does not apply to this plan." |
| A fixed amount lists the plan's currency | "This code does not apply to payments in EUR." |
| The buyer is eligible | "This code is for new customers only." |
**Eligibility** uses the purchase history of the buyer's app user id. `never_purchased` refuses anyone with any purchase. `never_subscribed` refuses anyone with a subscription. `never_subscribed_to_the_same_product` refuses anyone who had a subscription to the plan's product. An anonymous buyer (no `?app_user_id=`) has no history, so they are always eligible.
A valid code goes to Stripe as the session's promotion code; an automatic discount as its coupon. A use counts once the checkout is paid. The extension list shows `times_redeemed` per discount and per code.
**A capped discount cannot be overrun.** With `max_redemptions` set, each checkout that starts holds one use, and its Stripe Checkout page expires after 31 minutes. Buyers who start at the same moment cannot all take the last use. An abandoned checkout gives its use back once its page has expired.
## Edit, disable and delete
Send only what changes:
```bash
curl -s -X PATCH "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/discounts/disc5k2m9q4x7a1b3c" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" -d '{"percentage":30}'
```
- **A new coupon replaces the old one.** Stripe coupons cannot change their amount or duration. So a change to `type`, `percentage`, `fixed_amounts`, `duration_mode`, `time_window`, `product_identifiers`, `max_redemptions` or `expires_at` creates a new coupon and new promotion codes for the same codes, and turns the old promotion codes off. The new coupon's Stripe `max_redemptions` is the uses that are left. Subscriptions that already use the old coupon keep it. A new name or eligibility changes nothing in Stripe.
- **Disable** (`POST …/discounts/{id}/actions/disable`) refuses the discount at checkout and turns its promotion codes off. **Enable** (`…/actions/enable`) turns them back on.
- **Delete a code** (`DELETE …/discount_codes/{code}`) turns its promotion code off.
- **Delete the discount** (`DELETE …/discounts/{id}`) turns its promotion codes off and deletes its coupons. Existing subscriptions keep their discount, as in Stripe.
When Stripe cannot be reached, a write answers 422 `store_error` with `retryable: true` and saves nothing, like the other store operations.
## See settings, uses and Stripe ids
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/web_discounts" -H "Authorization: Bearer $SECRET_KEY"
```
```json
{"object":"list","items":[{"object":"web_discount","id":"disc5k2m9q4x7a1b3c","identifier":"spring20","customer_facing_name":"Spring sale","type":"percentage","percentage":20,"duration_mode":"time_window","time_window":"P3M","eligibility":"everyone","disabled_at":null,"label":"20% off for 3 months","product_identifiers":[],"max_redemptions":100,"expires_at":null,"times_redeemed":1,"status":"active","stripe":[{"app_id":"appstrp8k2m9q4","coupon_id":"Zx81kQ2p"}],"codes":[{"code":"SPRING20","times_redeemed":1,"created_at":1790800901115,"stripe_promotion_codes":{"appstrp8k2m9q4":"promo_1QxS0aKc8Hn4AbCd"}}],"created_at":1790800901115,"updated_at":1790800901115}],"next_page":null,"url":"/v2/projects/proj18pzzkao/web_discounts"}
```
`status` is `active`, `disabled`, `expired` or `used_up`. `label` is how checkout describes it.
## All operations
| Operation | Path |
|---|---|
| List, create | `GET`, `POST /v2/projects/{project_id}/discounts` |
| Get, update, delete | `GET`, `PATCH`, `DELETE /v2/projects/{project_id}/discounts/{discount_id}` |
| Enable, disable | `POST …/discounts/{discount_id}/actions/enable`, `…/actions/disable` |
| List codes, create codes | `GET`, `POST …/discounts/{discount_id}/discount_codes` |
| Delete a code | `DELETE …/discounts/{discount_id}/discount_codes/{discount_code}` |
| Settings, uses and Stripe ids (extension) | `GET /v2/projects/{project_id}/web_discounts` |
Keys need `project_configuration:discounts:read` or `:read_write`. Reference: [REST API v2: Discounts](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#discounts).
Web discounts apply to RevenueDot's web checkout only. App Store and Google Play offers are set up in those stores: see [Win-back offers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/win-back-offers.md) for Apple's.
## Related
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)
- [Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md) and [Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md)
---
# Where do my purchase links and funnels live, and can I use my own domain?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md
Description: Hosted pages live at <pay base>/<project slug>/<page>, which is https://api.revenuedot.app/pay on Cloud and your server's /pay (or REVENUEDOT_PAY_URL) when self-hosted. A custom domain needs a CNAME, a TXT record and Verify; on Cloud, TLS is then added by hand.
By default, every [purchase link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md), [funnel](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md) and [redemption link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md) lives on RevenueDot's address: `<pay base>/<project slug>/<page slug>`. You can move them to a domain you own, such as `pay.yourapp.com`: add two DNS records, click **Verify**, and the pages answer at `https://pay.yourapp.com/<page slug>`. On RevenueDot Cloud there is one more step, done by the RevenueDot team by hand for now: adding the domain's TLS certificate.
Both settings are in **Project settings → Domains**.
## The default address
| Where RevenueDot runs | Pay base | Example page |
|---|---|---|
| RevenueDot Cloud | `https://api.revenuedot.app/pay` | `https://api.revenuedot.app/pay/scanner/spring-sale` |
| Self-hosted | `https://<your server>/pay` | `https://revenuedot.example.com/pay/scanner/spring-sale` |
| Self-hosted with `REVENUEDOT_PAY_URL` | The value you set | `https://pay.example.com/scanner/spring-sale` |
- **Project slug.** Each project gets one from its name, such as `scanner`. Change it under **Project address**; it must be unique on the server. Every link and funnel follows at once, and the old address stops working.
- **Redemption links** live at `<pay base>/r/<token>`, outside any project.
- **`REVENUEDOT_PAY_URL`** (self-hosted) moves every project's pages. With a path, such as `https://api.example.com/pay`, pages live under it. Without a path, such as `https://pay.example.com`, the server answers that host at its root: point the host at the same server.
```bash
curl -s "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/web_domain" -H "Authorization: Bearer $SECRET_KEY"
curl -s -X PUT "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/web_domain" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d '{"slug":"scanner"}'
```
## Use your own domain
Use a subdomain you own, such as `pay.yourapp.com`. A CNAME cannot sit on a bare domain such as `yourapp.com` at most DNS providers.
1. In **Project settings → Domains**, enter the domain and click **Save domain**. Or with the API:
```bash
curl -s -X PUT "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/web_domain" -H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" -d '{"custom_domain":"pay.yourapp.com"}'
```
```json
{"object":"web_domain","slug":"scanner","custom_domain":"pay.yourapp.com","status":"pending","dns":[{"type":"CNAME","name":"pay.yourapp.com","value":"api.revenuedot.app"},{"type":"TXT","name":"_revenuedot.pay.yourapp.com","value":"revenuedot-verify=k3m9q2x7z1c4v8b6n0p5w2e7"}],"…":"…"}
```
2. Add the two records at your DNS provider, with the values from `dns`:
| Type | Name | Value | Why |
|---|---|---|---|
| CNAME | `pay.yourapp.com` | the CNAME target shown (on Cloud today, `api.revenuedot.app`) | Sends the traffic to RevenueDot |
| TXT | `_revenuedot.pay.yourapp.com` | `revenuedot-verify=<token>` | Proves you own the domain |
With Cloudflare DNS, set the CNAME to **DNS only** (grey cloud).
3. Click **Verify**, or:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/web_domain/actions/verify" -H "Authorization: Bearer $SECRET_KEY"
```
RevenueDot reads both records through Cloudflare's DNS-over-HTTPS resolver. When both match, `status` becomes `verified`. Otherwise it is `failed`, and `error` says which record is wrong and what DNS answered, such as "The TXT record _revenuedot.pay.yourapp.com must be … and was not found". DNS changes can take a few minutes. You can check 6 times a minute.
Once verified, the project's pages answer at the root of your domain:
- Pages: `https://pay.yourapp.com/<page slug>`
- Redemption links: `https://pay.yourapp.com/r/<token>`
- The calls the pages make: `https://pay.yourapp.com/api/...`
The `url` of every link and funnel switches to the new domain. The default address keeps working too. Send `{"custom_domain":null}` to remove it.
The domain serves these pages and nothing else. The API, sign-in and OAuth answer 404 there, so no RevenueDot session or login page ever lives on a domain you control.
**One verified domain belongs to one project.** Another project can type the same domain, but only the project that adds its TXT record can verify it, and a claim that is not verified never blocks you. Once your domain is verified, no other project can verify it.
## On RevenueDot Cloud: TLS is added by hand for now
Browsers need a TLS certificate for `pay.yourapp.com`. RevenueDot Cloud serves custom domains through Cloudflare for SaaS, and **adding a verified domain there is a manual step for now**. After your domain shows as verified, the RevenueDot team adds it and Cloudflare issues the certificate once the CNAME resolves. Until then, `https://pay.yourapp.com` does not load: keep sharing the default address. The dashboard shows this note next to the domain.
The CNAME target on Cloud may change when this step is automated. Always use the value the dashboard shows.
## Self-hosted servers
Your server answers a verified domain itself. You need:
- **DNS** pointing the domain at your server. By default the CNAME target is the pay host (the host of `REVENUEDOT_PAY_URL`, else your server's host). Set `REVENUEDOT_CUSTOM_DOMAIN_TARGET` to tell customers a different host, for example a load balancer's name.
- **TLS** for the domain at your reverse proxy, for example with Caddy's on-demand TLS or a certificate from Let's Encrypt.
- **The request's host** passed through to RevenueDot: the `Host` header, or `X-Forwarded-Host`. RevenueDot picks the project by host.
The default `docker-compose.yml` passes `REVENUEDOT_PAY_URL` and `REVENUEDOT_CUSTOM_DOMAIN_TARGET` from your `.env` to the container. See [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md).
## Related
- [Sell on the web with Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md)
- [Purchase links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/purchase-links.md), [Funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md), [Redemption links](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md)
- [Extensions: Web billing](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#web-billing)
---
# How do I receive and verify RevenueDot webhooks?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md
Description: Add a webhook URL, keep the whsec_ signing secret, verify the X-RevenueCat-Webhook-Signature HMAC on the raw body, answer 200 fast and deduplicate on event.id. Failed deliveries retry 5 times.
Add a webhook in the dashboard or with the API and keep the `whsec_...` signing secret it returns. RevenueDot then POSTs each event to your URL as JSON in RevenueCat's webhook format. Verify the `X-RevenueCat-Webhook-Signature` header against the **raw** request body, answer **200** quickly, and ignore events whose `event.id` you have already handled. Anything but 200 is retried after 5, 10, 20, 40 and 80 minutes.
## 1. Add a webhook
In the dashboard: **Integrations → Webhooks → Add webhook**. Or with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/integrations/webhooks" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"name":"Backend","url":"https://api.example.com/webhooks/revenuedot","authorization_header":"Bearer my-shared-token","environment":"production"}'
```
```json
{"object":"webhook_integration","id":"wh_ceps8nr7mczvhaqw","project_id":"proj18pzzkao","name":"Backend","url":"https://api.example.com/webhooks/revenuedot","environment":"production","event_types":[],"app_id":null,"created_at":1790801342625,"signing_secret":"whsec_3f5b7fb5a591c17aaa9108376df0bddbe1555f0a908bfdc0"}
```
- **`signing_secret` is shown once**, in this answer. Store it as a secret in your backend.
- `authorization_header` (optional) is sent verbatim as the `Authorization` header, the same role as the authorization header setting in [RevenueCat's webhooks](https://www.revenuecat.com/docs/integrations/webhooks).
- `environment`: `production`, `sandbox`, or `null` for both.
- `event_types`: lower-case types such as `["initial_purchase","renewal"]`; empty means all except the opt-in types below.
- `app_id`: only one app's events; `null` for all apps.
- **See what was sent:** click a delivery on the webhook's dashboard page. The details show the request (URL, headers with Authorization masked, the exact body), every attempt with its time, HTTP status, latency and the first 4 KB of your server's answer (credentials it echoes are masked), the next retry, Retry and Copy as cURL. The API is `GET /v2/projects/{project_id}/webhooks/{webhook_id}/deliveries/{delivery_id}` (Admins and Developers). Attempt details are kept for 30 days after each attempt.
- **Pause without deleting:** send `{"enabled":false}` to `POST /v2/projects/{project_id}/integrations/webhooks/{id}`, or use the Deliveries switch on the webhook's dashboard page. Events recorded while it is paused are not sent; queued retries resume when you turn it back on. `enabled` is a RevenueDot addition; read it with `GET /v2/projects/{project_id}/webhooks`.
## 2. What a delivery looks like
```http
POST /webhooks/revenuedot HTTP/1.1
Content-Type: application/json
User-Agent: RevenueDot-Webhooks/1.0
Authorization: Bearer my-shared-token
X-RevenueCat-Webhook-Signature: t=1790800914,v1=0a1552334e825926036f7efe21527800ea45caa63eca523c6120c6da9041ef99
{"api_version":"1.0","event":{"id":"66339910-3BFF-49F4-B873-D1283D673DE2","type":"INITIAL_PURCHASE","app_user_id":"user_1","original_app_user_id":"user_1","aliases":["user_1"],"product_id":"pro_monthly","entitlement_ids":["pro"],"period_type":"NORMAL","purchased_at_ms":1790800914000,"expiration_at_ms":1793392914000,"environment":"SANDBOX","store":"TEST_STORE","price":9.99,"currency":"USD","presented_offering_id":"default","transaction_id":"test_1790800914000_quickstart","...":"..."}}
```
Every field of every event type, with full examples, is on [Webhook events](https://raw.githubusercontent.com/revenuedot/docs/main/api/webhook-events.md). Handlers written for RevenueCat's webhooks work unchanged: the field names and values are the same.
RevenueDot sends 19 of RevenueCat's 21 event types:
- **`PURCHASE_REDEEMED`** is sent when an app redeems a web purchase with a [redemption link](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/redemption-links.md). `redeemed_from` is the anonymous web buyer, `redeemed_by` and `app_user_id` the app's user.
- **`SUBSCRIBER_ALIAS`** is sent only to webhooks whose `event_types` names `subscriber_alias`. RevenueCat deprecated it and sends it only to older projects, so a webhook without a filter never gets it.
- **`TEMPORARY_ENTITLEMENT_GRANT` and `INVOICE_ISSUANCE`** are never sent. RevenueDot never grants access it has not verified during a store outage (the SDK keeps access on the device instead, see [offline entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/offline-entitlements.md)), and has no billing engine that issues invoices.
- **`FUNNEL_VIEWED`, `FUNNEL_STEP_COMPLETED` and `FUNNEL_PURCHASE`** are RevenueDot's own types for [funnels](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/funnels.md). Like `SUBSCRIBER_ALIAS`, they are opt-in: only webhooks whose `event_types` names `funnel_viewed`, `funnel_step_completed` or `funnel_purchase` get them, so a handler written for RevenueCat's types never sees them.
- **`PAYWALL_IMPRESSION`, `PAYWALL_CLOSE`, `PAYWALL_CANCEL`, `PAYWALL_EXIT_OFFER`, `PAYWALL_COMPONENT_INTERACTED`, `PAYWALL_PURCHASE_INITIATED` and `PAYWALL_PURCHASE_ERROR`** are what customers do on paywalls the SDK shows. They are opt-in too: only webhooks whose `event_types` names them get them. RevenueCat sends paywall events to analytics integrations only ([paywall integrations](https://www.revenuecat.com/docs/tools/paywalls/integrations)), so this is a RevenueDot addition. They carry the paywall, offering and session fields listed under [Integrations](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md#paywall-events), and no price or transaction. A batch the SDK sends again is not delivered twice.
- **`offer_code`** carries the App Store or Google Play offer id of the period, such as a [win-back offer](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/win-back-offers.md).
## 3. Verify the signature
The header is `t=<unix seconds>,v1=<hex>`, where the hex is HMAC-SHA256 of `"<t>.<raw body>"` keyed with the signing secret. RevenueDot signs again on every attempt, so `t` is the attempt's time.
1. Read the raw body bytes. Parsing JSON and serializing it again changes the bytes and breaks the check.
2. Parse `t` and `v1` from the header.
3. Refuse the request if `t` is more than 5 minutes from your clock. This stops replays.
4. Compute the HMAC and compare it to `v1` in constant time.
```js
// Node.js. Verifies the HMAC signature on a RevenueDot webhook delivery.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifySignature(rawBody, header, secret, { now = new Date(), toleranceSeconds = 300 } = {}) {
const match = /(?:^|,)\s*t=(\d+)\s*,\s*v1=([0-9a-f]{64})\s*(?:,|$)/.exec(header ?? "");
if (!match) return false;
const timestamp = Number(match[1]);
// Refuse old deliveries so a captured request cannot be replayed.
if (Math.abs(Math.floor(now.getTime() / 1000) - timestamp) > toleranceSeconds) return false;
const expected = createHmac("sha256", secret).update(`${timestamp}.`).update(rawBody).digest();
const received = Buffer.from(match[2], "hex");
return received.length === expected.length && timingSafeEqual(received, expected);
}
```
```python
# Python. Verifies the HMAC signature on a RevenueDot webhook delivery.
import hashlib, hmac, re, time
_PATTERN = re.compile(r"(?:^|,)\s*t=(\d+)\s*,\s*v1=([0-9a-f]{64})\s*(?:,|$)")
def verify_signature(raw_body: bytes, header: str | None, secret: str, tolerance_seconds: int = 300) -> bool:
match = _PATTERN.search(header or "")
if not match:
return False
timestamp = int(match.group(1))
# Refuse old deliveries so a captured request cannot be replayed.
if abs(int(time.time()) - timestamp) > tolerance_seconds:
return False
expected = hmac.new(secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, match.group(2))
```
```go
// Go. Verifies the HMAC signature on a RevenueDot webhook delivery.
var signaturePattern = regexp.MustCompile(`(?:^|,)\s*t=(\d+)\s*,\s*v1=([0-9a-f]{64})\s*(?:,|$)`)
func VerifySignature(rawBody []byte, header, secret string, now time.Time, tolerance time.Duration) bool {
m := signaturePattern.FindStringSubmatch(header)
if m == nil {
return false
}
ts, err := strconv.ParseInt(m[1], 10, 64)
if err != nil {
return false
}
// Refuse old deliveries so a captured request cannot be replayed.
if age := now.Sub(time.Unix(ts, 0)); age > tolerance || age < -tolerance {
return false
}
mac := hmac.New(sha256.New, []byte(secret))
mac.Write([]byte(m[1] + "."))
mac.Write(rawBody)
received, err := hex.DecodeString(m[2])
return err == nil && hmac.Equal(received, mac.Sum(nil))
}
```
A complete Express handler that keeps the raw body:
```js
// Node.js + Express: receive RevenueDot webhooks.
import express from "express";
import { verifySignature } from "./verify.js";
const app = express();
const seen = new Set(); // use your database in production
app.post("/webhooks/revenuedot", express.raw({ type: "application/json" }), (req, res) => {
if (!verifySignature(req.body, req.get("X-RevenueCat-Webhook-Signature"), process.env.REVENUEDOT_WEBHOOK_SECRET)) {
return res.status(401).send("bad signature");
}
const { event } = JSON.parse(req.body.toString("utf8"));
if (seen.has(event.id)) return res.sendStatus(200); // a retry of an event you already handled
seen.add(event.id);
// Grant or remove access in your own database here. Keep it fast: RevenueDot waits at most 60 seconds.
res.sendStatus(200);
});
app.listen(3000);
```
Runnable, tested receivers: [Node.js + Express](https://github.com/revenuedot/examples/tree/main/backend/node-express-webhook), [Next.js](https://github.com/revenuedot/examples/tree/main/backend/nextjs-webhook), [Python + FastAPI](https://github.com/revenuedot/examples/tree/main/backend/python-fastapi-webhook) and [Go](https://github.com/revenuedot/examples/tree/main/backend/go-webhook).
If you set an `authorization_header`, also compare the `Authorization` header with it. The HMAC check is the stronger of the two, because it also proves the body was not changed.
## 4. Retries and delivery guarantees
- **Only HTTP 200 counts as delivered.** A 201, 204 or redirect is treated as a failure. RevenueCat documents the same rule for its [webhooks](https://www.revenuecat.com/docs/integrations/webhooks).
- **Timeout:** 60 seconds per attempt.
- **Schedule:** after a failure, RevenueDot retries after 5, 10, 20, 40 and 80 minutes (6 attempts in all), then marks the delivery `failed`.
- **At least once:** a delivery can arrive more than once, for example when your 200 is lost. Deduplicate on `event.id`.
- **Order is not guaranteed.** Use the timestamps in the event (`event_timestamp_ms`, `purchased_at_ms`, `expiration_at_ms`), or fetch the customer's current state with `GET /v1/subscribers/{app_user_id}` when order matters.
- **Every matching webhook gets its own delivery**, so two URLs each receive every event.
## 5. Test and debug
- **Send a test event:** dashboard **Send test event**, or `POST /v2/projects/{project_id}/integrations/webhooks/{id}/test`. It sends a purchase-shaped `TEST` event, signed like the others; filters do not apply.
- **Make real events with the Test Store:** `POST /v2/projects/{project_id}/test_purchases` with a `scenario` such as `renewal`, `cancel` or `refund` produces the matching events. See [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md).
- **Delivery log:** `GET /v2/projects/{project_id}/webhooks/{id}/deliveries?status=failed` shows each attempt's HTTP status, duration and error. Retry one now with `POST .../deliveries/{delivery_id}/retry`.
- **Health:** `GET /v2/projects/{project_id}/setup_health` counts deliveries in the last 24 hours and lists failing webhooks.
- **Local backend:** from a RevenueDot running in Docker, reach your laptop at `http://host.docker.internal:3000/...`.
See [Why are my webhooks not arriving?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/webhooks-not-arriving.md) for common causes.
## Related
- [Webhook events](https://raw.githubusercontent.com/revenuedot/docs/main/api/webhook-events.md)
- [Subscriptions and events](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/subscriptions-and-events.md)
- [REST API v2: webhook integrations](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md)
---
# How do Trusted Entitlements (response signing) work with RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md
Description: With REVENUEDOT_SIGNING_KEY set, RevenueDot signs every SDK response the way the RevenueCat SDKs verify. The stock SDK trusts only RevenueCat's key, so turn verification off or use a fork built with your key.
The RevenueCat SDKs can check that each response really came from the server, by verifying an Ed25519 signature against a public key built into the SDK. RevenueDot signs its responses in exactly that format when you set `REVENUEDOT_SIGNING_KEY`. **The stock SDK only trusts RevenueCat's key**, so against RevenueDot it reports verification `FAILED`. Turn verification off in the stock SDK, or use a RevenueDot fork that trusts your key.
## What each setup gives you
| App uses | Server | Result |
|---|---|---|
| Stock RevenueCat SDK, verification `DISABLED` | any | No check. Everything works. **Recommended for proxy mode** |
| Stock SDK, `INFORMATIONAL` (the iOS and Android default) | any | Entitlements work, but each carries `verification: FAILED` and the SDK logs an error |
| Stock SDK, `ENFORCED` | any | Every request fails. Never use it against RevenueDot |
| RevenueDot fork (official build) | RevenueDot Cloud | `VERIFIED` |
| RevenueDot fork built with your public key | your server with `REVENUEDOT_SIGNING_KEY` | `VERIFIED` |
Defaults of the stock SDKs: iOS and Android are informational; Unity defaults to informational in the Inspector; Capacitor passes no mode, so the native default applies; React Native, Flutter and Kotlin Multiplatform default to disabled; Cordova has no setting and logs the failure; purchases-js does not verify. Each [SDK guide](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md) shows the exact setting. RevenueCat describes the feature in its [Trusted Entitlements docs](https://www.revenuecat.com/docs/customers/trusted-entitlements).
## Turn signing on in your server
1. Generate a key pair in a checkout of the server repository:
```bash
pnpm tsx scripts/signing-keygen.ts
```
```text
REVENUEDOT_SIGNING_KEY=3q2+7w...base64 of a 32-byte seed...=
public key: ZzwPxGlon0E8ErpDh9QAH0Jh6+E6D6qufvTSetXZY9Y=
```
2. Give the first line to the server as an environment variable, and keep it in your password manager. See [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#set-the-signing-key). Anyone with the seed can sign responses your apps trust.
3. Restart and check the public key:
```bash
curl -s http://localhost:8787/.well-known/revenuedot-signing-key
```
```json
{"algorithm":"Ed25519","public_key":"ZzwPxGlon0E8ErpDh9QAH0Jh6+E6D6qufvTSetXZY9Y=","encoding":"base64","header":"X-Signature","docs":"https://revenuedot.app/docs"}
```
Without a key this answers 404 and responses are not signed.
## What gets signed
Every 2xx and 3xx response under `/v1` and `/rcbilling` carries an `X-Signature` header. The SDK sends a random `X-Nonce` with requests it verifies, and the nonce is part of the signed message. The value is base64 of 180 bytes, the layout the iOS and Android SDKs verify (`apps/server/src/services/signing.ts`):
| Bytes | Content |
|---|---|
| 0 to 31 | An intermediate Ed25519 public key |
| 32 to 35 | The intermediate key's expiry, in days since 1970-01-01, little-endian |
| 36 to 99 | The root key's signature over the expiry and the intermediate key |
| 100 to 115 | A random salt |
| 116 to 179 | The intermediate key's signature over the message |
The message is the salt, the API key, the nonce, the request path, the `X-Post-Params-Hash` and `X-Headers-Hash` request headers, the `X-RevenueCat-Request-Time` and `X-RevenueCat-ETag` response headers, and the body. The server makes a new intermediate key every 30 days (7 days before the old one expires) and keeps it in memory; only the root seed is configured.
The server's contract tests check this format against real RevenueCat signatures published in the purchases-ios test suite, and check that tampered bodies, nonces, paths, keys and expired intermediate keys are rejected.
## Verify against your own server
The official forks trust RevenueDot Cloud's public key (`gXdn2hmqR/TbdtQwK02laE0YgFz0Rtf918LICLrgZhg=`). A self-hosted server cannot sign with that key. To get `VERIFIED` against your own server, build the forks with your public key and, optionally, your host. The fork pipeline in the server repository does it:
```bash
# In a checkout of revenuedot/revenuedot, with the fork repositories cloned next to it.
pnpm tsx scripts/forks/apply.ts --all \
--var apiHost=https://revenuedot.example.com \
--var signingPublicKey=ZzwPxGlon0E8ErpDh9QAH0Jh6+E6D6qufvTSetXZY9Y=
# or: REVENUEDOT_FORK_API_HOST=... REVENUEDOT_FORK_SIGNING_PUBLIC_KEY=... pnpm tsx scripts/forks/apply.ts --all
```
Then build and ship those SDK builds. Rotating the root key means shipping new SDK builds, because the key is compiled into the app. Choose it once and guard it.
## Related
- [Why does the SDK report signature verification FAILED?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/signature-verification-failed.md)
- [How do I connect my app?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/connect-your-app.md)
- [SDK endpoints: response signing](https://raw.githubusercontent.com/revenuedot/docs/main/api/sdk-endpoints.md)
---
# How do I use the Test Store to test purchases without a store account?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md
Description: Add a Test Store app, use its test_ key in the SDK, and buy through the SDK's test dialog. Simulate renewals, cancellations, billing issues and refunds with POST /v2/projects/{id}/test_purchases.
The **Test Store** is RevenueDot's built-in store for development. Create a Test Store app, give its `test_` key to the SDK, and purchases go through the SDK's test dialog instead of Apple or Google. They unlock entitlements, record events and send webhooks like real purchases, and they are always **sandbox**. To see a whole lifecycle without waiting, simulate it with `POST /v2/projects/{project_id}/test_purchases`.
## Set it up
```bash
B="$REVENUEDOT_URL/v2/projects/$PROJECT_ID"; H="Authorization: Bearer $SECRET_KEY"
curl -s -X POST "$B/apps" -H "$H" -H "Content-Type: application/json" -d '{"name":"Test Store","type":"test_store"}'
curl -s "$B/apps/$APP_ID/public_api_keys" -H "$H" # -> "key": "test_..."
curl -s -X POST "$B/products" -H "$H" -H "Content-Type: application/json" \
-d '{"store_identifier":"pro_monthly","app_id":"'$APP_ID'","type":"subscription","display_name":"Pro monthly","subscription":{"duration":"P1M"}}'
```
Attach the products to your entitlement and offering like any other app's products. The [seed script](https://github.com/revenuedot/examples/blob/main/selfhost/docker-compose/seed.sh) does all of this in one run; see the [Quickstart](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md).
- **The product's `subscription.duration` is the period.** A `P1M` product expires one month after purchase. Without a duration, one month is used.
- **The price is the product's Test Store price.** Set it in the dashboard (New product and the app page ask for it; Edit product changes it) or with `"test_store_price":{"amount_micros":9990000,"currency":"USD"}` in the create or update call. A product without one shows 0. The price the SDK posts with the purchase is recorded. Use an ISO 4217 code that has an exchange rate to USD (every App Store and Google Play currency does); other codes are refused, because their purchases would count as no revenue.
## Prices in several currencies
A Test Store product can have one price per currency. One of them is the default: it is what `indicative_price` shows and what a customer sees when their currency has no price.
- **Dashboard.** Edit product lists one row per currency. **Add currency** adds a row, the **Default** radio picks the default, and the × button removes a currency. The product page lists every price, the default first.
- **API.** The same endpoints as RevenueCat, with the bodies its CLI sends:
```bash
# Add prices (an existing currency gets the new amount)
curl -s -X POST "$B/products/$PRODUCT_ID/test_store_prices" -H "$H" -H "Content-Type: application/json" \
-d '{"prices":[{"currency":"EUR","amount_micros":8990000},{"currency":"GBP","amount_micros":7990000}]}'
# List them: a JSON array of {"id","currency","amount_micros"}, the default first
curl -s "$B/products/$PRODUCT_ID/prices" -H "$H"
# Change one
curl -s -X PATCH "$B/products/$PRODUCT_ID/prices/EUR" -H "$H" -H "Content-Type: application/json" -d '{"amount_micros":9490000}'
# Remove one (RevenueDot extension)
curl -s -X DELETE "$B/products/$PRODUCT_ID/prices/GBP" -H "$H"
```
`test_store_price` on product create and update sets the default price and keeps the other currencies; `null` clears every price. See [List a product's prices](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#list-a-products-prices).
- **Which price the SDK shows.** The price in the currency purchases-js asks for; else in the currency of the store country the SDK sends (the App Store storefront on iOS, the Play country on Android); else in the currency of the country the customer was last seen in; else the default. A customer in Germany sees the EUR price, a customer in Japan sees the default when there is no JPY price.
- **What a purchase records.** The native SDKs post the price they showed, and it is recorded as sent. purchases-js posts only the currency, so the product's price in that currency is recorded. A [simulated purchase](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md#simulate-a-lifecycle) without `price` uses the price in `currency` (or in `country_code`'s currency), else the default.
## Buy in the app
Configure the SDK with the `test_` key and your server as the proxy URL, then call `purchase` as usual. The SDK shows its Test Store dialog; choose the successful purchase. The SDK posts `fetch_token = test_<purchase time in ms>_<id>` to `POST /v1/receipts`, and RevenueDot accepts any token of that form.
The Test Store works with purchases-js, React Native (including Expo Go and the web) and the native SDKs. Use `test_` keys only in development builds; ship your store keys (`appl_`, `goog_`) in releases. Servers built before 2026-09-30 sent product details the native iOS SDK could not read ("No base price found for product"); update the server if you see that.
## Test your setup with the sample app
The app page has **Test your setup with the sample app**: pick iOS (SwiftUI), Android (Jetpack Compose), Flutter, React Native (Expo) or web, and you get a zip of that app from [revenuedot/examples](https://github.com/revenuedot/examples) with this app's key, your server's URL and your first entitlement already filled in. Unzip it, follow its README, buy in a debug build, and the purchase shows up under **Customers**. App Store, Google Play and Web Billing apps offer the samples that can buy with their key. The same zip comes from `GET /v2/projects/{project_id}/apps/{app_id}/sample_app?platform=ios`. Only public values go in the zip.
## Buy with curl
```bash
curl -s "$REVENUEDOT_URL/v1/receipts" -H "Authorization: Bearer $TEST_KEY" -H "Content-Type: application/json" \
-d "{\"app_user_id\":\"user_1\",\"fetch_token\":\"test_$(date +%s)000_demo\",\"product_id\":\"pro_monthly\",\"price\":9.99,\"currency\":\"USD\"}"
```
## Simulate a lifecycle
`POST /v2/projects/{project_id}/test_purchases` runs a whole history through the same pipeline as receipts, with each state applied at the time it would have happened. Events, revenue and webhooks come out as they would for a real subscription.
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/test_purchases" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d '{"app_user_id":"user_renewal","product_id":"pro_monthly","scenario":"renewal","price":9.99}'
```
```json
{"object":"test_purchase","scenario":"renewal","store_transaction_id":"test_1790800923978_290d7238-2657-4c28-b829-520e19bc74ec","event_types":["INITIAL_PURCHASE","RENEWAL"],"customer":{"object":"customer","id":"user_renewal","...":"..."},"subscription":{"object":"subscription","status":"active","...":"..."},"purchase":null}
```
| `scenario` | What happens | Default start | Events (monthly product) |
|---|---|---|---|
| `purchase` | Bought at the start | now | `INITIAL_PURCHASE` |
| `trial` | A 7-day free trial starts | now | `INITIAL_PURCHASE` (trial, price 0) |
| `trial_conversion` | Trial, then paid periods until now | 7 days ago | `INITIAL_PURCHASE`, `RENEWAL` (`is_trial_conversion`) |
| `renewal` | Bought, then renewed every period until now | one period ago | `INITIAL_PURCHASE`, `RENEWAL` |
| `cancel` | Like `renewal`, then auto-renew turned off now | now | `INITIAL_PURCHASE`, `CANCELLATION` |
| `billing_issue` | The charge fails at the last period end; 7 days of grace | one period ago | `INITIAL_PURCHASE`, `BILLING_ISSUE`, `CANCELLATION` |
| `refund` | Like `renewal`, then the latest period is refunded now | now | `INITIAL_PURCHASE`, `CANCELLATION` (refund) |
| `expire` | Auto-renew off from the start; access ends at the period end or now | one period ago | `INITIAL_PURCHASE`, `CANCELLATION`, `EXPIRATION` |
- `offset_days` (0 to 730) moves the start into the past, for example `"offset_days": 95` with `renewal` on a monthly product gives three renewals. Or send `purchased_at` in epoch milliseconds.
- `product_id` is the product's id or store identifier; it must belong to a Test Store app (`app_id` picks one when the project has several).
- One-time products support `purchase` and `refund` only.
- `price`, `currency` (default USD) and `country_code` are recorded like a real purchase. Without `price`, the product's price in `currency` (or in `country_code`'s currency) is used, else its default price.
## Related
- [Sandbox and production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/sandbox.md)
- [Test with App Store sandbox and Google Play testers](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md)
- [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)
- [Extensions: Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md)
---
# How do I test with App Store sandbox, StoreKit in Xcode and Google Play testers?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sandbox-testing.md
Description: Real store test purchases work against RevenueDot once the app's store credentials and notifications are set up. They are marked sandbox; Xcode StoreKit purchases also need the StoreKit test certificate.
Store test purchases work against RevenueDot the same way they work in production: set up the app's [App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md) or [Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md) credentials and notifications first. RevenueDot reads the environment from the store, so these purchases are marked **sandbox**, unlock entitlements and send webhooks with `environment: SANDBOX`. For quick tests without any store account, use the [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md) instead.
**Status (2026-10-03):** a real App Store sandbox purchase ran end to end on a physical iPhone on 2026-10-02: Apple's purchase sheet, Apple's notification into RevenueDot, an `INITIAL_PURCHASE` webhook, access unlocked in the app. Google Play's code path passes its tests against a copy of Google's API; no real Play sandbox purchase has run end to end yet. Tell us what you find in a [GitHub issue](https://github.com/revenuedot/revenuedot/issues).
## App Store sandbox and TestFlight
1. Create a sandbox tester in App Store Connect (**Users and Access → Sandbox**), and sign in with it on the device under **Settings → App Store → Sandbox Account**. TestFlight builds use sandbox purchases too.
2. Configure the SDK with the app's `appl_` key and your RevenueDot proxy URL.
3. Buy. The SDK posts the StoreKit 2 signed transaction; RevenueDot verifies Apple's signature and, with the In-App Purchase key, reads the history from Apple's sandbox environment.
4. Sandbox subscriptions renew fast (a month lasts minutes), so renewals, expirations and their notifications arrive quickly. Point App Store Connect's **Sandbox Server URL** at the same notification URL as production.
## StoreKit testing in Xcode
Purchases made with a StoreKit configuration file in Xcode are signed by Xcode, not Apple, so RevenueDot refuses them unless the app holds Xcode's certificate:
1. In Xcode, open the `.storekit` file and choose **Editor → Save Public Certificate**.
2. Save the certificate on the app as `xcode_certificate` (PEM or base64 DER), in the dashboard under **More settings → StoreKit testing in Xcode**, or with the API:
```bash
curl -s -X POST "$REVENUEDOT_URL/v2/projects/$PROJECT_ID/apps/$APP_ID" \
-H "Authorization: Bearer $SECRET_KEY" -H "Content-Type: application/json" \
-d "$(jq -n --rawfile cert StoreKitTestCertificate.pem '{app_store: {xcode_certificate: $cert}}')"
```
3. Buy in the simulator. RevenueDot trusts the local transactions and does not call Apple for them.
## Google Play license testers
1. In Play Console, add testers under **Setup → License testing**, and publish the app to an internal test track.
2. Configure the SDK with the app's `goog_` key and your proxy URL, and install the build from the test track.
3. Buy with a tester account. Google marks the purchase as a test purchase, and RevenueDot records it as sandbox. Test subscriptions renew every few minutes.
4. Pub/Sub notifications for test purchases arrive at the same push endpoint as real ones.
## Check what happened
- The customer's page in the dashboard shows each purchase with its environment and events.
- `GET /v2/projects/{project_id}/customers/{customer_id}/subscriptions?environment=sandbox`
- `GET /v2/projects/{project_id}/events?environment=sandbox`
- `GET /v2/projects/{project_id}/metrics/overview?environment=sandbox`
## Related
- [Sandbox and production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/sandbox.md)
- [How do I test purchases without real money?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/test-sandbox-purchases.md)
- [Test Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/test-store.md)
---
# How do I self-host RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md
Description: Run the published image ghcr.io/revenuedot/revenuedot (API plus dashboard) next to Postgres with docker compose. Configure it with a .env file, put HTTPS in front, and set REVENUEDOT_SIGNING_KEY if you sign responses.
Most apps should use [RevenueDot Cloud](https://app.revenuedot.app/signup), which needs no server. This guide is for teams that run their own. The server is AGPL-3.0 and has no billing. Organizations, custom roles, single sign-on and the other `ee/` features need an Enterprise licence key ([RevenueDot Enterprise](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md)).
Clone the repository, copy `.env.example` to `.env`, and run `docker compose up -d`. You get one container that serves the SDK API, the REST API, store notifications and the dashboard on port 8787, next to Postgres 16 with a persistent volume. The server applies database migrations itself when it starts, so upgrades are a pull and a restart.
```bash
git clone https://github.com/revenuedot/revenuedot.git
cd revenuedot
cp .env.example .env # set POSTGRES_PASSWORD before the first start
docker compose up -d # pulls ghcr.io/revenuedot/revenuedot and starts RevenueDot and Postgres
curl http://localhost:8787/v1/health # {"status":"ok"}
```
Open `http://localhost:8787/login` and sign up. **The first account is the owner.** After that, sign-up is closed to everyone except the addresses you [invite to a project](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md), unless you set `REVENUEDOT_ALLOW_SIGNUP=true`. Set up [email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email) so password resets, invites and alerts reach people.
The image is [`ghcr.io/revenuedot/revenuedot`](https://github.com/revenuedot/revenuedot/pkgs/container/revenuedot), built for amd64 and arm64 on every change to `main` and tagged `latest`, by date (`2026.10.03`) and by commit. `docker pull ghcr.io/revenuedot/revenuedot:latest` needs no account. Compose pulls it; set `REVENUEDOT_IMAGE=ghcr.io/revenuedot/revenuedot:2026.10.03` in `.env` to pin a build, and run `docker compose build` to build the same image from the checkout instead.
## What runs
| Piece | What it does |
|---|---|
| `revenuedot` container (Node.js 24) | One process: SDK API (`/v1`), REST API (`/v2`), dashboard sign-in (`/auth`), OAuth for MCP clients (`/oauth`), store notifications (`/v1/notifications/...`) and the dashboard's web app. A background job runs every 30 seconds: it records expirations, runs the daily Google Play voided-purchase check, re-checks store credentials, sends webhooks and sends [alert emails](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md) |
| `db` container (Postgres 16) | Every customer, purchase, event and setting, in the `revenuedot-data` volume |
One container is enough for most apps. To run two or more against the same database, behind a load balancer, see [High availability](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/high-availability.md): migrations and the background job take Postgres locks, so each webhook and email still goes out once. The server answers `GET /healthz` (process alive) and `GET /readyz` (database reachable, not shutting down) for health checks, and finishes requests in flight when it gets SIGTERM.
## Settings
Edit `.env` next to `docker-compose.yml`. Store credentials (Apple keys, Google service accounts) are not environment variables: each app holds its own, set in the dashboard or with the REST API, and the server stores them encrypted (see [Encryption key](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#encryption-key)).
| Variable | Default | What it does |
|---|---|---|
| `POSTGRES_PASSWORD` | `revenuedot` in Compose | Password of the bundled Postgres. Set it before the first start: it is written into the volume then, and changing it later also needs `ALTER USER` in Postgres |
| `REVENUEDOT_PORT` | `8787` | Host port for everything |
| `REVENUEDOT_IMAGE` | `ghcr.io/revenuedot/revenuedot:latest` | The server image. Pin a date tag (`2026.10.03`) or a commit tag so a restart never picks up a newer build than you tested |
| `REVENUEDOT_ALLOW_SIGNUP` | `false` | `true` lets anyone who reaches the dashboard create an account. Invited addresses can always create one |
| `REVENUEDOT_SMTP_URL`, `REVENUEDOT_MAIL_FROM`, `REVENUEDOT_MAIL_REPLY_TO`, `REVENUEDOT_PUBLIC_URL` | unset | Outgoing email. See [Email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email) |
| `REVENUEDOT_SIGNING_KEY` | unset | Base64 Ed25519 seed. Turns on [response signing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md). Not passed through by the default `docker-compose.yml`; see below |
| `REVENUEDOT_ENCRYPTION_KEY` | unset | Base64 of 32 random bytes. Encrypts store keys, integration credentials and two-factor secrets. See [Encryption key](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#encryption-key) |
Inside the container the server reads:
| Variable | Default | What it does |
|---|---|---|
| `DATABASE_URL` | `pglite://./.data/dev` | `postgres://user:password@host:5432/db` for Postgres (Compose sets it). A `pglite://` path uses an embedded Postgres on disk, for development only |
| `PORT` | `8787` | Port the server listens on |
| `DASHBOARD_DIST` | the built dashboard in the image | Folder of the dashboard's built files. If it has no `index.html`, only the API is served |
| `REVENUEDOT_ALLOW_SIGNUP` | unset (owner only) | See above |
| `REVENUEDOT_SIGNING_KEY` | unset | See above |
| `REVENUEDOT_ENCRYPTION_KEY` | unset | See above |
| `REVENUEDOT_SMTP_URL` and the other mail variables | unset | See [Email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email) |
| `REVENUEDOT_PAY_URL` | `<this server>/pay` | Where purchase links, funnels and redemption links live. A URL without a path, such as `https://pay.example.com`, serves them at that host's root. Redemption emails link here, else to `REVENUEDOT_PUBLIC_URL` + `/pay`, never to the host a request named. See [Custom domains](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/custom-domains.md) |
| `REVENUEDOT_CUSTOM_DOMAIN_TARGET` | the pay host | The host customers' custom domains must CNAME to |
| `REVENUEDOT_LICENSE_KEY` | unset | Turns on [RevenueDot Enterprise](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md) features the key covers. Not passed through by the default `docker-compose.yml`; add it to `docker-compose.override.yml` like the signing key |
| `REVENUEDOT_EE_DEV` | unset | `true` turns on every Enterprise feature for development and testing only ([development mode](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md#development-mode)) |
| `REVENUEDOT_INSIGHTS_DIGEST` | unset | `on` writes and emails the weekly [growth insights](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/growth-insights.md) digest with your model key. It needs [email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email). The one-click opt-out link needs `REVENUEDOT_ENCRYPTION_KEY` or `REVENUEDOT_SIGNING_KEY` |
### Set the signing key
Generate a key once (`pnpm tsx scripts/signing-keygen.ts` in a checkout with `pnpm install` done), add it to `.env`, and pass it to the container with a `docker-compose.override.yml`, which Compose reads automatically:
```yaml
# docker-compose.override.yml
services:
revenuedot:
environment:
REVENUEDOT_SIGNING_KEY: ${REVENUEDOT_SIGNING_KEY}
```
Check it with `curl http://localhost:8787/.well-known/revenuedot-signing-key`. Stock RevenueCat SDKs still cannot verify these signatures; see [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
### Encryption key
Every secret the server keeps is encrypted with AES-256-GCM: the App Store In-App Purchase and App Store Connect `.p8` keys, the Google Play service account JSON, Apple and Amazon shared secrets, Stripe, Paddle, Roku and Galaxy Store keys, integration and data export credentials, and two-factor secrets. The API and the dashboard never return them; they show only whether each one is set.
The key is `REVENUEDOT_ENCRYPTION_KEY` (make one with `openssl rand -base64 32`). Without it the server uses a key derived from `REVENUEDOT_SIGNING_KEY`. With neither, secrets are stored unencrypted in their own column, and encrypted within a minute of a key being set. Keep the key with your database backups but not in them: without it, saved store keys must be entered again.
Upgrading from a version that stored Apple and Google keys unencrypted needs no step: within a minute of starting, the server encrypts them in place. It logs `secrets backfill:` with counts and app ids, never a value.
To rotate the key:
1. Set `REVENUEDOT_ENCRYPTION_KEY` to the new key, a comma, then the old one (`NEW,OLD`), and restart. The first key encrypts; both decrypt. If you used the key derived from the signing key, set only `NEW`: the derived key keeps working while `REVENUEDOT_SIGNING_KEY` is unchanged.
2. Wait until the log shows `secrets backfill:` and then stays quiet (a few minutes). Every secret is now encrypted with the new key.
3. Set `REVENUEDOT_ENCRYPTION_KEY` to `NEW` alone and restart. Rotate `REVENUEDOT_SIGNING_KEY` only after this, since the derived key opens nothing once it changes.
A secret encrypted with a key the server no longer has cannot be read: the app's **Check credentials** says so, and the key must be entered again.
## Email
RevenueDot sends email for password resets, [team invites](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md) and [alerts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md). A self-hosted server sends it through any SMTP provider (your own mail server, Amazon SES, Postmark, Resend, Mailgun, SendGrid and others). Add these to `.env`; the default `docker-compose.yml` passes them to the container:
```bash
REVENUEDOT_SMTP_URL=smtp://user:password@smtp.example.com:587
REVENUEDOT_MAIL_FROM=RevenueDot <no-reply@example.com>
REVENUEDOT_MAIL_REPLY_TO=team@example.com
REVENUEDOT_PUBLIC_URL=https://revenuedot.example.com
```
| Variable | What it does |
|---|---|
| `REVENUEDOT_SMTP_URL` | The SMTP server. `smtp://` connects on port 587 and upgrades to TLS with STARTTLS when the server offers it. `smtps://` uses TLS from the start, on port 465. Write special characters in the user name or password URL-encoded: `@` is `%40`, `:` is `%3A`, `/` is `%2F` |
| `REVENUEDOT_MAIL_FROM` | The sender, as `Name <address>` or a bare address. Use an address on a domain your SMTP provider may send for (SPF and DKIM set up), or the emails land in spam. Default: `RevenueDot <no-reply@localhost>`, which most providers reject |
| `REVENUEDOT_MAIL_REPLY_TO` | Optional. Where replies go |
| `REVENUEDOT_PUBLIC_URL` | The address people use to open the dashboard, for the links in emails. Unset: links use the address the request came in on (`X-Forwarded-Host` behind a proxy). Alert emails have no request, so they use the last address the dashboard was opened on since the server started, or `http://localhost:8787`. Set it for correct alert links |
**Without `REVENUEDOT_SMTP_URL`, nothing is sent.** Every email, links included, is printed to the server log instead, so you can still copy a reset or invite link:
```bash
docker compose logs revenuedot
```
When the server starts, its log says which it does: `Email: SMTP (REVENUEDOT_SMTP_URL).` or `Email: not configured; emails are printed to this log.` A failed send is logged with the SMTP error and never blocks sign-up, invites or the background job.
## Reset a password without email
When someone cannot get a reset email, reset the password straight in the database with the `revenuedot` CLI. It needs `DATABASE_URL`, the server's Postgres:
```bash
DATABASE_URL=postgres://revenuedot:secret@localhost:5432/revenuedot npx revenuedot admin reset-password dev@example.com
```
With Docker Compose, run it inside the server container, which has `DATABASE_URL` set already:
```bash
docker compose exec revenuedot pnpm --filter revenuedot cli admin reset-password dev@example.com
```
- **Without `--password`**, the CLI generates a 20-character password and prints it once. Copy it then; it is not stored anywhere readable.
- **`--password <new password>`** sets a password you choose (at least 8 characters).
- **Every session of the user is signed out**, and open reset links stop working.
- **`--database-url <url>`** can replace the `DATABASE_URL` variable.
## Put HTTPS in front
The App Store and Google Pub/Sub send notifications only to public HTTPS URLs, and apps should never talk to your server over plain HTTP. Put a reverse proxy with TLS in front of port 8787, for example Caddy:
```text
# Caddyfile
revenuedot.example.com {
reverse_proxy localhost:8787
}
```
RevenueDot builds the notification URLs and the SDK's proxy URL it shows in the dashboard from `X-Forwarded-Host` and `X-Forwarded-Proto`. Caddy, nginx and most load balancers send these; check the app page shows `https://revenuedot.example.com/v1/notifications/...`. Session cookies get the `Secure` flag when the request URL is HTTPS.
## Use your own Postgres
Point `DATABASE_URL` at any Postgres 16 database and remove the `db` service, or run the server without Docker:
```bash
pnpm install
pnpm --filter @revenuedot/dashboard build
DATABASE_URL=postgres://revenuedot:secret@db.internal:5432/revenuedot pnpm --filter @revenuedot/server start
```
The server creates its tables on the first start. Managed Postgres (RDS, Cloud SQL, Neon, Railway, Supabase) works; the server keeps a pool of 10 connections.
## Local development
Without `DATABASE_URL`, `pnpm dev` stores data in an embedded Postgres (PGlite) under `.data/dev`, so you need no database server to try changes:
```bash
pnpm install
pnpm --filter @revenuedot/dashboard build # optional: without it only the API is served
pnpm dev # http://localhost:8787, restarts on changes
```
## Related
- [Upgrades](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/upgrades.md) and [Backups](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md)
- [Invite your team](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md) and [Alert emails](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md)
- [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md)
- [Quickstart](https://raw.githubusercontent.com/revenuedot/docs/main/docs/getting-started/quickstart.md)
- [Self-host in 5 minutes](https://raw.githubusercontent.com/revenuedot/docs/main/blog/self-host-revenuedot-in-5-minutes.md)
---
# How do I run RevenueDot with high availability?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/high-availability.md
Description: Run two or more replicas of the RevenueDot image behind a load balancer on one Postgres with a standby. Migrations and background work run once under Postgres locks. Helm chart, Terraform for AWS and Google Cloud.
Run **two or more replicas** of the same RevenueDot image behind a load balancer, on **one managed Postgres with a standby** (Amazon RDS Multi-AZ, Cloud SQL with high availability, or Aurora). Every replica serves the SDK API, the REST API, store notifications and the dashboard, and they share all state through Postgres, so any replica can answer any request. Losing a replica, a node or a whole availability zone does not stop purchases, and upgrades replace one replica at a time.
The server repository has three reference setups, all checked in CI and none applied for you:
| Where | Setup | What it creates |
|---|---|---|
| Any Kubernetes (EKS, GKE, AKS, on-premises) | [Helm chart](https://github.com/revenuedot/revenuedot/tree/main/deploy/helm/revenuedot) | Deployment with autoscaling, PodDisruptionBudget, Service, Ingress, probes, a migration Job, non-root pods on a read-only filesystem |
| AWS | [Terraform: `deploy/terraform/aws`](https://github.com/revenuedot/revenuedot/tree/main/deploy/terraform/aws) | VPC over 3 zones, RDS PostgreSQL Multi-AZ, ECS on Fargate (2 to 10 tasks), Application Load Balancer, ACM certificate, Secrets Manager, KMS, 9 CloudWatch alarms |
| Google Cloud | [Terraform: `deploy/terraform/gcp`](https://github.com/revenuedot/revenuedot/tree/main/deploy/terraform/gcp) | Cloud Run (2 to 10 instances), Cloud SQL for PostgreSQL with regional availability and point-in-time recovery, Secret Manager, an uptime check and alert policies |
All three run the published image, [`ghcr.io/revenuedot/revenuedot`](https://github.com/revenuedot/revenuedot/pkgs/container/revenuedot), built for amd64 and arm64 on every change and tagged `latest`, by date (`2026.10.03`) and by commit. The chart and the AWS Terraform default to it; pin a date or commit tag in production (`image.tag` in the chart, `image` in Terraform) so every replica runs the same build. Cloud Run pulls from Artifact Registry only: copy the image there (`docker pull ghcr.io/revenuedot/revenuedot:<tag>`, `docker tag`, `docker push`) or make an Artifact Registry remote repository that proxies `ghcr.io`, and set the GCP Terraform's `image` to that path.
## What keeps replicas from stepping on each other
| Work | How it runs once |
|---|---|
| Database migrations | A replica that starts takes a Postgres advisory lock before it migrates. The first one migrates; the others wait, then find nothing to do. Or run them once before the rollout (the Helm hook Job, `node --import tsx src/migrate.node.ts`) and start replicas with `REVENUEDOT_MIGRATE=skip` |
| The background job (expirations, Google Play voided purchases, webhooks, integrations, alert emails, win-back emails, credential checks, exports) | Every replica tries every 30 seconds; only the one that gets a Postgres advisory lock runs it, and the others skip that turn. If that replica dies, Postgres drops its lock with its connection and another replica runs the next turn |
| Each webhook delivery | Claimed before it is sent, with a 2-minute lease, and only while no other delivery to the same webhook is being sent. Two runs never send the same delivery, and each webhook gets its deliveries one at a time, oldest first. A run claims deliveries for up to 20 seconds and sends to up to 8 webhooks in parallel |
| Each expiration | Recorded in one transaction that marks the subscription, so it is recorded once |
| Each alert email | Sent only by the run that changed the alert's state |
| Sessions, rate limits, RevenueDot AI answers, OAuth codes | Kept in Postgres already |
Webhooks are delivered **at least once**, as with RevenueCat: a replica killed after your endpoint answered but before the result was saved sends that delivery again 2 minutes later. Deduplicate on `event.id` ([Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)).
## Settings for several replicas
| Variable | Default | What it does |
|---|---|---|
| `REVENUEDOT_PUBLIC_URL` | unset | **Required.** The address behind the load balancer, used in emails and dashboard links. Without it, a replica guesses from the last request it saw |
| `REVENUEDOT_MIGRATE` | `auto` | `auto` migrates on start under the lock. `skip` never migrates (a separate job does) and refuses to start while the database is missing a migration, naming the command to run |
| `REVENUEDOT_BACKGROUND_JOBS` | `on` | `off` keeps a replica to requests only |
| `REVENUEDOT_TICK_INTERVAL_MS` | `30000` | How often each replica tries to run the background job |
| `REVENUEDOT_SHUTDOWN_DELAY_MS` | `5000` | After SIGTERM, how long a replica keeps answering while `/readyz` says 503, so the load balancer stops sending it requests |
| `REVENUEDOT_SHUTDOWN_TIMEOUT_MS` | `20000` | Longest wait for requests in flight and a running background job before the replica exits |
| `DATABASE_POOL_MAX` | `10` | Postgres connections per replica (at least 2). Replicas times this must stay under the database's `max_connections` |
| `REVENUEDOT_ARCHIVE_DIR` | `.data/archives` | Set `db` (or an S3 bucket with `REVENUEDOT_ARCHIVE_S3_*`): a folder on one replica's disk is gone when that replica is replaced. The chart and both Terraform setups set `db` |
| `REVENUEDOT_ENCRYPTION_KEY` | unset | The same value on every replica, from your secret store. It seals integration and export credentials |
Everything else is the same as a single server ([Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#settings)).
## Health checks and shutdown
- `GET /healthz` is **liveness**: 200 while the process runs. It never asks the database, so a database failover does not restart every replica.
- `GET /readyz` is **readiness**: 200 when the database answers within 2 seconds and the replica is not shutting down, 503 otherwise. Point Kubernetes' readiness probe here. On ECS, where a failed load balancer check also replaces the task, the AWS setup checks `/healthz` instead, so a slow database does not restart every task; ECS takes a task out of the load balancer before it sends SIGTERM.
- On **SIGTERM** (Kubernetes, ECS, `docker stop`), a replica turns `/readyz` to 503, stops its background job, waits `REVENUEDOT_SHUTDOWN_DELAY_MS`, closes its port, finishes requests in flight and any running background job, then exits 0. A background job that is running stops after the webhooks in flight; the rest waits for the next run on another replica. Keep the delay plus the timeout under your platform's grace period (30 seconds on Kubernetes and in the AWS setup; Cloud Run allows 10, so the Google Cloud setup uses 0 and 8).
## Kubernetes with Helm
Create a Secret with the database URL and one with the server's secrets, then install the chart from a checkout of the server repository:
```bash
kubectl create namespace revenuedot
kubectl -n revenuedot create secret generic revenuedot-db \
--from-literal=DATABASE_URL='postgres://revenuedot:<password>@<host>:5432/revenuedot?sslmode=require'
kubectl -n revenuedot create secret generic revenuedot-secrets \
--from-literal=REVENUEDOT_ENCRYPTION_KEY="$(openssl rand -base64 32)" \
--from-literal=REVENUEDOT_SMTP_URL='smtps://<user>:<password>@smtp.example.com:465'
helm install revenuedot deploy/helm/revenuedot -n revenuedot \
--set image.repository=<registry>/revenuedot --set image.tag=<tag> \
--set publicUrl=https://revenuedot.example.com \
--set database.existingSecret=revenuedot-db --set secrets.existingSecret=revenuedot-secrets \
--set ingress.enabled=true --set ingress.className=nginx \
--set ingress.hosts[0].host=revenuedot.example.com \
--set ingress.hosts[0].paths[0].path=/ --set ingress.hosts[0].paths[0].pathType=Prefix
kubectl -n revenuedot rollout status deploy/revenuedot && helm test revenuedot -n revenuedot
```
What the chart does by default:
- **Two to ten replicas**, scaled on CPU, spread over zones and nodes, with a PodDisruptionBudget that keeps one up during node drains and `maxUnavailable: 0` on rollouts.
- **Migrations** in a `pre-install,pre-upgrade` hook Job when `database.existingSecret` is set (replicas then start with `REVENUEDOT_MIGRATE=skip`); otherwise each replica migrates on start under the lock. Set `migrations.mode` to `job` or `startup` to choose. Helm waits 5 minutes for the Job by default; pass `--timeout 15m` when a migration may take longer.
- **Probes:** startup and liveness on `/healthz`, readiness on `/readyz`.
- **Security:** uid 1000, no privilege escalation, every capability dropped, read-only root filesystem with a small `/tmp`, no service account token. `networkPolicy.enabled=true` admits traffic only on the HTTP port.
- **Archives** in Postgres unless you set `archives.s3.bucket` (with an access key in your Secret; role credentials such as IRSA are not read yet).
For ingress-nginx, add `nginx.ingress.kubernetes.io/proxy-buffering: "off"` so [RevenueDot AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/revenuedot-ai.md) answers stream. For a quick evaluation without a database, `--set postgresql.enabled=true` adds one Postgres pod with a volume: no failover and no backups, so never for real purchases. All values are documented in the chart's [`values.yaml`](https://github.com/revenuedot/revenuedot/blob/main/deploy/helm/revenuedot/values.yaml).
## AWS with Terraform (ECS on Fargate)
```bash
cd deploy/terraform/aws
cp terraform.tfvars.example terraform.tfvars # domain_name, route53_zone_id, image, alarm_email
terraform init && terraform plan && terraform apply
```
It creates a VPC across 3 zones (public, private and database subnets, one NAT gateway per zone), RDS PostgreSQL 16 Multi-AZ (KMS-encrypted, TLS required, 14 days of point-in-time recovery, Performance Insights, deletion protection), the ECS service (2 to 10 tasks at 1 vCPU and 2 GiB, CPU target tracking, a deployment circuit breaker that rolls back), an Application Load Balancer with HTTPS only (TLS 1.2 and 1.3, HTTP redirected) and its ACM certificate validated in Route 53, Secrets Manager entries for the database URL and the encryption key, VPC flow logs, and CloudWatch alarms for 5xx answers, p95 latency, healthy targets, running tasks, database CPU, storage, memory and connections, and failed background job runs, all sent to one SNS topic.
Each task migrates on start by default. To migrate as a separate step, set `migrate_on_start = false`: tasks then refuse to start on a database missing a migration, so apply a new image in two steps: `terraform apply -target=aws_ecs_task_definition.migrate`, run the `migrate_command` output (it waits and fails if the migration failed), then `terraform apply`. Extra settings go in `environment`; extra secrets (SMTP URL, signing key, licence key, AI keys) go in `secret_arns` as Secrets Manager ARNs. Keep the Terraform state in an encrypted backend: it holds the database password and the encryption key.
## Google Cloud with Terraform (Cloud Run)
```bash
cd deploy/terraform/gcp
cp terraform.tfvars.example terraform.tfvars # project_id, region, image, alert_email
terraform init && terraform plan && terraform apply
```
It creates a VPC and private services access, Cloud SQL for PostgreSQL 16 with regional availability (a standby in a second zone, automatic failover), private IP only, TLS required, backups with point-in-time recovery, Secret Manager entries, the Cloud Run service (2 to 10 instances, CPU always allocated so the background job runs between requests, direct VPC egress), a Cloud Run job for migrations, an uptime check of `/readyz` from several regions and alert policies for failed checks, 5xx answers, latency, database CPU and disk, and failed background job runs. Set `public_url` when you map a custom domain; without it the service's `run.app` address is used.
## Postgres
- **Version 16 or later**, with a standby in another zone. Every write is in Postgres, so it is the part to make highly available; the replicas are stateless.
- **Connections:** replicas times `DATABASE_POOL_MAX`, plus a few for migrations. Ten replicas at 10 is 100.
- **Poolers:** connect directly, through RDS Proxy, or through PgBouncer in **session** mode. PgBouncer in transaction mode breaks the advisory locks.
- **Failover:** RDS and Cloud SQL keep the same address. During the minute or so of a failover, requests that need the database fail with 5xx and `/readyz` turns 503; the SDKs retry receipts that got a 5xx, and replicas reconnect by themselves.
## Upgrades without downtime
Migrations run before the new version takes traffic, while the old version still serves requests. Releases keep each migration compatible with the version before it (add a column, ship, then remove the old one in a later release); the release notes say when an upgrade needs more. Then the platform replaces replicas one at a time, and each old replica drains before it exits. See [Upgrades](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/upgrades.md) for backups and rolling back.
## How it is tested
- Unit tests run two background job runs at once and check that each webhook, expiration and alert email happens once.
- A run on a real Postgres starts **three replicas at once** on an empty database, sends 300 Test Store purchases through a load balancer that health-checks `/readyz`, stops one replica with SIGTERM in the middle (it exits in about 1.5 seconds) and starts it again, forces 40 expirations and points a second webhook at a failing endpoint. It checks each migration ran once, all 300 purchases succeeded, every one of the 340 events reached the working webhook exactly once, the failing webhook's alert email went out once, and no two background job runs overlapped ([`scripts/e2e/cluster/run.ts`](https://github.com/revenuedot/revenuedot/blob/main/scripts/e2e/cluster/run.ts)).
- CI lints and renders the chart, validates it against Kubernetes 1.29 to 1.33, validates and lints both Terraform setups, and runs the image the way the chart does: a migration job first, then two non-root replicas on a read-only filesystem, one stopped with SIGTERM.
## Related
- [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md)
- [Upgrades](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/upgrades.md)
- [Backups](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md)
- [Service level agreement](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sla.md)
- [Enterprise](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md)
---
# How do I upgrade a self-hosted RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/upgrades.md
Description: Back up the database, pull the new image and restart. The server applies new database migrations by itself when it starts; there is no separate migrate step.
Back up, pull, restart. The server applies any new database migrations when it starts, before it accepts requests, so there is no separate migration command. Your `.env` stays as it is.
```bash
cd revenuedot
docker compose exec -T db pg_dump -U revenuedot -Fc revenuedot > revenuedot-before-upgrade.dump # 1. back up
docker compose pull # 2. the new image
docker compose up -d # 3. restart
curl -s http://localhost:8787/v1/health # 4. {"status":"ok"}
```
## What happens during the restart
- The old container stops and the new one starts. Requests in between fail for a few seconds.
- **The SDKs handle this.** A failed receipt post is kept on the device and retried, and customer info comes from the SDK's cache.
- **Stores retry.** Apple and Google resend notifications that got no 2xx answer.
- **Webhooks wait.** Pending deliveries stay in the database and go out after the restart.
For no downtime at all, run two or more replicas behind a load balancer and replace them one at a time: see [High availability](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/high-availability.md#upgrades-without-downtime). Read the release notes first; they list any breaking change and the steps it needs.
## If the new version does not start
1. Read the log: `docker compose logs revenuedot --tail 100`. A failed migration names the statement.
2. Go back to the build that worked: set `REVENUEDOT_IMAGE=ghcr.io/revenuedot/revenuedot:<date or commit tag>` in `.env` and run `docker compose up -d`. The tags are listed on the [package page](https://github.com/revenuedot/revenuedot/pkgs/container/revenuedot).
3. If a migration already ran, restore the backup as described in [Backups](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md#restore), then start the previous version.
## Keep up with changes
- Watch the [server repository](https://github.com/revenuedot/revenuedot) for commits and, later, releases.
- The image is built from `main` on every change (tagged `latest`, by date and by commit) and on every release tag. Pin a date or commit tag in `.env` to choose when you upgrade.
- Migrations live in `packages/db/migrations`. Each upgrade applies the ones your database has not seen, in order.
- Accounts made by builds from before 2026-09-30 used 210,000 password-hashing iterations; newer builds use 100,000. Both verify on a self-hosted server, so nobody needs to reset a password.
## Related
- [Backups](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md)
- [High availability](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/high-availability.md)
- [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md)
- [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md)
---
# How do I back up and restore a self-hosted RevenueDot?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md
Description: Everything lives in Postgres. Back it up with pg_dump on a schedule, keep copies off the server, and restore with pg_restore while the RevenueDot container is stopped.
All of RevenueDot's state is in Postgres: projects, apps and their store credentials, the catalog, customers, purchases, events, webhook deliveries and API key hashes. Back up the database with `pg_dump` on a schedule and keep the copies somewhere other than the server. The container itself holds nothing you need to keep.
## Back up
```bash
# A compressed custom-format dump of the bundled Postgres
docker compose exec -T db pg_dump -U revenuedot -Fc revenuedot > revenuedot-$(date +%F).dump
```
Run it daily, for example from cron, and copy the file to object storage:
```cron
15 3 * * * cd /srv/revenuedot && docker compose exec -T db pg_dump -U revenuedot -Fc revenuedot > /backups/revenuedot-$(date +\%F).dump
```
- **The dump contains secrets.** App store credentials (the App Store `.p8` key, Google service account JSON) and webhook signing secrets are stored in the database. Encrypt backups and limit who can read them.
- **Managed Postgres** (RDS, Cloud SQL, Neon, Supabase and others) has its own point-in-time recovery. Turn it on; it covers you between dumps.
- **Store the signing key separately.** `REVENUEDOT_SIGNING_KEY` is not in the database. Keep it in your password manager.
## Restore
Stop the API, restore, start it again:
```bash
docker compose stop revenuedot
docker compose exec -T db pg_restore -U revenuedot -d revenuedot --clean --if-exists < revenuedot-2026-09-30.dump
docker compose start revenuedot
```
After a restore, the database is as it was at the dump. Purchases made since then come back by themselves:
- Apps post receipts again on their next `syncPurchases()`, restore or purchase.
- Store notifications that failed while the server was down are retried by Apple and Google.
- For a long gap, re-run the migration importer from RevenueCat if you are still in a [dual run](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/dual-run.md), or ask users to restore purchases.
## Start over
```bash
docker compose down -v # deletes the volume: every customer and purchase
```
## Export one project
`pg_dump` copies the whole server. To keep or load a single project, download its full export (**Project settings → Export and move → Export project**, or `npx revenuedot export`): every table as JSON Lines with a manifest and checksums, loadable into any RevenueDot server. See [Move projects and export everything](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/move-projects.md).
## Related
- [Move projects and export everything](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/move-projects.md)
- [Upgrades](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/upgrades.md)
- [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md)
- [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md)
---
# How do I move a project between self-hosted RevenueDot and RevenueDot Cloud, or export everything?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/move-projects.md
Description: One command or the dashboard copies a project to another RevenueDot server with its ids, SDK keys, secret keys and webhook signing secrets, verifies every table, then forwards the old server's traffic. A full export gives you every table as JSON Lines with a manifest and checksums.
Run `npx revenuedot move --from <old server> --to <new server>`, or use **Project settings → Export and move** in the dashboard. The project arrives on the new server with the same project, app and customer ids, the same public SDK keys (`appl_`, `goog_`, `test_` …), the same secret API keys (`sk_`) and the same webhook signing secrets. Your apps and your backend keep working without a change. After the switch the old server forwards every SDK call, REST call and store notification to the new one until you point your app and the stores at the new address.
It works in both directions: from your own server to RevenueDot Cloud (`https://api.revenuedot.app`), from Cloud to your own server, or between two self-hosted servers.
## What moves
Everything the project owns, 70 tables in all: the project and its settings, apps and their store credentials, the catalog (products, entitlements, offerings, packages), customers with their aliases, attributes and attribution, subscriptions, one-time purchases, transactions, events, webhooks and their delivery log, integrations, scheduled data exports, paywalls with their versions and images, audiences, targeting rules, experiments, in-app currencies with balances and the ledger, Refund Control, retention offers, win-back campaigns, support tickets, web billing (web products, purchase links, funnels, discounts, domains), Auth providers, blocked customers, Verified Metrics, Stripe Connect connections, payment recovery cases and emails, and the audit log.
What does not move:
- **Your teammates' accounts and passwords.** The archive lists each collaborator's email and role, and the move lists them for you to invite on the new server (**Project settings → Collaborators**). Nobody is added without an invite, even with an account there. The person who receives the project owns it there.
- **A custom domain's verification.** DNS proves a domain to one server, so on the new server the domain waits for **Verify**: open **Project settings → Domains** there for its new TXT value, point the CNAME at the new server, then verify. The finish step lists the domain.
- RevenueDot AI conversations (they belong to one person), pending invites, sessions and subscriber access tokens (they last an hour).
## Move with the command line
1. **On the new server, create an import token.** Sign in, open the project switcher and choose **Receive a project** (or go to `/projects/receive`), then **Create import token**. Copy the token (`rdi_…`); it is shown once and works for 24 hours. RevenueDot Cloud asks you to confirm your email address first.
2. **On the old server, create a secret API key** for the project with the **project configuration: read and write** permission (API keys page).
3. **Check what will move.** Nothing is written on either server:
```bash
npx revenuedot move --from https://revenuedot.example.com --to https://api.revenuedot.app --dry-run
```
The CLI asks for the secret key and the import token and hides what you type. In CI, set `REVENUEDOT_FROM_KEY` and `REVENUEDOT_TO_TOKEN` instead. The dry run prints, per table, the rows in the archive, the rows the new server has now and the difference.
4. **Copy and verify.** The old server keeps serving your apps:
```bash
npx revenuedot move --from https://revenuedot.example.com --to https://api.revenuedot.app
```
The CLI exports the project, copies each file, then has the new server recompute the row count and a checksum of every table and compares them with the archive. It ends with `All 70 tables match`. If the copy stops (network, laptop sleep), run the same command again: a state file in the current folder (`revenuedot-move-<old host>-to-<new host>.json`, or `--state <file>`) remembers which files are done.
Your apps keep using the old server during the copy, and it is read table by table. A row that belongs to something created after its table was read, such as the alias of a user who installed the app a minute ago, is left out and counted, and the verification says how many. `--finish` copies everything again, so nothing is lost.
5. **Switch.** When you are ready:
```bash
npx revenuedot move --from https://revenuedot.example.com --to https://api.revenuedot.app --finish
```
`--finish` pauses writes on the old server, waits 10 seconds so every server process sees the pause, copies again so nothing written in the meantime is lost, verifies, puts the project live on the new server and makes the old one forward. If anything fails before the project is live on the new server (verification finds a difference, the network drops), the pause is lifted and the old server keeps serving; run the same command again to retry.
Exit codes: `0` done, `1` failed or verification found differences, `2` a usage error, `130` cancelled.
## Move from the dashboard
On the old server open **Project settings → Export and move → Move this project**. Choose **RevenueDot Cloud** or type another server's URL, paste the import token from the new server's **Receive a project** page, then:
1. **Check**: the same dry run, as a table of rows per table.
2. **Copy data**: the old server runs the copy and the verification itself. You can close the page; the progress is kept.
3. **Finish move**: pauses, copies the last changes, verifies, goes live there and forwards from here. **Cancel move** stops at any point before that.
Only project Admins can export or move a project.
## During and after the switch
| State | Where | What happens |
|---|---|---|
| Paused | Old server, for the last copy | Reads work. Purchases (`POST /v1/receipts` and the other SDK writes) and store notifications answer `503` with `Retry-After: 60`: the SDK keeps the transaction and retries, Apple and Google retry notifications. API v2 writes answer `423`. Webhooks waiting to be sent move with the data and are sent once, by the new server |
| Forwarded | Old server, after the switch | Every `/v1`, `/rcbilling` and secret-key `/v2` request for the project, and every store notification, is passed to the new server with the same method, path, headers and body. The answer, response signature included, comes back unchanged with an `x-revenuedot-moved-to` header. The dashboard shows "This project moved to …" |
| Incoming | New server, while copying | The project is not live. Reads work; SDK writes and store notifications answer `503` and API v2 writes answer `423`. Nothing runs on a schedule for it. An Admin can still delete it, for example after giving up on a move |
Then, at your own pace:
1. **Point your app at the new server** in your next release: set the SDK's proxy URL (`Purchases.proxyURL` on iOS, `setProxyURL` elsewhere) to the new server. Old app versions keep working through the forward.
2. **Change the store notification URLs.** Only the host changes; the path keeps the app id: `https://<new server>/v1/notifications/{apple|google|amazon|stripe}/{app_id}`. The finish step prints the exact URL for each app and where to change it:
- App Store Connect → your app → App Information → App Store Server Notifications (production and sandbox URLs).
- Play Console → Monetize → Monetization setup → Real-time developer notifications: the endpoint of the Pub/Sub push subscription.
- Amazon Developer Console → Real-time Notifications: the SNS subscription.
- Stripe Dashboard → Developers → Webhooks.
3. **Keep the old server running** until no traffic reaches it. Its request log shows the forwarded calls.
To undo a finished move, call `POST /v2/projects/{project_id}/move/cancel` on the old server: it serves the project again, and the copy on the new server stays.
## Export everything
**Project settings → Export and move → Export project** makes one archive of everything listed above. It is built in the background in short slices and kept for 7 days; **Download** gives a link that works for an hour. From the command line:
```bash
npx revenuedot export --from https://api.revenuedot.app --out my-project.tar
```
The archive is a `.tar` with:
```
manifest.json format, version, schema, the project, and per table: columns, rows and checksum
members.json email and role of each collaborator (no passwords)
tables/<table>/0001.jsonl.gz one row per line, as stored (UTC timestamps)
secrets/<table>/0001.json.enc only with a passphrase
```
Each table's `checksum` is the hex sum, modulo 2^256, of the SHA-256 of every row line, so it does not depend on row order or how rows are split into files. Each file entry also has the SHA-256 of its gzip bytes.
**Secrets** (store credentials, Amazon and Stripe keys, integration secrets, webhook signing secrets and authorization headers) are left out unless you give a passphrase of 12 or more characters (`--include-secrets`, or the passphrase field in the dashboard). Then they are encrypted with AES-256-GCM and a key derived from the passphrase with PBKDF2-SHA-256. Without them, a server that loads the archive gives each webhook a new signing secret and lists the apps whose store credentials you must enter again. `npx revenuedot move` always encrypts secrets with a random passphrase it never shows, so a move keeps them.
Load an archive into a server with `npx revenuedot move --from-archive my-project.tar --to <server>`.
### Where archives are stored
| Server | Storage |
|---|---|
| RevenueDot Cloud | RevenueDot Cloud's own storage, deleted after 7 days |
| Self-hosted | A folder on disk, `REVENUEDOT_ARCHIVE_DIR` (default `.data/archives`, a volume in `docker-compose.yml`). An S3-compatible bucket (AWS S3, Cloudflare R2, MinIO) when `REVENUEDOT_ARCHIVE_S3_BUCKET` is set, with `REVENUEDOT_ARCHIVE_S3_ENDPOINT`, `REVENUEDOT_ARCHIVE_S3_REGION`, `REVENUEDOT_ARCHIVE_S3_ACCESS_KEY_ID` and `REVENUEDOT_ARCHIVE_S3_SECRET_ACCESS_KEY`. `REVENUEDOT_ARCHIVE_DIR=db` keeps them in Postgres |
## API
Every step has an endpoint, so you can script a move. See the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#data-moves): `POST /v2/projects/{project_id}/exports`, `POST /v2/imports/tokens`, `POST /v2/imports`, `PUT /v2/imports/{import_id}/files/{name}`, `POST /v2/imports/{import_id}/verify`, `POST /v2/imports/{import_id}/finish`, and the move state endpoints `pause`, `forward` and `cancel`.
## Troubleshooting
- **"That is not an import token"**: copy the token from the new server's **Receive a project** page; it starts with `rdi_` and lasts 24 hours.
- **"The archive collides with another project on this server"**: the new server already has a project with the same id or public key, usually a copy left from an earlier move. Run again with `--replace` to replace it.
- **"A project with id … already exists on this server"** after a copy you gave up on: the unfinished copy is still on the new server. Delete it there (**Project settings → General → Delete project**), create a new import token and move again.
- **The archive was written by a newer server**: upgrade the server you load it into. An archive loads into a server with the same or a newer schema.
Moving from RevenueCat instead? See [Migrate from RevenueCat](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/README.md).
---
# How does RevenueDot Cloud billing work?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/cloud-billing.md
Description: RevenueDot Cloud has two plans. Pro costs $0 until your apps make $10,000 a month, then 0.5% of revenue above $10,000, never more than $999 a month. Enterprise has custom pricing from $50,000 a year. Building and testing are free; going live needs Pro.
**Building and testing are free, no card needed. Going live needs Pro, which costs $0 until your apps make $10,000 a month, then 0.5% of revenue above $10,000, never more than $999 a month.** Enterprise has custom pricing from $50,000 a year. After your first live sale you have 14 days to start Pro; after that, live charts, customer data, exports and webhooks pause until you do. Your app keeps working the whole time: purchases are always verified and every purchase unlocks.
For a quick look at the whole product, watch the [2:32 platform demo](https://revenuedot.app/watch/revenuedot-platform-demo). Prices are also on [revenuedot.app/pricing](https://revenuedot.app/pricing).
## The two plans
| Plan | Price | Who it is for |
|---|---|---|
| **Pro** | $0 until your apps make $10,000 a month, then 0.5% of revenue above $10,000, never more than $999 a month. The rate never rises | Every app on RevenueDot Cloud, up to $1,000,000 of tracked revenue a month. [Start for free](https://app.revenuedot.app/signup) |
| **Enterprise** | Custom pricing from $50,000 a year | Apps above $1,000,000 a month, or teams that need SCIM, long audit retention, compliance exports, the SLA or a commercial licence. [Contact sales](https://revenuedot.app/contact-sales) |
What each plan includes:
- **Pro** includes every feature (paywalls, experiments, charts, integrations and webhooks), unlimited apps, projects and teammates, organizations, custom roles and single sign-on (SAML 2.0 and OpenID Connect, verified domains, required SSO). Audit logs keep 90 days. Email support sends a first reply within 2 business days; this is a target, not an SLA.
- **Enterprise** includes everything in Pro with volume pricing, plus SCIM, audit retention from 30 days to 10 years (or forever), signed compliance exports, data location settings (Cloud runs in the US only today), a 99.9% uptime [SLA](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/sla.md), 1-hour support when purchases fail, and a commercial licence to self-host with every `ee/` feature. RevenueDot marks your account as Enterprise when the contract is signed.
An account with no plan is in the build stage. It is not a plan you pick: every new account starts there, and it ends when you start Pro. With no plan you get every product feature for building and testing, but no organizations, custom roles or single sign-on. [Which plan has which feature](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md) has the full table.
### What a month of Pro costs
| Tracked revenue in the month | Pro bill |
|---|---|
| $9,000 | $0 |
| $10,001 | $0.01 |
| $50,000 | $200 |
| $209,800 or more | $999 (the cap) |
## What counts as tracked revenue
Tracked revenue is the sum, in US dollars at the exchange rate of the purchase date, of the production purchases that earned money in every project you own, in one calendar month (UTC).
- **Counted:** new purchases, renewals and one-time purchases, from every store, in the month they were made.
- **Not counted:** sandbox and Test Store purchases, free trials, refunds, history written by a [RevenueCat import](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/importer.md), and history copied in by a [move](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/move-projects.md) from another server (that revenue was tracked there).
- **Refunds are not subtracted.** A refunded purchase still counts in the month it was made.
The Billing page updates the numbers about once an hour.
## Start Pro
1. Open your account menu → **Billing** (`/account/billing`).
2. Click **Start Pro**. Stripe Checkout opens and asks for a card. You pay $0 today.
3. Billing starts on the 1st of next month and repeats on the 1st of every month, with no proration. Each invoice charges the bill for the month before. Under $10,000 of tracked revenue that bill is $0.
RevenueDot bills through its own Stripe account. It never touches the Stripe account you sell with. In Stripe, the subscription is called **RevenueDot Pro**.
The Billing page shows:
- your stage (building, grace with its end date, paused, Pro or Enterprise) and the **Start Pro** button;
- **tracked revenue** this month, in total and per project, and the **bill so far**;
- the two plans, with **Start Pro**, **Manage billing** or **Contact sales**, and what each plan includes;
- **invoices**, with links to Stripe's invoice page and PDF.
An account has one Pro subscription. While it is active, **Start Pro** is not offered again, and a second Checkout opened in another tab is closed automatically.
## The go-live gate
**Going live** means your account's first live sale: a production purchase that earned money, in any project you own. Sandbox, Test Store, trial, imported and moved-in purchases do not count. From that sale you have 14 days to start Pro.
| Stage | When | What happens |
|---|---|---|
| **Building** | No live sale yet, no plan | Everything works. The setup checklist ends with "Start Pro before you release" |
| **Grace** | A live sale, no plan, within the 14 days | Everything works. A banner on every page shows the end date, and you get an email at once and a reminder 2 days before the end |
| **Paused** | A live sale, no plan, after the 14 days | Live data and outbound deliveries pause (below). A red banner shows on every page, and you get one email |
| **Active** | Pro (active or past due) or Enterprise | Everything works. Held deliveries are sent |
The project's owner pays. Every project follows its owner's stage, including projects in an organization.
### What pauses
When the owner's account is paused:
- **Reads of live data answer 402 `plan_required`**, in the dashboard and the API: overview metrics, charts, attribution, benchmarks, customer lists, the customer list and customer pages in the dashboard, transactions, ad revenue, payment recovery cases, win-back campaigns and RevenueDot AI conversations and insights. Sandbox reads (`environment=sandbox`) of the overview, charts, transactions, attribution and one customer keep working.
- **Creating or editing paywalls, experiments, targeting rules and customer lists answers 402.** Paywalls and experiments that are already live keep serving.
- **Webhook and integration deliveries of production events are held**, not dropped (below). Test events from "Send test" are still sent.
- **Scheduled data exports wait** and run from where they stopped once Pro starts.
### What never pauses
In every stage, these keep working:
- the SDK and every SDK endpoint;
- receipt and purchase verification, so every purchase unlocks;
- entitlements and customer info;
- App Store and Google Play server notifications;
- the REST v1 subscriber endpoints, and REST v2 reads of one customer, subscription or purchase with a secret key, so your backend can still check access;
- sandbox and Test Store data everywhere;
- sign-up, projects, apps, store credentials, products, entitlements and offerings;
- paywalls and experiments that are already running;
- settings: payment recovery on and off, pausing or deleting a win-back campaign, benchmark sharing and the ads setup;
- imports, moves and a move's full export (your data can always leave), members and API keys.
### The 402 plan_required error
A paused read answers HTTP 402 with this body:
```json
{
"object": "error",
"type": "plan_required",
"message": "Live data is paused because this account has no plan. Start Pro on the Billing page: it costs $0 until your apps make $10,000 a month.",
"doc_url": "https://revenuedot.app/docs/api/errors#plan-required",
"retryable": false,
"upgrade_url": "https://app.revenuedot.app/account/billing"
}
```
A teammate who is not the owner gets a message that names the owner: "Live data is paused because the project owner, Dana, has not started Pro. Ask them to start it on their Billing page." In the dashboard, the page shows a panel with **Start Pro** for the owner. See [API errors](https://raw.githubusercontent.com/revenuedot/docs/main/api/errors.md#plan-required).
### Held webhooks and integration deliveries
While the owner's account is paused, deliveries of production events to [webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md) and [integrations](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md) are held:
- The delivery log shows them as **Held: start Pro to send**, and the API returns `status: "held"`.
- When Pro starts, held deliveries go out in order, oldest first.
- A delivery held for more than 30 days is marked failed instead of sent.
- Sandbox and Test Store events are never held.
## Payment failures
Stripe is the source of truth for your subscription.
- **Past due.** A payment failed and Stripe is retrying it. You keep Pro and everything works. A banner on every page links to your card, and you get one email per invoice.
- **Unpaid.** Every retry failed. The account goes back to no plan. A live account is paused at once, because its 14 days were already used.
- **Canceled.** The plan ended. The account goes back to no plan, and a live account is paused at once.
To end a pause, start Pro again from the Billing page. An unpaid invoice stays open and payable there.
## Change your card or cancel
**Manage billing** opens Stripe's Customer Portal. There you change the card, see invoices or cancel. A cancelled Pro plan stays active until the end of the period. After that, the account has no plan, and a live account is paused.
## Emails and banners
- **No plan, after the first live sale:** at most three emails. One when the first live sale is seen, a reminder 2 days before the 14 days end, and one when the account is paused. A banner on every page in grace and when paused.
- **Pro:** an email when the month's bill reaches the $999 cap ("you will not pay more this month"), and at 80% and 100% of $1,000,000, when Enterprise fits better.
- **A failed payment:** a banner on every page with a link to update your card, and one email per invoice.
## Enterprise
Enterprise is a contract with custom pricing from $50,000 a year. [Contact sales](https://revenuedot.app/contact-sales) or write to [sales@revenuedot.app](mailto:sales@revenuedot.app). Enterprise accounts are never paused, and the Billing page shows the bill as "By contract".
## Billing on a server you run yourself
Self-hosted servers have no billing and no go-live gate. The Billing page says billing is only on RevenueDot Cloud, and `/v2/billing` answers 404. There is no metering. The `ee/` features (organizations, custom roles, single sign-on and the rest) need an Enterprise licence key on a self-hosted server. See [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md), and [Move between self-host and Cloud](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/move-projects.md) to switch either way.
## API
These endpoints take a dashboard session, not an API key. See the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#cloud-billing).
- `GET /v2/billing` returns `account.plan` (`none`, `pro` or `enterprise`) and its Stripe `status`, `gate` (`stage`: `building`, `grace`, `paused` or `active`, with `live_at`, `grace_ends_at` and `grace_days`), the plans, this month's `usage` (`tracked_revenue_usd`, per project, `bill_usd`, `pro_bill_usd`, `free_up_to_usd`, `cap_usd`), `flags` for banners (`past_due`, `unpaid`, `live_grace`, `live_paused`, `over_pro_limit`) and the invoices.
- `POST /v2/billing/checkout` with `{ "plan": "pro" }` returns the Stripe Checkout URL.
- `POST /v2/billing/portal` returns the Customer Portal URL.
- `GET /auth/me` returns `account.gate` and `account.project_gates`, the stage of each project's owner.
---
# What should I check before running RevenueDot in production?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md
Description: A checklist for a self-hosted RevenueDot with real customers - HTTPS, a real Postgres with backups, store credentials and notifications verified, webhooks tested, secrets kept out of apps, and monitoring.
Work through this list before real customers depend on your server. Run a real sandbox purchase on each store first, and consider a [dual run](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/dual-run.md) next to your current system.
## Server
- [ ] HTTPS in front of the server, with a certificate that renews itself. See [Self-hosting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#put-https-in-front).
- [ ] A real Postgres (`DATABASE_URL=postgres://...`), not the embedded PGlite.
- [ ] `POSTGRES_PASSWORD` changed from the default before the first start.
- [ ] Daily backups copied off the server, and one test restore done. See [Backups](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/backups.md).
- [ ] One `revenuedot` container per database.
- [ ] Sign-up closed (`REVENUEDOT_ALLOW_SIGNUP` unset); add teammates with [invites](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md) instead.
- [ ] `REVENUEDOT_SMTP_URL`, `REVENUEDOT_MAIL_FROM` and `REVENUEDOT_PUBLIC_URL` set, and one password reset email received, so resets, invites and [alert emails](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md) reach people. See [Email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email).
- [ ] Uptime monitoring on `GET /v1/health`, and alerts on the container's restarts.
- [ ] `REVENUEDOT_SIGNING_KEY` set and stored in a password manager, if you ship SDK builds that verify responses. See [Trusted Entitlements](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/trusted-entitlements.md).
## Stores
- [ ] Each store app has its credentials, and **Check credentials** says valid: the App Store In-App Purchase key, the Google Play service account.
- [ ] Store notifications arrive: the app's status is **Ready** in the dashboard, or `notification_status: "ready"` in `GET /v2/projects/{project_id}/setup_health`.
- [ ] App Store Connect has RevenueDot's URL as both the Production and Sandbox Server URL, Version 2.
- [ ] Google Play's Pub/Sub topic has a push subscription to RevenueDot, and Play Console's test notification arrived.
- [ ] Every product's `store_identifier` matches the store exactly (Google Play subscriptions as `subscriptionId:basePlanId`), and each product is attached to the right entitlement and package.
## Apps
- [ ] The SDK's proxy URL is your HTTPS URL, set before `configure`.
- [ ] Entitlement verification is `DISABLED` with the stock SDK, or the app uses a fork built with your key.
- [ ] Release builds use the store keys (`appl_`, `goog_`), never a `test_` key.
- [ ] No secret key (`sk_...`) anywhere in an app.
## Your backend
- [ ] Webhooks verify the `X-RevenueCat-Webhook-Signature` HMAC and deduplicate on `event.id`. See [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md).
- [ ] A test event reached your backend and was answered 200.
- [ ] Secret keys used by your backend have only the permissions they need. See [Authentication](https://raw.githubusercontent.com/revenuedot/docs/main/api/authentication.md).
- [ ] Failed deliveries are watched: `GET /v2/projects/{project_id}/setup_health` lists failing webhooks.
## Related
- [Cutover checklist for a migration](https://raw.githubusercontent.com/revenuedot/docs/main/docs/migrate/cutover-checklist.md)
- [Known issues](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/known-issues.md)
- [Troubleshooting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/troubleshooting.md)
---
# How do I invite my team to a RevenueDot project?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md
Description: Project admins invite people by email with the Admin, Developer or Viewer role. The link lasts 7 days. Admins change roles and remove members; a project always keeps one admin.
Open **Project settings → Collaborators** and click **Invite**. Enter the person's email address, pick a role and send. They get an email with a link that works for 7 days. Only project admins can invite, change roles and remove people. Everyone in a project is a **member** with one role in that project; a person can have a different role in each project.
## Roles
The roles follow RevenueCat's collaborator roles ([Collaborators](https://www.revenuecat.com/docs/projects/collaborators)). RevenueDot has three of them today.
| Role | Can do | Cannot do | Name in API v2 |
|---|---|---|---|
| **Admin** | Everything: apps, store credentials, products, entitlements, offerings, customers, webhooks, secret API keys, invites, members, deleting the project | Nothing is off limits | `admin` |
| **Developer** | Read everything. Edit apps, store credentials, the catalog, customers, webhooks and project settings | Create or revoke secret API keys, invite people, change roles, remove other members, delete the project | `developer` |
| **Viewer** | Read everything the dashboard shows | Change anything | `read_only` (RevenueCat's "View Only") |
`GET /v2/projects/{project_id}/collaborators` answers with RevenueCat's role names, so the Viewer role comes back as `read_only`. Requests that set a role take `admin`, `developer` or `viewer`.
**Custom roles** (for example a support agent who can refund but not edit the catalog) are included with Pro on Cloud, or with an Enterprise licence when self-hosting ([Custom roles](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md#custom-roles)). A member with one shows **Custom role** in Collaborators, and the API returns the role's id (`role_...`). Single sign-on comes with the same plans ([Single sign-on](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/single-sign-on.md)); SCIM needs Enterprise ([SCIM](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/scim.md)).
## Invite someone
1. Open **Project settings → Collaborators** and click **Invite**.
2. Enter the email address and pick **Admin**, **Developer** or **Viewer**.
3. Click **Send invite**. The invite shows under **Pending invites** until the person accepts it.
- **The link lasts 7 days.** An expired invite stays in the list, so you can send it again.
- **Resend** sends a new link that lasts another 7 days. The old link stops working.
- **Revoke** makes the link stop working at once. You can invite the same address again later.
- **Inviting an address that already has a pending invite** replaces it: the new role applies, and only the newest link works.
- **Inviting someone who is already a member** fails with a message that they are already in the project.
- **A project can send 50 invites a day**, resends included. After that, try again the next day.
- **On RevenueDot Cloud, you need a confirmed email address to invite people.** A banner at the top of the dashboard offers a new confirmation email if you lost the first one. Self-hosted servers treat every account as confirmed.
If the dashboard says the invite was saved but the email could not be sent, the mail server refused it. Fix the mail settings, then click **Resend**. On a self-hosted server without email, the invite link is printed to the server log; see [Email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email).
## Accept an invite
The link in the email opens the invite page. It shows the project, the role and who invited you.
- **You already have an account:** sign in with the invited address and click **Accept invite**. If you are signed in with another address, sign out and sign in with the invited one. If you are already a member of the project, you keep your current role.
- **You are new:** create an account on the invite page. The email address is fixed to the invited one, and it counts as confirmed, so you get no confirmation email. You join the project instead of getting an empty one.
A self-hosted server closes sign-up after the first account (the owner). An invite still lets the invited address create an account. Nobody else can sign up unless the server runs with `REVENUEDOT_ALLOW_SIGNUP=true`.
## Change a role, remove a member, or leave
- **Change a role:** admins pick a new role in the member's row.
- **Remove a member:** admins open the member's menu and click **Remove from project**. The person loses access at once.
- **Leave a project:** any member can open their own menu and click **Leave project**.
- **A project always keeps at least one admin.** The last admin cannot be demoted, removed or leave. Make someone else an admin first, or delete the project.
## Do it with the API
These are RevenueDot extensions. They need a dashboard session (the `rd_session` cookie from `POST /auth/login`); secret API keys cannot manage members. See [Members and invites](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#members-and-invites) for request and response details.
| Task | Request |
|---|---|
| List members | `GET /v2/projects/{project_id}/collaborators` |
| List pending and expired invites | `GET /v2/projects/{project_id}/invites` |
| Invite by email | `POST /v2/projects/{project_id}/invites` with `{"email": "sam@example.com", "role": "developer"}` |
| Resend an invite | `POST /v2/projects/{project_id}/invites/{invite_id}/actions/resend` |
| Revoke an invite | `DELETE /v2/projects/{project_id}/invites/{invite_id}` |
| Change a member's role | `POST /v2/projects/{project_id}/collaborators/{user_id}` with `{"role": "viewer"}` |
| Remove a member, or leave (your own `user_id`) | `DELETE /v2/projects/{project_id}/collaborators/{user_id}` |
| Look up an invite from its link | `GET /auth/invites/{token}` (no session) |
| Accept as an existing user | `POST /auth/invites/{token}/accept` |
| Sign up from an invite | `POST /auth/signup` with `invite_token` |
## Related
- [Alert emails](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md): what admins get told when something breaks
- [Self-hosting: Email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email)
- [Projects, apps and API keys](https://raw.githubusercontent.com/revenuedot/docs/main/docs/concepts/projects-and-apps.md)
- [Enterprise](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/enterprise.md): organizations, custom roles, single sign-on and SCIM
---
# How do I manage my RevenueDot account settings?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/account-settings.md
Description: Change your email or password, turn on two-factor authentication, sign out sessions, revoke AI assistants, pick summary and anomaly emails, a theme, a tint, your first day of the week and the currency the dashboard shows.
Open the project switcher at the top of the sidebar and choose **Account settings**, or go to `/account`. The page has six sections in the left navigation: **General**, **Billing**, **Security**, **Notifications**, **Interface** and **Date and region**. Everything here is yours alone; project settings live under **Project settings** in each project.
## General
- **Name.** Shown to teammates and in invites you send.
- **Email.** Click **Change email**, enter the new address and your current password (and a two-factor code if it is on). RevenueDot emails a link to the new address and tells the old address about the change. The account moves only when you open the link and click **Confirm new email**; opening the link alone changes nothing, so a mail scanner cannot confirm it. The link works once and expires after 24 hours. Until then the old address keeps working, and **Cancel change** stops the link. Links sent to the old address earlier (password resets) stop working once the account moves.
- **Stripe accounts.** Every Stripe account connected with **Connect with Stripe** to a Stripe app in your projects, by you or a teammate, with its mode (Live or Test) and status. Connect and disconnect on the app's page; see [Stripe](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/stripe.md).
- **Log out** signs out this browser. **Log out of all sessions** signs out every browser, this one included.
- **Delete account.** Type your email, your password and, with two-factor on, a code. RevenueDot deletes your account, your sessions, your two-factor settings, your notification choices, the OAuth keys listed under **Active OAuth tokens** and every project in which you are the only member. Projects other people use stay with them, and their audit log records that you left, with your email. Deletion is refused while:
- you **own a project that has other members**: transfer ownership first in **Project settings → General** ([Project settings](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/project-settings.md)), or remove the members;
- you are the **last admin** of a project with other members: make someone else an admin;
- a **Pro plan** is still active: cancel it on the Billing page first, so you are not charged for a deleted account ([Cloud billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/cloud-billing.md));
- you are the **only owner of an organization** that has other members: make someone else an owner of the organization first.
## Billing
**Owned projects** lists the projects you own with your role, the number of members and the owner's plan (Pro, Enterprise, or No plan). The projects you belong to but do not own follow with their owner. On RevenueDot Cloud the plan, this month's tracked revenue, the bill so far and your invoices follow ([Cloud billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/cloud-billing.md)). Self-hosted servers have no billing.
## Security
- **Update password.** Enter the current password and the new one twice. Every other session is signed out, a sign-in that is waiting for its two-factor code has to start again, and you get an email. After 10 password checks in 15 minutes (here, in two-factor setup, email change or deletion), RevenueDot refuses more until 15 minutes after the first.
- **Two-factor authentication.** Click **Set up**, confirm your password, scan the QR code with an authenticator app (Google Authenticator, 1Password, Authy or any app that reads TOTP codes) or type the key, then enter the 6-digit code it shows. You get **10 recovery codes** once: keep them in a password manager. Each signs you in once without your phone.
- From then on, sign-in asks for the code after your password. A code works once; you have one step (30 seconds) of clock drift either way.
- **Lost your phone?** On the code screen choose **Use a recovery code**. RevenueDot emails you when a recovery code signs you in and says how many are left. **Make new codes** replaces them all.
- **Turn off** needs a current code or a recovery code.
- A password reset on an account with two-factor still asks for the code before it signs you in.
- Five wrong codes end a sign-in attempt. Ten wrong codes in 15 minutes, at sign-in and in these settings together, pause code checks for the account until 15 minutes after the first; a new sign-in does not reset them. Right codes do not count.
- Single sign-on sessions ([Single sign-on](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/single-sign-on.md)) never ask for the code: your identity provider handles the second factor.
- **Sessions.** Every browser signed in to your account, with the browser, the IP address, how it signed in and when it was last active. **Sign out** ends one; **Sign out other sessions** ends all but this one.
- **Active OAuth tokens.** Every AI assistant or app you connected with **Allow access** ([Connect AI assistants](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/connect-ai-assistants.md)): the client, its address, the project, the access and when it was last used. **Revoke** stops it at once. Keys granted before this list existed are on the project's **API keys** page.
## Notifications
- **Alert emails** for problems in projects you administer, with a separate switch for integration failures ([Alert emails](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md)).
- **Per project**, three emails you turn on yourself. Any member can subscribe to a project they belong to.
- **Weekly summary**: on the first day of your week, MRR at the end of the week, revenue, new customers, new trials, churned subscriptions and the churn rate, each against the week before, in your display currency. The numbers come from the same engine as [Charts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/charts.md), production only.
- **Experiment results**: one email when both variants of an [experiment](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md) have 100 customers, and one when it is stopped.
- **Revenue anomalies** (beta): every morning (UTC), yesterday's revenue and new paid subscriptions are compared with the 28 days before. You get an email when one of them moves far outside its usual range, up or down. Choose the sensitivity:
| Sensitivity | Alerts when | And the change is at least |
|---|---|---|
| Low | the day is 4 spreads from the usual value | 50%, and $50 or 5 subscriptions |
| Medium (default) | 3 spreads | 30%, and $20 or 3 subscriptions |
| High | 2 spreads | 20%, and $10 or 2 subscriptions |
The usual value is the median of the 28 days, and the spread is 1.4826 times their median absolute deviation (at least 10% of the usual value), so one odd day in the past does not hide a real drop. A series needs 14 of the 28 days with some revenue (or some new subscriptions) before it can alert, so a new app, or one that sells on one day in three, gets no alerts yet.
Every summary, experiment and anomaly email has an **Unsubscribe** link at the bottom, and mail apps show their own one-click unsubscribe. It turns off that email for that project only; no sign-in needed.
## Interface
- **Theme**: System (follows your computer), Light or Dark. It is saved on your account, so it follows you to other browsers; the moon button in the top bar changes it too.
- **Tint colour**: replaces the gold accent (the live dot, focus rings, the current period in charts, highlighted text) with one of the swatches or any colour. Text in the tint is darkened (light theme) or lightened (dark theme) until it reads at 4.5:1 or better, and the page shows both ratios. Pages stay white and grey in light mode and dark in dark mode. **Reset** brings the gold back.
## Date and region
- **Start week on**: Sunday to Saturday (Monday by default). Weekly charts, the date pickers and your weekly summary start their weeks on that day. Through the API, add `week_start=0` (Sunday) to `6` (Saturday) to `GET /v2/projects/{project_id}/charts/{chart_name}`.
- **Display currency**: one of USD, EUR, GBP, AUD, CAD, JPY, BRL, KRW, CNY, MXN, SEK, PLN, NZD or CHF. Charts convert each day at that day's rate; the Overview, customers, transactions and other amounts use the latest European Central Bank rate, shown on the page. Until the rate has loaded, or when it cannot be loaded, amounts show in USD and say so. Prices in a store's own currency stay as they are. The API answers in USD unless a chart request sets `currency`, and RevenueDot Cloud bills in USD.
## API
Account settings use the dashboard session (`rd_session`), never an API key. The endpoints are in the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/README.md) under **Account settings**: `POST /auth/email/change`, `POST /auth/password/change`, `GET /auth/sessions`, `POST /auth/2fa/setup`, `POST /auth/login/2fa`, `GET /auth/oauth_tokens`, `GET /auth/stripe_accounts`, `POST /auth/account/delete`, `GET /auth/notifications` and `GET /auth/fx`.
## Questions
**Can a self-hosted server use two-factor authentication?** Yes. The secret is sealed with AES-256-GCM using the server's `REVENUEDOT_ENCRYPTION_KEY` (or a key derived from `REVENUEDOT_SIGNING_KEY`). A server with neither key stores it unencrypted, like its other integration secrets, and never returns it after setup: set `REVENUEDOT_ENCRYPTION_KEY` (`openssl rand -base64 32`). If the key changes, authenticator codes stop working: sign in with a recovery code, choose **Turn off** with another recovery code, then set two-factor up again.
**I lost my phone and my recovery codes.** Ask the server's operator: on a self-hosted server, `revenuedot admin reset-password` resets the password but not two-factor, so the operator clears it in the database (`UPDATE users SET totp_secret = NULL, totp_enabled_at = NULL, totp_last_step = NULL WHERE email = '…'`). On RevenueDot Cloud, write to hello@revenuedot.app from the account's address.
**Why did I not get a weekly summary?** It goes out on the first day of your week from 06:00 UTC (by the end of the third day at the latest), when that week or the week before had any production MRR, revenue, new customers, new trials or churned subscriptions. Check that the project is turned on under Notifications.
---
# Which alert emails does RevenueDot send?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/alerts.md
Description: Project admins get an email when store notifications fail, a webhook fails 5 times in a row, an integration keeps failing, or Apple or Google rejects the store credentials. One email when it starts, at most one reminder a day, one when it is fixed.
RevenueDot emails a project's admins when one of four things breaks: **store notifications are failing**, **a webhook keeps failing**, **an integration keeps failing**, or **Apple or Google rejects the app's store credentials**. You get one email when the problem starts, at most one reminder a day while it lasts, and one email when it is fixed. Each email links to the app, webhook or integration page that shows the details.
## The four alerts
| Alert | When it starts | When it ends |
|---|---|---|
| **Store notifications failing** | An App Store, Mac App Store or Google Play app's setup health says notifications are **failing**: the newest notification the store really sent could not be processed (for example another bundle ID or package name, or an invalid purchase token). Requests without a valid signature are rejected requests and never raise this alert | The next notification from the store is processed |
| **Webhook failing** | The last 5 delivery attempts to one webhook all failed. Paused webhooks do not alert | A delivery succeeds, or you pause the webhook |
| **Integration failing** | An integration that is on (Amplitude, Segment, Slack and the others) had **10 deliveries in a row fail**, or **more than half of its delivery attempts in the last hour failed** with at least 10 attempts. A delivery fails when it runs out of retries, or at once on an error a retry cannot fix (a 4xx other than 429). Skipped deliveries do not count, and attempts made before you last saved the integration's settings or turned it on do not count either | A delivery succeeds, none has failed since, and a quarter or less of the last hour's attempts failed (fewer than 10 attempts also counts). It also closes when you turn the integration off, or when no rule holds and nothing has failed for 7 days. If it fails again within a day of closing, it reopens without a new email, and the next reminder comes a day after the last one |
| **Store credentials failing** | Apple answers 401 to the app's in-app purchase key, or Google answers 401 or 403 to the service account. This counts on any call: receipt checks, store notifications, the Google Play voided-purchases scan and the dashboard's **Check credentials** button | A check with the store succeeds |
RevenueDot checks the store credentials of a failing app again every hour, and the credentials of every app once a day. So a fixed key clears the alert within an hour, and a key revoked in App Store Connect or Google Cloud raises one within a day even when no purchase comes in.
Deleting the app, the webhook or the integration closes its alert without a "fixed" email. Turning an integration off closes its alert with an email that says it was turned off.
### Integration failing
The email names the integration and the partner, says which rule tripped (for example "The last 10 deliveries failed, one after the other" or "7 of 10 delivery attempts in the last hour failed (70%)"), shows the last error, and links straight to the integration's delivery log, where **Replay failed** sends the failed events again once the settings are fixed. The integration's API object shows the count in `status.failed_deliveries_in_row`. See [Integrations](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md#how-every-integration-behaves).
## Who gets them
- **Every admin of the project** gets the emails. Developers and Viewers do not. See [roles](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/team.md#roles).
- **Each admin can turn them off** in **Account settings** (`/account`, in the menu under your name): switch off **Email me about problems with my projects**. The setting covers every project you administer.
- **Integration failures have their own switch** under it: **Email me when an integration keeps failing**, on by default. It needs the first switch on.
- **With the API:** `POST /auth/me` with `{"alert_emails": false}` turns them off, and `true` turns them back on. `{"integration_alert_emails": false}` turns off integration failures only. `GET /auth/me` shows the current values in `user.alert_emails` and `user.integration_alert_emails`. See [Update account settings](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md#update-account-settings).
## How often
- **One email when the alert opens.**
- **At most one reminder every 24 hours** while it stays open.
- **One email when it resolves.**
RevenueDot looks for problems about every minute on RevenueDot Cloud, and every 30 seconds on a self-hosted server.
## On a self-hosted server
Alert emails need mail settings. Without `REVENUEDOT_SMTP_URL`, each alert email is printed to the server log instead of sent (`docker compose logs revenuedot`). Set `REVENUEDOT_PUBLIC_URL` so the links in the email point at your dashboard. See [Email](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/self-hosting.md#email).
## Related
- [Why are store notifications not arriving?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/store-notifications-not-arriving.md)
- [Why are webhooks not arriving?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/help/webhooks-not-arriving.md)
- [Connect the App Store](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/app-store.md) and [Connect Google Play](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/google-play.md)
- [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)
- [Integrations](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/integrations.md)
---
# Connect ChatGPT, Claude and other AI assistants
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/connect-ai-assistants.md
Description: Connect RevenueDot to ChatGPT, Claude, Cursor or Claude Code with OAuth, choose what the assistant may do, and run setup, support and health checks from chat.
RevenueDot has one connector for every assistant: `https://mcp.revenuedot.app/mcp`. It has 38 tools to set up your catalog, find customers, grant or extend access, cancel or refund, add and debug webhooks, check your store connections and read revenue. The same server is the RevenueDot plugin for ChatGPT and Codex and the RevenueDot connector for Claude.
[](https://revenuedot.app/videos/revenuedot-chatgpt-demo.mp4)
*Watch the 87-second demo: a health check, a customer lookup, a 7-day grant, a new weekly plan, a webhook retry, and a refund that waits for your approval. It is also [on YouTube](https://www.youtube.com/watch?v=bq8JAlei4x8), and there is a [watch page](https://revenuedot.app/watch/revenuedot-chatgpt-demo).*
## Connect
| Assistant | Steps |
|---|---|
| Claude (claude.ai, Desktop, mobile) | Add a custom connector in Connectors settings and paste `https://mcp.revenuedot.app/mcp`. In Claude Code you can also install the plugin: `/plugin marketplace add revenuedot/agent-skills`, then `/plugin install revenuedot@revenuedot` |
| Claude Code | `claude mcp add --transport http revenuedot https://mcp.revenuedot.app/mcp`, then `/mcp` to sign in |
| ChatGPT | Turn on developer mode in ChatGPT's settings, add an MCP connector with `https://mcp.revenuedot.app/mcp` and choose OAuth. After the directory listing is approved you can also search for RevenueDot |
| Codex | `codex plugin marketplace add revenuedot/agent-skills`, then install `revenuedot` |
| Cursor and others | Add an MCP server of type streamable HTTP with the same URL |
The assistant opens a RevenueDot page where you sign in with your dashboard account, pick **one project**, and choose what it may do:
| Choice | The assistant can |
|---|---|
| **Read only** | Read the catalog, customers, events, transactions, webhooks and metrics |
| **Read and change** | Also create products, entitlements and offerings, grant and revoke access, set customer attributes, manage webhooks, delete a customer |
| **Money actions** (a separate checkbox) | Also extend, cancel and refund subscriptions and make Test Store purchases |
A first connection asks for read and change only. When you ask for a refund, the assistant tells you it needs the Money actions permission and asks you to approve it.
## What to ask
- "Set up monthly and annual Pro plans for my iOS and Android apps behind a `pro` entitlement."
- "Find the customer with email jane@example.com. Why don't they have access?"
- "Give user_42 Pro for 7 days."
- "Is everything connected? Did any webhook fail this week?"
- "What is my MRR and how did it change in 28 days?"
## Safety
- The assistant never needs, and no tool accepts, a store key, a password or an API key. Add those in the dashboard.
- The assistant asks you before it cancels, refunds or deletes. Check the customer and product it names.
- Cancel and refund work for Google Play subscriptions. Apple does not allow a server to refund or cancel: send the customer to https://reportaproblem.apple.com or extend their subscription.
- The connection is a secret API key named `OAuth: <app name>` limited to the project and the access you chose. Delete it under **API keys** in the dashboard to disconnect. It does not expire.
## Use your own key instead of OAuth
Send `Authorization: Bearer sk_...` with a secret key from **API keys**. Give the key only the permissions you want the assistant to have; a read-only key cannot change anything. For a self-hosted server, run `npx -y @revenuedot/mcp --http --url https://your-server`; see the [MCP server README](https://github.com/revenuedot/mcp#connect).
## Related
- [Webhooks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/webhooks.md)
- [Going to production](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/going-to-production.md)
- [Skills for coding agents](https://github.com/revenuedot/agent-skills)
- [RevenueCat MCP server, official and open source](https://revenuedot.app/revenuecat-mcp): config blocks for six clients, the tool table and RevenueCat's own MCP server
---
# How do I ask RevenueDot AI about my revenue and customers?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/revenuedot-ai.md
Description: RevenueDot AI is the assistant in the dashboard. It answers from your own metrics, charts, customers and catalog, and changes things only after you approve each change. Admins choose read and write, read only, or off.
**RevenueDot AI answers questions with your own numbers and makes small changes after you approve them.** Open it from the sparkle in the top bar, or type a question into the **Ask about insights or growth opportunities** bar on the Overview.
Every answer comes from tools that read your project through the same API the dashboard uses. Every change shows an **Approve** and **Deny** card first, and approved changes are written to the audit log as "RevenueDot AI on behalf of" you.
## Ask a question
1. Open **RevenueDot AI** (`/projects/<project>/ai`). The page greets you by name.
2. Type a question and press **Enter**. For example:
- "How is revenue doing this month?"
- "Which offering converts trials best over the last 90 days?"
- "Why did customer wren@example.com lose access?"
- "Are any webhooks failing?"
- "Which variant of my price test is winning?"
3. Each tool the assistant runs shows as a card (for example **Revenue metrics** or **Chart · trial conversion rate**). Open a card to see what it asked for and what came back.
4. Links in the answer open the chart, customer or page the number comes from.
Your conversations are listed on the left. Search them, start a **New conversation**, or use the **⋯** menu to rename or delete one. A conversation belongs to you; other members of the project do not see it.
### Attach a screenshot
Select **Attach image** (or drop a file on the box) to add a PNG, JPEG, WebP or GIF up to 5 MB, four per message. The assistant reads it with the question: a screenshot of an error, an App Store Connect page, or a customer's receipt.
### Mention a customer, offering or chart
Type `@` and pick from the list: customers (by app user ID), offerings and charts. The assistant gets that item's details with your question, so "Why did @wren_ios cancel?" needs no lookup.
On any chart, **Ask AI** opens a new conversation with the chart already mentioned and a question ready to edit or send. The mention carries what you were looking at (range, resolution, segment, filters and the Sandbox switch), so the assistant reads the same numbers. See [Charts](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/charts.md#refresh-and-ask-ai).
### Import products from a StoreKit configuration file
Attach the `.storekit` file Xcode uses for local StoreKit testing. The chat shows its products (IDs, types, prices, periods, introductory offers). Select **Import into catalog** and approve: RevenueDot creates the products on your App Store app and skips the ones that already exist. Prices and offers stay in App Store Connect.
## Approve or deny a change
These tools change your project. Each one stops and asks first:
| Tool | What it changes |
|---|---|
| Grant entitlement | Gives a customer promotional access until a date, for example "Grant pro to wjqx8kd2rn1 for 7 days" |
| Revoke entitlement | Ends promotional access that was granted |
| Create product | Adds a product to an app |
| Create products | Adds up to 50 products in one approval, optionally attached to one entitlement (created when new). Used by **Create with AI** on the Products page |
| Create offering | Adds an offering with its packages and their products, and can make it current. Used by **Create with AI** on the Offerings page |
| Attach products to entitlement / package | Makes products unlock an entitlement, or puts them in a package |
| Set current offering | Changes the offering apps show by default |
| Create experiment draft | Saves a draft experiment: a control offering, 1 to 3 treatment offerings, its type, metrics, hypothesis and audience. Nobody joins until you start it ([Experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md#create-an-experiment-with-revenuedot-ai)) |
| Start experiment / Pause experiment / Stop experiment | Starts or resumes an experiment, pauses it, or stops it for good |
| Create targeting rule | Adds a targeting rule that gives an audience an offering and placement offerings, optionally between two dates. It is created turned off ([Targeting](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md#create-a-rule)) |
| Retry webhook delivery / Replay failed deliveries | Sends failed webhook deliveries again |
| Import StoreKit products | Creates products from an attached `.storekit` file |
The card says what will change and lists every value the change will use. **Create with AI** in the **New product** and **New offering** menus starts a conversation that drafts everything in one Create products or Create offering card; see [Create products and offerings with AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/product-editor.md#create-products-and-offerings-with-ai). **Approve** runs it once and shows the result; **Deny** changes nothing and the assistant says so. Approving the same card again, or from a second tab, does not repeat the change. RevenueDot AI cannot create API keys, webhooks, apps or store credentials, cannot delete customers, and never reads or shows secrets.
Customer attributes, product names and attached files are data the assistant reads, and anyone who can write them could put instructions in them. The approval card is what stops such text from changing your project: nothing changes until you approve. Answers never load images, so a reply cannot send your data to another site without a click.
## Choose what the assistant may do
Admins open **Project settings > AI features** and pick one:
| Setting | Effect |
|---|---|
| **Read and write with permission** (default) | Reads everything the person's role can read; changes ask for approval first |
| **Read only** | Answers questions; offers no change tools |
| **Disabled** | Nobody in the project can use RevenueDot AI; conversations are kept |
A person's role limits it further: a **Viewer** can only read, whatever the setting. Developers and Admins can approve changes their role allows.
## Limits
- Each person can ask 20 questions a minute and 200 a day. A project gets 600 a day. Token caps sit behind those (2 million per person and 6 million per project a day).
- The day resets at midnight UTC. Today's usage is on the **AI features** tab.
- One answer runs at most 8 model steps, and stops early once a token cap is used up.
- You can attach 60 files an hour.
## Weekly growth insights
Under the Ask bar, the Overview shows 3 to 5 recommendations RevenueDot AI writes each week from your charts, campaigns and benchmarks, with the numbers behind each one, and admins get them by email. They only read. See [Growth insights](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/growth-insights.md).
Two read tools help with growth questions: **get-attribution-report** (new customers and revenue by media source, campaign, ad group or keyword; see [Attribution](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/attribution.md)) and **get-benchmarks** (your metrics against similar apps on RevenueDot Cloud; see [Benchmarks](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/benchmarks.md)). **get-chart** also segments by the attribution dimensions.
## The first-sale card
When your project's first paid production purchase arrives, the Overview shows **First sale** with the price and product. **Share** copies a public link to a card made for social posts (`/share/first-sale/<token>`, with a 1200×630 image). The card shows your project name, the product, price, store, country and date, and nothing about the customer. Admins and developers can dismiss it for the project when you are done.
## Self-hosting
RevenueDot AI is off until the server has a model. Set one of these in `.env` and restart:
| Variable | Model used |
|---|---|
| `AI_GATEWAY_API_KEY` | GPT-6 Luna through the Vercel AI Gateway (`openai/gpt-6-luna`, medium reasoning); tried first. Paywall and funnel generation use the same model |
| `ANTHROPIC_API_KEY` | Claude Opus 5.5 (`claude-opus-5-5`) |
| `OPENAI_API_KEY` | GPT-6 Astra (`gpt-6-astra`); `OPENAI_BASE_URL` for a compatible gateway |
| `REVENUEDOT_ASSISTANT_MODEL` | Optional: another model id from the same provider (a gateway model id with `AI_GATEWAY_API_KEY`) |
| `REVENUEDOT_AI_REASONING` | Optional: the reasoning effort with the gateway (`none`, `low`, `medium`, `high`) |
| `REVENUEDOT_ASSISTANT_CAPS` | Optional JSON caps, for example `{"userTurnsPerDay": 500}` |
Approval cards are signed with `REVENUEDOT_ENCRYPTION_KEY` (or the signing key) when one is set. Conversations and their answers are stored in your Postgres. If you reload while an answer is being written, the page picks it up where it was. If the server restarts mid-answer, the conversation says the answer was interrupted and offers **Retry**.
On RevenueDot Cloud the assistant runs on GPT-6 Luna through the Vercel AI Gateway, and each conversation lives in its own Cloudflare Durable Object, so answers survive reloads and deploys.
## The API
Everything the page does is in the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/extensions.md) under **RevenueDot AI**: `GET /v2/projects/{project_id}/ai` (status), conversations, `POST …/chat` (an AI SDK UI message stream over Server-Sent Events), `GET …/stream` (resume), files, mentions and the AI setting. To use RevenueDot from ChatGPT, Claude or Cursor instead, see [Connect AI assistants](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/connect-ai-assistants.md); those tools have the same names.
---
# Paywalls
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md
Description: Build a native paywall from a template, with the visual editor or with AI, translate it, publish it to an offering, and show it in your app with the paywall view in the RevenueDot UI SDK.
A paywall is the screen that sells your offering. You build and change a paywall in the dashboard, and your app shows it with one view from the RevenueDot UI SDK, without an app release. RevenueDot serves paywalls in the format the RevenueCat SDKs also render natively (paywall components, also called Paywalls V2), so apps that keep RevenueCat's SDK show them too.
The dashboard has three ways to start, a visual editor, translations, and a server check that every published paywall decodes in the SDK.
[](https://revenuedot.app/videos/revenuedot-paywalls-and-experiments.mp4)
*Watch the 1:04 walkthrough, or [on YouTube](https://www.youtube.com/watch?v=daXVK_4XD8I). [Watch page](https://revenuedot.app/watch/revenuedot-paywalls-and-experiments).*
## Start a paywall
Open **Paywalls** in the dashboard. You can start in three ways:
1. **Use a template.** The gallery has ten layouts, each built on a measured 2026 result. Filter by number of screens, purchase method (in-app or web), number of packages and number of tiers. The previews use your offering's packages. Pick a template, choose the offering, add your app name, accent colour, and Terms and Privacy links, and select **Create paywall**.
2. **Start from scratch.** You get a headline, your offering's packages and a purchase button to build on.
3. **Generate with AI.** Describe the app and the offer, for example "A calm sleep app, explain the 7-day trial, yearly first". You can add the app name and up to three brand colours. RevenueDot returns a paywall you can edit before you save it. This option shows only when a language model is configured (see [AI on a self-hosted server](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/paywalls.md#ai-on-a-self-hosted-server)).
| Template | What it does | Built on |
|---|---|---|
| Trial timeline | Explains the free trial day by day, then two plans with yearly selected | A "how your free trial works" timeline: +23% trial starts (Blinkist) |
| Annual first | Benefits, then yearly and monthly with a savings badge | Yearly pre-selected: the yearly share of purchases went from 37% to 63% (Superwall) |
| Feature hero | A full-width image, five benefits with icons, plans side by side | Opening on value with 3 to 5 benefit lines |
| Free vs Pro | A short comparison table, then two plans | A simple paywall beat a long comparison chart by 111% (Superwall) |
| Minimal | A headline, your plans and one button | Plain plan names add 10% (Superwall) |
| Story pages | Three swipeable value pages before the plans | 2 to 3 pages converted 37% better than one (Superwall 2026) |
| Limited offer | A countdown to the end of an offer, one plan, dark | Discount offers after a cancelled purchase made 17% of revenue (Superwall) |
| Tiers | Two tiers in tabs (Plus and Pro), two plans each | Tiers let a customer pick a level, then a period |
| Reviews | Rating, a user count and one review, then two plans | Reviews with price anchoring: +17% revenue per user (RevenueCat) |
| Web checkout | The button opens web checkout instead of the store sheet (iOS; see [web billing](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/web-billing.md#the-ios-sdks-web-checkout)) | Use it only where the store rules allow external purchases |
## Edit a paywall
The editor has three columns:
- **Layers** on the left list every component. Select a layer to edit it. You can also drag it to a new place, move it with the arrow buttons, duplicate it or remove it. **Add** inserts any component type after the selected one, or inside it when the selection is a container.
- **The preview** in the middle shows the exact JSON your app gets, on a phone. Click any component in the preview to select it. Above the preview you choose the language, light or dark mode, whether the customer is eligible for an intro offer, and which package is selected.
- **Properties** on the right show the settings of the selected component.
Keyboard shortcuts: ⌘Z undoes and ⇧⌘Z redoes. In the layer list, ↑ and ↓ select, ⌥↑ and ⌥↓ move, ⌥→ moves into the stack above, ⌥← moves out, ⌘D duplicates and ⌫ removes.
What you can set, by component:
| Component | Properties |
|---|---|
| Text | Text per language, an intro-offer text, size, weight, alignment, colour (light and dark), background, font |
| Image | An uploaded image or a URL, a dark-mode image, fit or fill, size, rounded or circle mask, colour overlay |
| Icon | One of 44 built-in icons, size, colour, a circle or rounded background |
| Stack | Vertical, horizontal or overlay; alignment, distribution, spacing, padding, margin, size; a background colour, gradient or image; border, corner radius or pill, shadow, a badge |
| Package | Which of the offering's packages it sells, whether it is selected when the paywall opens, the card layout, and the border and background when selected |
| Purchase button | In-app purchase, web checkout or web product selection |
| Button | Restore purchases, close, open terms, privacy or a URL, Customer Center, offer code |
| Sticky footer | The bar pinned to the bottom (usually the purchase button) |
| Timeline | Steps with an icon, a title and a description; spacing; line and icon colours |
| Tabs | Tab names, the tab that opens first, buttons or a toggle, add and remove tabs |
| Carousel | Pages, peek, spacing, loop, auto-advance, page dots |
| Countdown | The end date and time, count from days, hours or minutes, the content after it ends |
| Video | A video URL, a poster image, autoplay, loop, muted, controls |
| Web view | An https URL shown inside the paywall |
Texts can use variables that the device fills in, for example `{{ product.price_per_period }}`, `{{ product.price_per_month }}`, `{{ product.relative_discount }}` and `{{ product.offer_period_with_unit }}`. Inside a countdown you can use `{{ count_days_with_zero }}`, `{{ count_hours_with_zero }}`, `{{ count_minutes_with_zero }}` and `{{ count_seconds_with_zero }}`. Prices in the preview are sample values. The app shows the store's local price.
**Problems** above the preview lists anything the SDK would not decode or would show wrong, such as a text without a string, a video without a URL or a link that is not a URL. Select **Go to** to open the component. You cannot publish while there are errors.
The **JSON** tab shows what the SDK receives. You can paste JSON there, for example a paywall exported from another tool, and select **Repair** to fill in what is missing.
## Translate a paywall
Open the **Localizations** tab. Add a language, then fill in its strings next to the default language. Empty cells show the default language's text in the app, so a paywall is never blank in a language you have not finished. Switch the language above the preview to check it. The SDK fills in the words around prices, such as "month" and "%d days", in the device's language for English, Spanish, French, German, Italian, Portuguese, Dutch, Russian, Japanese, Korean and Chinese.
## Save and publish
- **Save draft** keeps your work. Apps never see a draft.
- **Publish** checks the paywall first. Then it sends the paywall to apps in the offerings response and in remote config, which iOS SDK 5.83 and later read.
- **Save a version** (in the ⋯ menu) keeps a named copy that you can restore into the draft later.
- **Unpublish** stops apps from receiving the paywall and keeps it as a draft.
- An offering has at most one paywall. A paywall needs an offering before it can be published.
- Apps fetch offerings at launch and when they come back to the foreground, so a change reaches them within one session.
## Show it in your app
Add the RevenueDot UI SDK next to the RevenueDot SDK, then present the paywall. The UI SDK is built from RevenueCat's open-source paywall library, so its module is still called `RevenueCatUI` in code. `PaywallView()` shows the current offering's paywall; pass an offering to show another one.
| Platform | RevenueDot UI SDK |
|---|---|
| iOS | Product `RevenueCatUI` of the Swift package `https://github.com/revenuedot/purchases-ios` (`5.91.0-revenuedot`), or `pod 'RevenueDotPurchasesUI', '5.91.0'` |
| Android | `implementation("app.revenuedot.purchases:purchases-ui:10.23.3")` |
| React Native and Expo | `npm install react-native-purchases-ui@npm:@revenuedot/react-native-purchases-ui@10.10.2` |
| Flutter | `purchases_ui_flutter` from the git dependency `https://github.com/revenuedot/purchases-flutter.git` (`path: purchases_ui_flutter`, `ref: 10.13.2-revenuedot`) |
Install lines for every platform are in the [SDK guides](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/README.md). Apps that keep RevenueCat's SDK use RevenueCat's UI library with the same code.
```swift
import RevenueCatUI
.sheet(isPresented: $showPaywall) { PaywallView() }
```
```kotlin
// Jetpack Compose, app.revenuedot.purchases:purchases-ui (package com.revenuecat.purchases.ui.revenuecatui)
PaywallDialog(PaywallDialogOptions.Builder().build())
```
```tsx
// React Native, react-native-purchases-ui (the alias of @revenuedot/react-native-purchases-ui)
import RevenueCatUI from "react-native-purchases-ui";
await RevenueCatUI.presentPaywall();
```
```dart
// Flutter, purchases_ui_flutter from the RevenueDot git dependency
await RevenueCatUI.presentPaywall();
```
## Images, fonts and icons
Images and fonts are stored with your project. RevenueDot serves them from `/assets/{project_id}/...` on the host your apps talk to (`api.revenuedot.app` on Cloud). They are cached for a year with an `ETag`, and on Cloud repeat downloads come from Cloudflare's edge cache. Upload images in the editor, or through the API with `POST /v2/projects/{project_id}/media_assets`. Upload fonts with `POST /v2/projects/{project_id}/fonts`.
### Icons
Icon and timeline components use 55 built-in icons, served at `/assets/icons/{name}.png` (96 × 96, tinted by the SDK) and `/assets/icons/{name}.svg`. Their names: check, check_circle, x, star, sparkles, lock, unlock, bell, crown, shield, shield_check, zap, heart, gift, clock, calendar, calendar_check, cloud, infinity, chart, trending_up, users, user, download, camera, music, book, globe, moon, sun, flame, target, leaf, dumbbell, mic, image, wand, percent, tag, no_ads, sync, devices, headphones, trophy, credit_card, chat, pencil, search, wind, sliders, layers, smile, file_text, palette, rocket.
## AI on a self-hosted server
RevenueDot Cloud generates paywalls with GPT-6 Luna through the [Vercel AI Gateway](https://vercel.com/docs/ai-gateway), so you need no key. On a self-hosted server, set one of these environment variables and restart. The server uses the first one it finds:
- `AI_GATEWAY_API_KEY`: a Vercel AI Gateway key. The model is `openai/gpt-6-luna` with medium reasoning, and RevenueDot AI uses the same model.
- `OPENAI_API_KEY`: OpenAI directly. The model is `gpt-6-luna`, and `OPENAI_BASE_URL` points it at any OpenAI-compatible server.
- `ANTHROPIC_API_KEY`: the model is `claude-sonnet-4-5`.
`REVENUEDOT_PAYWALL_MODEL` picks another model. With the gateway, give a gateway model id, such as `openai/gpt-6-sol`. `REVENUEDOT_PAYWALL_REASONING` sets the reasoning effort (`none`, `low`, `medium`, `high`).
Without a key, the dashboard hides "Generate with AI". Each project can generate one paywall every 5 seconds and 60 a day.
The model works in two steps. It first reads your description into a brief: plan order, the highlighted plan, the trial, the benefits and the look. Then it designs the paywall. A checker holds the design to the brief: plan order, trial wording, typed prices and text contrast. Problems go back to the model for a fix before you see the result. The result always decodes in the SDK. The dialog names the model that answered and lists what you still need to set up, such as the free trial on the yearly product in the stores.
## Use the API
Everything the editor does is in REST API v2. See the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md).
- Create from a template: `POST /v2/projects/{project_id}/paywalls` with `template_id` and `offering_id`. List the templates with `GET /v2/projects/{project_id}/paywall_templates`.
- Change the draft: `PATCH .../paywalls/{paywall_id}` (send the `revision` you read).
- Check without saving: `POST .../paywalls/validate` returns `errors` and `warnings`; with `repair: true` it also returns the repaired JSON.
- Publish: `POST .../paywalls/{paywall_id}/actions/publish`. It answers 422 with the first problem when the SDK could not render the paywall.
- Generate: `POST .../paywalls/generate` with a `prompt`.
- Versions: `POST .../versions`, `GET .../versions` and `POST .../versions/{version_id}/actions/restore`.
## What is not built yet
- Multi-screen paywalls are pages in one screen (a carousel). Paywalls with several screens and navigation between them are served for their first screen only.
- You cannot drag components directly on the phone. Reorder them in the layer list.
- Video uploads are not stored with your project. A video component takes a URL.
- Exit offers and custom variables have no editor yet. They pass through the API.
---
# Targeting and experiments
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md
Description: Show different offerings to different customers with audiences and targeting rules on the Targeting page (Live, Scheduled, Inactive), set the default offering, use placements, and test offerings against each other with experiments.
Your app asks for the current offering, and with placements for the offering of one spot in the app. RevenueDot decides which offering that is for each customer, so you can change what each audience sees without an app release:
- **Targeting rules** give an audience its own offering, now or between two dates.
- **Experiments** split customers between two to four offerings and measure which earns more. They have their own guide: [Experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md).
- **The default offering** is what everyone else sees.
## Audiences
An audience is a set of conditions on customers. Conditions in a group must all be true; separate groups are alternatives. Fields include country, platform, app version, SDK version, locale, subscription status (`active`, `trialing`, `expired`, `never`), active entitlements, total spent, first and last seen dates, latest product, email, attribution (campaign, media source) and any custom attribute (`customAttribute:<key>`).
Create one under **Targeting > Audiences**. **Preview** shows how many of your customers match today. Targeting rules and experiments can use a saved audience; an experiment can also have conditions of its own. An audience holds up to 20 groups of up to 50 conditions each (a field name up to 200 characters, a value up to 5,000). An audience that a rule or any experiment uses, stopped experiments included, cannot be deleted (409).
## The Targeting page
**Targeting** has four tabs:
- **Live** lists the rules that are on, whose start date has passed or is empty, and whose end date is ahead or empty.
- **Scheduled** lists the rules that are on with a start date ahead. They move to Live when it comes.
- **Inactive** lists the rules that are turned off, and the rules past their end date.
- **Audiences** lists the saved audiences.
Each rule is a card that reads as sentences: "If customer matches **Gold plan** then show `promo` for `onboarding_end`", one line per placement, and "`default` for all other cases" (or "for every placement" when it has no placements). "Any audience" means everyone. The card also shows the rule's name, its position, its schedule and a status tag: Live, Scheduled, Ended or Off.
The **…** menu on a card has:
- **Edit** opens the rule dialog.
- **Turn on** and **Turn off** move the rule between the tabs.
- **Move up** and **Move down** change its position. You can also drag the card's handle, or press the up and down arrow keys on it. Moving rules in one tab keeps the other tabs' rules in their places.
- **Duplicate** makes a copy that is turned off, in Inactive.
- **Delete** removes the rule. Customers it matched get the next matching rule, or the default offering.
### The default offering
Below the live rules, **Select default offering** shows the offering customers get when no rule matches them and they are in no experiment. Picking another one asks for confirmation and makes it the project's current offering, the same setting as in Product catalog.
### Create a rule
**New rule** has two choices:
1. **Create from scratch** opens the rule dialog:
- **Name**.
- **Audience**: a saved audience, or **Any audience** for everyone.
- **Current offering**: what `Offerings.current` returns for them, and what every placement not listed shows.
- **Placements** (optional): a placement id, such as `onboarding_end`, and its offering or **No paywall**. Placement ids are letters, digits, dots, dashes or underscores.
- **Starts** and **Ends** (optional): an empty start means as soon as the rule is on; an empty end means until you turn it off. The end must be after the start.
The dialog checks placement ids and dates and lists only offerings that are not archived. The API checks less: it accepts any placement id and any dates, and a rule may name an archived offering, which the SDK never receives (that customer gets the project's current offering, and the placement is left out).
2. **Create with RevenueDot AI** asks who should see which offering ("Show the promo offering to customers in Germany") and opens a new [RevenueDot AI](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/revenuedot-ai.md) conversation. The assistant prepares the `create-targeting-rule` call with the name, offering, saved audience, placements and dates. After you approve it, the rule is created **turned off**, in Inactive. Turn it on when it looks right.
New rules go to the end of the order and start off.
## How rules decide
Rules are checked from the top. The first live rule whose audience matches decides the customer's current offering and placement offerings. Before rules, two things win:
1. **An offering override** for one customer, set through the API (`assign_offering`), wins over everything.
2. **An experiment** the customer is in, or one that enrolls them on this request, wins over targeting. A variant's placements are laid over the matching rule's placements. See [How customers join](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md#how-customers-join).
Customers no rule matches get the default offering. When a rule matched, the SDK's offerings response carries `targeting: { revision, rule_id }`.
In the app, read the result the usual way:
```swift
let offerings = try await Purchases.shared.offerings()
let paywallOffering = offerings.current // targeted current offering
let onboarding = offerings.currentOffering(forPlacement: "onboarding_end") // placement offering
```
## Experiments
An experiment compares a control offering with one to three treatments. Each customer who joins keeps the same variant and gets its offering and placements. The results show 18 metrics per variant, such as conversion to paying and realized LTV per customer, with 95% intervals, the lift over the control and the chance to beat it.
Everything about experiments is on its own page: [How do I test offerings, prices, trials and paywalls with experiments?](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md)
## API
- **Audiences:** `/v2/projects/{project_id}/audiences`, with `actions/preview` and `filter_options`.
- **Rules:** `/v2/projects/{project_id}/targeting_rules`, with `actions/reorder` for the order (saved all at once) and `starts_at`, `ends_at` and `state` on each rule.
- **Viewers** see the rules, audiences and the default offering with no control that changes them; the API refuses their changes (403).
- **The default offering:** `POST /v2/projects/{project_id}/offerings/{offering_id}` with `{ "is_current": true }`.
- **Experiments:** `/v2/projects/{project_id}/experiments`. See [Experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md#api).
See the [API reference](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#targeting).
---
# How do I test offerings, prices, trials and paywalls with experiments?
Source: https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md
Description: An experiment shows each customer one of two to four offerings and reports which earns more, with 95% intervals and the chance to beat the control. Set up variants, enrollment, audience and priority, then read 18 metrics or export them as CSV.
**An experiment gives each customer one of two to four offerings and tells you which one earns more.** You pick what to test, make the treatment offering from the one you sell today, and start it. Each customer who joins keeps the same variant, and the SDK returns that variant's offering as `Offerings.current`, so your app code does not change. The results compare conversion, revenue and retention per variant, each with a 95% interval, the lift over the control and the chance to beat it.
Watch the [1:04 walkthrough of building a paywall and testing it](https://revenuedot.app/watch/revenuedot-paywalls-and-experiments), or [on YouTube](https://www.youtube.com/watch?v=daXVK_4XD8I).
Targeting rules decide what everyone else sees. They are on the [Targeting and experiments](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/targeting-and-experiments.md) page.
## Start an experiment
1. Open **Experiments** and select **New experiment**.
2. Pick a starter type, **Create from scratch**, or **Create with RevenueDot AI** (see [below](https://raw.githubusercontent.com/revenuedot/docs/main/docs/guides/experiments.md#create-an-experiment-with-revenuedot-ai)). An empty Experiments page shows the six starter types as cards.
3. Fill in the form: details, variants, enrollment and audience. The form is a full page at `/experiments/new`; a draft opens it again at `/experiments/<id>/edit`.
4. Select **Start experiment**, or **Save as draft** to start it later. Customers join from their next offerings request.
## The six starter types
Each type fills in the metrics below and says what to change in the treatment offering. If you change the type before you touch the metrics, the metrics follow the new type.
| Type | What the treatment changes | Primary metric | Secondary metrics |
|---|---|---|---|
| Introductory offer | Each package's product becomes one with an introductory price, set up in the store | Conversion to paying | Initial conversion rate, Realized LTV per customer, Churned subscribers |
| Free trial offer | Each package's product becomes one with a longer, shorter or no free trial | Conversion to paying | Initial conversion rate, Trial conversion rate, Realized LTV per customer |
| Paywall design | The packages stay; a copy of the control's paywall is made for you to change | Initial conversion rate | Conversion to paying, Realized LTV per customer |
| Price point | Each package's product becomes one with another price | Realized LTV per customer | Conversion to paying, Initial conversion rate, Refund rate |
| Subscription duration | A package's product becomes one with another period, such as annual for monthly | Realized LTV per customer | Conversion to paying, MRR per customer, Churned subscribers |
| Subscription ordering | The packages appear in another order; the first one is the plan the paywall selects | Initial conversion rate | Conversion to paying, Realized LTV per customer |
| Other (from scratch) | Anything about the offerings or placements | Initial conversion rate | Conversion to paying, Realized LTV per customer |
## Fill in the form
### Details
- **Name** is 1 to 256 characters.
- **Experiment type** is one of the seven above.
- **Primary metric** decides the winner. It must be a rate or a per-customer mean, because only those have an interval: Initial conversion rate, Trial conversion rate, Conversion to paying, Refund rate, Realized LTV per customer, Realized LTV per paying customer, MRR per customer or MRR per paying customer.
- **Secondary metrics** are up to 12 more metrics that the results show first.
- **Notes** hold the hypothesis in Markdown, up to 20,000 characters. The **Preview** tab renders it, and so does the experiment's page.
### Variants
- **The control (A)** is the offering customers see today. The form starts with the project's current offering.
- **Treatments (B, C and D)** are the offerings to test. **Add variant** adds one, up to three treatments. Customers are split evenly between all variants.
- **Each variant has a name** (Control, Treatment B ... by default) and an offering, which is what `Offerings.current` returns to its customers.
- **Placements** give each variant an offering per spot in your app, such as `onboarding_end`, or **No paywall** there. **Add placement** adds a row to every variant, starting at that variant's own offering.
- **Import from targeting** copies a targeting rule: its offering becomes the control's offering (and the offering of any treatment that has none yet), and its placements fill every variant. Then change the treatments.
- **Two variants cannot be the same.** Variants with the same offering and the same placement offerings are refused.
### Duplicate the control offering
A treatment usually needs a new offering. Pick **Duplicate default…** (with your control offering's identifier) in a treatment's offering list, or select **Create offering** on an empty treatment. The dialog makes a copy of the control offering:
- **Name and identifier** are filled in, such as `default_price` for a price test, and can be changed.
- **Packages** stay in the control's order. Drag them, or use the arrow keys on the handle, to reorder them for an ordering test.
- **Each package's product** can be swapped for another active product of the same app: one with another price, period, trial or introductory offer. (The dashboard offers only those; the API takes any product of the project and checks only that two products of one app do not overlap.)
- **Copy the paywall** attaches a copy of the control's paywall to the new offering, ready to edit in Paywalls. It is checked for Paywall design tests.
The copy keeps the control's metadata and is never the current offering. The API call is `POST /v2/projects/{project_id}/offerings/{offering_id}/actions/duplicate` ([Duplicate an offering](https://raw.githubusercontent.com/revenuedot/docs/main/api/rest-v2.md#duplicate-an-offering)).
### Enrollment
- **New customers** joins only customers first seen at or after the experiment's first start: the customer's first request with that app user id (customer info or offerings) made them. A customer who installed the app earlier never joins, even if they have not seen a paywall yet. So does a customer whose first record came from somewhere else: a receipt posted for a restore on a new install counts from its earliest purchase, and customers imported from RevenueCat keep RevenueCat's first-seen date. Pausing and resuming keeps the first start, so customers who arrived during the pause can still join after it.
- **New and existing customers** joins anyone who asks for offerings while the experiment runs, subscribers included. Experiments you make with it need paywall view tracking, which the dashboard and the API turn on for them.
- **Track paywall views for better analysis** counts a paywall view when the SDK reports one (`paywall_impression` from RevenueDot paywalls, or `custom_paywall_impression` when your own paywall calls `trackCustomPaywallImpression()`). The results then show, by default, only customers who saw a paywall after joining. A/B experiments converted from the first release keep tracking off, so their results count every customer. The stock Android SDK sends paywall events to RevenueCat instead of your server; the [RevenueDot Android fork](https://raw.githubusercontent.com/revenuedot/docs/main/docs/sdks/android.md) sends them to RevenueDot.
### Audience and estimate
- **Everyone**, a **Saved audience** (made under Targeting > Audiences), or **Custom filters** written for this experiment only, with the same conditions as audiences.
- **Audience percentage** is the share of matching customers who join, from 1 to 100. The others see what they would see without the experiment.
- **The estimate** updates as you type. **Matching customers (last 7 days)** counts customers first seen in the last 7 days (new customers) or seen in them (new and existing) who match the audience. **Customers per variant (last 7 days)** is that number times the percentage, divided by the number of variants. Above 5,000 customers the audience share of the 5,000 most recent is scaled up, and the number shows as approximate (≈).
New experiments start at the bottom of the enrollment order. Drag the Experiments list to move one up.
## How customers join
Every time the app asks for offerings (`GET /v1/subscribers/{app_user_id}/offerings`), RevenueDot picks the customer's current offering in this order. A new app user id makes the customer on this request, because the SDK asks for customer info and offerings at the same time on a first launch: the first paywall already shows the variant. `GET /v1/offerings` without an app user id enrolls nobody.
1. **An offering override** set for this one customer (`assign_offering`) wins over everything.
2. **The experiment the customer already joined**, if it is running or paused, gives them the same variant every time.
3. **A running experiment that admits them now.** Experiments are checked by priority, 1 first. The first one whose enrollment mode, audience and share admit the customer enrolls them, and the rest are skipped. A customer the share leaves out can still join the next experiment in the order.
4. **The first live targeting rule** that matches.
5. **The project's current offering** (the default offering on the Targeting page).
A customer is in at most one experiment that has not stopped. Audiences are evaluated with the request's headers (platform, app version, SDK version, storefront, locale), like targeting rules.
**The variant follows the person.** When an anonymous customer logs in with a new app user id, that id becomes an alias of the same customer, who keeps their variant. When they log in to an app user id that already exists, the anonymous customer is merged in and their enrollments move with them; in an experiment both were in, the existing customer's variant stays.
**The split is deterministic.** The share check is the first two bytes of SHA-256(`<experiment id>:enroll:<customer id>`) modulo 100, below the percentage. The variant comes from the first two bytes of SHA-256(`<experiment id>:variant:<customer id>`): with 2 or 4 variants, 0 to 99 is cut into equal ranges; with 3 variants, the number modulo 3. The same customer gets the same answer on every server, and nothing is stored until they join. Raising the percentage later lets more customers in; lowering it removes nobody who already joined.
**Priority** is the order of the **Enrollment order** list on the Experiments page. Drag a row, use the arrow keys on its handle, or use **Move up** and **Move down** in its menu. Stopped experiments are listed below in their own table.
## Pause, resume, stop and edit
- **Pause** stops new enrollments. Enrolled customers keep their variant, and the results keep counting what they do.
- **Resume** (Start on a paused experiment) lets new customers join again. New-customer experiments still count from the first start.
- **Stop** ends the experiment for good. On their next request its customers get what targeting gives them, or join another running experiment that admits them. The results stay and keep updating as renewals and refunds arrive. A stopped experiment never enrolls anyone again: use **Duplicate as a draft** in its menu.
- **Delete** is refused while the experiment runs. It deletes the enrollments and the results; its customers are then free to join another running experiment, as after a stop.
- **Editing after the start** is limited to the name, type, metrics, notes and audience percentage. Variants, enrollment, paywall tracking and the audience stay fixed, so the results compare like with like. Changing Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

