Hooks

consume()

Consume a Google Play purchase token from the Expo compat API.

Purpose

Consumes a Google Play purchase token so the item can be purchased again. This is mainly for consumable Android purchases. The method is exposed on the Expo compat Superwall API and is Android-only; it is not supported on iOS.

Signature

import Superwall from "expo-superwall/compat"

await Superwall.consume(
  purchaseToken: string
): Promise<string>

Parameters

Prop

Type

Returns / State

Returns a Promise<string> that resolves to the consumed purchase token.

The promise rejects if:

  • you call it before Superwall.configure() completes,
  • or the native Android consume operation fails.

Usage

import Superwall from "expo-superwall/compat"

async function consumePurchase(purchaseToken: string) {
  try {
    const token = await Superwall.consume(purchaseToken)
    console.log("Purchase consumed:", token)
  } catch (error) {
    console.error("Failed to consume purchase:", error)
  }
}

How is this guide?

On this page