SDK error · code 39

invalidWebPurchaseToken (error code 39): Invalid web purchase token

What it means

invalidWebPurchaseToken (code 39) means the redemption link's token is not valid: it was cut off, edited, from another project, or never completed. The backend answers 7849. Pass the full link to parseAsWebPurchaseRedemption and redeemWebPurchase without changes, and ask the customer to use the original link from the success page or email.

Code

39

iOS (Swift)

ErrorCode.invalidWebPurchaseToken

Android (Kotlin)

No matching code in the Android SDK; see the causes below.

Causes

Why the SDK returns invalidWebPurchaseToken

  • The backend answered 7849 (invalid web redemption token). The iOS SDK maps it here, and the Swift async API returns it as the invalidToken result (PurchasesOrchestrator.swift, WebPurchaseRedemptionHelper.swift).
  • The link was shortened, wrapped by an email client or messenger, or the token was cut off or altered.
  • The token comes from another project, or from a checkout that was never completed.
  • Android maps 7849 to PurchaseInvalidError and has no member for this code (errors.kt).
Backend codeMeaning
7849Invalid web redemption token.

Fix

How to fix invalidWebPurchaseToken

  1. 01

    Pass the link through untouched

    Call Purchases.parseAsWebPurchaseRedemption(url) on the exact URL your app received, and give the result to redeemWebPurchase. Do not edit the token.

  2. 02

    Use the original link

    Ask the customer to open the link from the success page or the email the buyer got, not a forwarded or shortened copy.

  3. 03

    Check the project

    Make sure the link was issued by the project the app talks to. A token from another project is unknown.

  4. 04

    Handle the result

    Switch on the redemption result: invalidToken, purchaseBelongsToOtherUser, expired and success each need their own message.

In your app

How to handle it in code

  • Do not retry the same token. It stays invalid.
  • Tell the customer "This link is not valid" and point them to the original email or to support.
  • Do not grant access from the error. Access appears only after a successful redemption.
Match the errorSwift
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .invalidWebPurchaseToken {
  // handle invalid web purchase token
}

On RevenueDot: RevenueDot answers HTTP 400 with code 7849 when the token is not shaped like rdrt_ plus a token of 20 to 100 characters, when it is unknown, or when its checkout was never completed or was not anonymous. See how a web purchase reaches the app and web billing.

FAQ

invalidWebPurchaseToken: questions people ask

What is RevenueCat error 7849?

Backend code 7849 means the web redemption token is invalid. The iOS SDK reports it as invalidWebPurchaseToken (code 39), and the Android SDK as purchaseInvalidError.

How do I redeem a web purchase in my app?

Register your URL scheme, parse the incoming link with parseAsWebPurchaseRedemption, and call redeemWebPurchase. The result tells you if it worked, the token is invalid, the purchase belongs to another user or the link expired.

How do I check for invalidWebPurchaseToken in React Native and Flutter?

The React Native PURCHASES_ERROR_CODE enum in the SDK source has no member for it, so compare error.code with the string "39". In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.invalidWebPurchaseToken.

Get started

Keep the RevenueCat SDK. Change the backend.

RevenueDot answers the same SDK calls with the same error codes. Start free on RevenueDot Cloud, free up to $10,000 a month in tracked revenue.

Already have an account? Sign in · Prefer your own servers? Self-host free