Skip to main content
Use RevenueCat Customer Center for a user-initiated restore. It presents native restore and subscription-management options, then reports the outcome to your web app.
Replace your UI’s access state with the returned active entitlement IDs. A completed restore does not prove that an active purchase was found. A management-screen visit does not prove cancellation, and an iOS refund-request submission does not prove refund approval. The purchase-history examples below remain available for existing integrations. For the complete event and entitlement contract, use the RevenueCat reference.

AI Prompt

Add restore purchases functionality to my app using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: npm install despia-nativeThen import it: import despia from 'despia-native'Retrieve purchase history by calling: despia("getpurchasehistory://", ["restoredData"])This reads store purchase rows available to the native runtime. It is not a complete ledger of expired purchases or consumed products and does not itself initiate a Customer Center restore.The response array includes objects with :
  • transactionId - unique identifier for this specific transaction
  • originalTransactionId - identifier linking to the original purchase (useful for subscription renewals)
  • productId - the product identifier configured in App Store Connect / Google Play Console
  • type - either "subscription" or "product" (one-time purchase)
  • entitlementId - the entitlement/access level this purchase grants
  • isActive - boolean indicating if the purchase currently grants access
  • willRenew - boolean indicating if a subscription will auto-renew
  • purchaseDate - ISO timestamp of the most recent transaction
  • originalPurchaseDate - ISO timestamp of the initial purchase
  • expirationDate - ISO timestamp when access expires (null for lifetime purchases)
  • store - either "app_store" or "play_store"
  • country - user’s country code
  • environment - "production" or "sandbox"
  • receipt - the raw receipt data for server-side validation
Use this to implement “Restore Purchases” buttons required by App Store guidelines, and to verify user entitlements on app launch.
This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.

How it Works

Despia reads the purchase rows available from the native store and RevenueCat integration. Available history differs by platform and purchase state; it is not an exhaustive ledger of expired or consumed purchases. Use revenuecat://customer for active RevenueCat entitlement IDs and Customer Center for an explicit restore.

Installation

Install the Despia package from NPM:

Usage

1. Import the SDK

2. Retrieve Purchase History

3. Example Response (iOS)

4. Example Response (Android)

5. Check Active Entitlements

Resources

  • NPM Package
  • View full NPM documentation for additional configuration options
For additional support or questions, please contact our support team at support@despia.com