post https://api.revenuecat.com/v1/receipts
Records a purchase for a user from iOS, Android, or Stripe and will create a user if they don't already exist.
Parameter Reference
This is a complete reference of every parameter you can pass to this endpoint.
Parameter | Description | Data Type | iOS/macOS | Amazon | Stripe | |
---|---|---|---|---|---|---|
app_user_id | App User ID of the user the receipt is associated with. | String | Required ✅ | Required ✅ | Required ✅ | Required ✅ |
fetch_token | The raw receipt or fetch token. | String | Required ✅ Send the base64 encoded receipt file. | Required ✅ Send the fetch token. Its format is abcdefghijklmnopqrstuvwx.AO-J1OxxnCDwK... | Required ✅ Send the fetch token. Its format is aBCdefgHi-x-AsdFghjKlQw34erTyUioPzxCvbnm1As=:2:10 | Required ✅ Send the subscription ID (sub_abcdefg) or the Stripe Checkout Session (cs_abcdefg) |
attributes | Mapping of key names to subscriber attribute objects. See the attributes object. | Object | Optional 🆗 | Optional 🆗 | Optional 🆗 | Optional 🆗 |
product_id | The Apple, Google, or Amazon product identifier or SKU. | String | Optional 🆗 | Required ✅ | Optional 🆗 | Not compatible ❌ |
price | The price of the product. Required if you provide a currency. | Float | Optional 🆗 | Optional 🆗 | Optional 🆗 | Not compatible ❌ |
currency | The currency of the product. The currency must be in ISO 4217 format. Required if you provide a price. | String | Optional 🆗 | Optional 🆗 | Optional 🆗 | Not compatible ❌ |
is_restore | If true, the fetch token will trigger your configured restore behavior for any other users sharing the same fetch token. | Boolean | Optional 🆗 | Optional 🆗 | Optional 🆗 | Optional 🆗 |
payment_mode | Communicates the iOS introductory pricing period of the product. This parameter can be: • 0 (pay_as_you_go) • 1 (pay_up_front) • 2 (free_trial) Defaults to 2 (free trial) if an introductory period is detected in the receipt but this value is not provided. | Integer (0, 1, or 2) | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
create_events | If false, will not create events for any purchases detected in the receipt. This can be set to false when importing old receipts into RevenueCat in order to not get any webhook or integration events for old users. Defaults to true if not provided. | Boolean | Optional 🆗 | Optional 🆗 | Optional 🆗 | Optional 🆗 |
should_update_last_seen_fields | If false, will not update the user's "last seen" metrics. This should be set to false when importing old receipts into RevenueCat. Defaults to true if not provided. | Boolean | Optional 🆗 | Optional 🆗 | Optional 🆗 | Optional 🆗 |
subscription_group_id | The iOS subscription group that the product belongs to. | String | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
store_user_id | The Amazon user ID. | String | Not compatible ❌ | Not compatible ❌ | Required ✅ | Not compatible ❌ |
presented_offering_identifier | The offering that was presented to the user at the time of purchase. This will be attached to any new transactions in this fetch token and will be available in Scheduled Data Exports and webhooks. This is mostly useful if you're sending fetch tokens from your backend. | String | Optional 🆗 | Optional 🆗 | Optional 🆗 | Optional 🆗 |
observer_mode | Set this to true only if you are using observer mode. Defaults to false if not provided. | Boolean | Optional 🆗 | Optional 🆗 | Not compatible ❌ | Optional 🆗 |
introductory_price | The price of the introductory period. | Float | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
normal_duration | The ISO 8601 duration of the subscription. RevenueCat will estimate this for you if you don't provide it. | String | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
intro_duration | The ISO 8601 duration of the introductory period of the subscription. RevenueCat will estimate this for you if you don't provide it. | String | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
trial_duration | The ISO 8601 duration of the free trial period of the subscription. RevenueCat will estimate this for you if you don't provide it. | String | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
store_country | The ISO alpha 2 country code of the store where the purchase was made. Currently only used iOS. This can help with estimating the correct currency (for example, when two countries use the same currency but different prices, this lets RevenueCat know which country's price to use.) | String | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
ip_address | The IP address of the device that made this purchase. If store_country, currency, or price are not provided, RevenueCat can try to infer it from the IP address provided. If both store_country and ip_address are provided, store_country always takes precedence over ip_address . | String | Optional 🆗 | Not compatible ❌ | Not compatible ❌ | Not compatible ❌ |
Response
If the response is successful, it will contain the updated Subscriber object.
Public API Key required
This endpoint requires the public SDK key to be used. Since validation is performed securely with the store using the provided
fetch_token
, this is safe.The restriction exists to prevent developers from embedding a secret key in their app.