SDK error · code 40

purchaseBelongsToOtherUser (error code 40): Purchase belongs to another user

What it means

purchaseBelongsToOtherUser (code 40) means the web purchase behind a redemption link was already redeemed by a different app user, reported as backend code 7852. A purchase moves to one customer only. Ask the customer to sign in with the account that redeemed it first, or contact support to move it. Opening the link again does not change the result.

Code

40

iOS (Swift)

ErrorCode.purchaseBelongsToOtherUser

Android (Kotlin)

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

Causes

Why the SDK returns purchaseBelongsToOtherUser

  • The backend answered 7852 (purchase belongs to another user). The iOS SDK maps it here, and returns it as the purchaseBelongsToOtherUser result in the Swift async API (BackendErrorCode.swift).
  • The link was opened on a device signed in as a different app user than the first one that redeemed it.
  • A link was shared with another person, or forwarded, and they redeemed it first.
  • Android maps 7852 to ProductAlreadyPurchasedError and has no member for this code (errors.kt).
Backend codeMeaning
7852Purchase belongs to another user. iOS maps it to purchaseBelongsToOtherUser; Android maps it to productAlreadyPurchasedError.

Fix

How to fix purchaseBelongsToOtherUser

  1. 01

    Sign in with the redeeming account

    Ask the customer to log in with the account that redeemed the link first. Entitlements follow that app user.

  2. 02

    Find the owner

    Look up the web purchase in the dashboard to see which app user holds it.

  3. 03

    Move it by hand if needed

    If the wrong account redeemed it, move the purchase through support, or grant a promotional entitlement to the right account.

  4. 04

    Do not share links

    Tell buyers that the link is personal. Show this in the email and success page.

In your app

How to handle it in code

  • Do not retry. The purchase is bound to the first user.
  • Tell the customer that the purchase belongs to another account, and offer support. Do not name the account.
  • Do not grant access from the error.
Match the errorSwift
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .purchaseBelongsToOtherUser {
  // handle purchase belongs to another user
}

On RevenueDot: RevenueDot claims the purchase before it moves anything, so of two simultaneous redeems exactly one wins. The other gets HTTP 400 with code 7852, unless it is the same app user ID retrying, which gets the same customer back.

FAQ

purchaseBelongsToOtherUser: questions people ask

What is RevenueCat error 7852?

Backend code 7852 means another user already redeemed the web purchase. The iOS SDK reports it as purchaseBelongsToOtherUser (code 40), and the Android SDK as productAlreadyPurchasedError.

Can the same user redeem the link twice?

Yes. A retry by the same app user ID returns the same customer instead of an error.

How do I check for purchaseBelongsToOtherUser 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 "40". In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.purchaseBelongsToOtherUser.

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