Set App Account Token
Sets the app account token value for a purchase the customer makes outside of your app, or updates its value in an existing transaction.
URL
PUT https://api.storekit.apple.com/inApps/v1/transactions/{originalTransactionId}/appAccountTokenSandbox URL
PUT https://api.storekit-sandbox.apple.com/inApps/v1/transactions/{originalTransactionId}/appAccountTokenPath Parameters
| Name | Type | Description |
|---|---|---|
originalTransactionId Required | originalTransactionId | The original transaction identifier of the transaction to receive the app account token update. |
Response Codes
| Status | Reason | Type | Description |
|---|---|---|---|
| 200 | OK | Request succeeded. | |
| 400 | Bad Request Content-Type: application/json | (InvalidTransactionIdError | AppTransactionIdNotSupportedError | FamilyTransactionNotSupportedError | InvalidAppAccountTokenUUIDError | TransactionIdIsNotOriginalTransactionIdError) | Invalid request. See the error code for more information. If there’s no error code, the request is malformed. |
| 401 | Unauthorized | The JSON Web Token (JWT) in the authorization header is invalid. For more information, see Generating JSON Web Tokens for API requests. | |
| 404 | Not Found Content-Type: application/json | OriginalTransactionIdNotFoundError | The transaction identifier wasn’t found. |
| 429 | Content-Type: application/json | RateLimitExceededError | The request exceeded the rate limit. For more information, see Identifying rate limits. |
| 500 | Internal Server Error Content-Type: application/json | (GeneralInternalError | GeneralInternalRetryableError) | Server error. Try again later. |
Mentioned in
Discussion
An appAccountToken is a UUID you create to associate a transaction with a customer account in your system. Use the Set App Account Token endpoint to set or reset the appAccountToken associated with the transaction you specify in the originalTransactionId parameter.
Typically, your app sets the appAccountToken(_:) when a customer makes a purchase in your app. However, customers can also purchase in-app products outside of your app, for example, by redeeming an offer code in the App Store. In that case, the original transaction doesn’t include an app account token. Use the Set App Account Token endpoint to associate an app account token with such transactions.
This endpoint supports setting the appAccountToken for all product types, including one-time purchases (consumables, non-consumables, and non-renewing subscriptions) and auto-renewable subscriptions. If you call this endpoint for a transaction that already has an appAccountToken, the endpoint replaces the existing value with the new value you supply.
For auto-renewable subscriptions, the endpoint applies the appAccountToken to the current renewal transaction and subsequent renewals, but it doesn’t affect past transactions. The same appAccountToken continues to apply to renewal transactions if the customer upgrades, downgrades, or cross-grades the subscription.
This endpoint doesn’t support transactions for products shared through Family Sharing, where the transaction has an inAppOwnershipType value of FAMILY_SHARED.
You can assign the same appAccountToken value to more than one transaction, according to your needs. For example, you may choose to reuse the same appAccountToken value for every transaction that belongs to the same customer.
HTTP Body
The request body that contains a valid app account token value.