Create a Purchase

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.

ParameterDescriptionData TypeiOS/macOSGoogleAmazonStripe
app_user_idApp User ID of the user the receipt is associated with.StringRequired ✅Required ✅Required ✅Required ✅
fetch_tokenThe raw receipt or fetch token.StringRequired ✅
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)
attributesMapping of key names to subscriber attribute objects. See the attributes object.ObjectOptional 🆗Optional 🆗Optional 🆗Optional 🆗
product_idThe Apple, Google, or Amazon product identifier or SKU.StringOptional 🆗Required ✅Optional 🆗Not compatible ❌
priceThe price of the product. Required if you provide a currency. FloatOptional 🆗Optional 🆗Optional 🆗Not compatible ❌
currencyThe currency of the product. The currency must be in ISO 4217 format. Required if you provide a price. StringOptional 🆗Optional 🆗Optional 🆗Not compatible ❌
is_restoreIf true, the fetch token will trigger your configured restore behavior for any other users sharing the same fetch token.BooleanOptional 🆗Optional 🆗Optional 🆗Optional 🆗
payment_modeCommunicates 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_eventsIf 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.
BooleanOptional 🆗Optional 🆗Optional 🆗Optional 🆗
should_update_last_seen_fieldsIf 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.
BooleanOptional 🆗Optional 🆗Optional 🆗Optional 🆗
subscription_group_idThe iOS subscription group that the product belongs to.StringOptional 🆗Not compatible ❌Not compatible ❌Not compatible ❌
store_user_idThe Amazon user ID.StringNot compatible ❌Not compatible ❌Required ✅Not compatible ❌
presented_offering_identifierThe 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.
StringOptional 🆗Optional 🆗Optional 🆗Optional 🆗
observer_modeSet this to true only if you are using observer mode.

Defaults to false if not provided.
BooleanOptional 🆗Optional 🆗Not compatible ❌Optional 🆗
introductory_priceThe price of the introductory period.FloatOptional 🆗Not compatible ❌Not compatible ❌Not compatible ❌
normal_durationThe ISO 8601 duration of the subscription. RevenueCat will estimate this for you if you don't provide it.StringOptional 🆗Not compatible ❌Not compatible ❌Not compatible ❌
intro_durationThe ISO 8601 duration of the introductory period of the subscription. RevenueCat will estimate this for you if you don't provide it.StringOptional 🆗Not compatible ❌Not compatible ❌Not compatible ❌
trial_durationThe ISO 8601 duration of the free trial period of the subscription. RevenueCat will estimate this for you if you don't provide it.StringOptional 🆗Not compatible ❌Not compatible ❌Not compatible ❌
store_countryThe 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.)StringOptional 🆗Not compatible ❌Not compatible ❌Not compatible ❌
ip_addressThe 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.StringOptional 🆗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.

Language
Authorization
Bearer
auth-scheme