Nami Public Documentation
Sign In
Nami Documentation
Nami Documentation
  • Get Started
    • Overview
      • Key Concepts
      • Data Collection
      • Built for Privacy
    • Evaluating Nami
    • SDKs
      • Apple Native SDK
      • Android Native SDK
      • Amazon Native SDK
      • Roku Native SDK
      • React Native Cross-Platform SDK
      • Flutter Cross-Platform SDK
      • Unity Cross-Platform SDK
      • Release Notes
        • Find Nami SDK Version
    • Quickstart Guide
  • Subscription Management
    • Overview
    • Products
      • Archive Products
      • Sync Products
    • Entitlements
    • Customer Screen
    • Accounts and Login/Logout
    • Advanced Use Cases
      • Upgrades and Downgrades
      • Supported Purchase Change States by Platform
      • Restoring Purchases
      • Working with Consumable IAPs
  • No Code Paywalls
    • Overview
    • Paywall Creator
      • Using the Creator
      • Paywall Layout
      • Components
        • Editing, Deleting, Reordering
        • Hiding Components
        • Video
        • Collapse
      • Editable Properties
        • Focused Styling
        • Safe Area
      • Conditions
        • Notched Devices
        • Product Entitlements
      • Adding Products
      • Repeating Product Group
      • Product Fields
      • Capabilities
        • Featured Styling
        • Selected Styling
        • Custom Brand Fonts
        • Carousel
        • Trial Eligibility
        • Deeplink Button
        • Introductory Offer Eligibility
        • Login Check
        • Product Groups
        • Conditional Product Groups
        • Offer Eligibility and Purchasing
        • Screenreader Text
        • Personalization Tokens
        • Custom Variables
        • Multipage
        • Custom Data Source
        • Advanced Video Features
        • Product Error States
      • ❓FAQs
        • Designing Paywalls in Figma
        • Guide to Building a Paywall from Scratch
      • 🎁Releases
        • Roadmap
    • Paywall Templates
      • Pacific
      • Pacific Premium
      • Trident
      • Starfish
      • Mantis
      • Venice
      • Venice Premium
      • Honest
      • Catalina
      • Oyster
      • Puffin
      • Marina
      • Beluga
      • Driftwood
      • Lagoon
      • Pisces
      • Aquarius
      • Conch
      • Lionfish
      • Moray
      • Tetra
      • Lighthouse
      • Puffin Tablet
    • Managing Paywalls
      • Archiving a Paywall
      • Duplicate a Paywall
    • Paywall Smart Text
    • Pricing Eligibility States
    • Pricing Eligibility by Platform
    • Nami Paywalls in Different Languages
    • Legacy Paywalls
  • Campaigns
    • Placements
      • Create a Placement
      • Deeplink Placements
      • Archiving a Placement
      • Managing Lots of Placements
      • Export Placements
    • Campaigns
      • Campaign Filters
        • Campaign Use Cases
      • Archiving a Campaign
      • Scheduling a Campaign
      • Campaign Conversion Events
      • Managing Lots of Campaigns
      • Campaign Troubleshooting
    • A/B and Multivariate Testing
      • Selecting an A/B test winner
      • A/B Test Allocation
  • Integrations
    • All Integrations
    • Billing Platforms
      • Apple Integration
        • App Store Setup
          • Privacy Details
        • Platform Integration
        • App Store Server Notifications
        • Store Credentials
          • App Store Connect Shared Secret
          • Apple App Store Connect API
          • Apple In App Purchase
        • Add a Product
        • Platform Sync
        • SDK Integration
        • Troubleshooting
        • Testing and Development
          • Apple Testing Environments
          • Setting up Device Sandbox Test Environment
          • Setting up StoreKit config in Xcode
      • Google Integration
        • Google Play Store Setup
        • Platform Integration
        • Service Account
        • Real-time Developer Notifications
        • Add a Product
        • Platform Sync
        • SDK Setup
        • Troubleshooting
          • Supporting Android minSdkVersion 25 or lower
          • Requested product is not available for purchase
          • Unsupported Version of Play Billing
      • Amazon Appstore Integration
        • Create Amazon Android App
        • Platform Integration
        • Shared Key
        • Real-time Event Notifications
        • Add a Product
        • SDK Integration
        • Testing
      • Roku Integration
        • Platform Integration
        • API Key
        • Transaction Notifications
        • Add a Product
        • SDK Integration
      • Web Integration
    • Analytics Tools
      • Adobe Analytics
      • Amplitude
      • Google Analytics
      • mParticle
      • 3rd-Party Analytics
    • Subscription Management
      • Nami Subscription Management
      • Bring your Own Payment Code
    • CDP Integrations
      • Adobe CDP Integration
      • Amplitude CDP Integration
      • Custom CDP Integration
      • Generic CDP Integration
    • Other Integrations
      • Wicket Labs
      • Webhooks
        • Introduction to the Nami ML Event System
        • Event Types
          • Purchase Status Updates
          • Events for Upgrades, Downgrades, and Crossgrades
        • Event Subscriptions
        • Understanding Transferred Events and Accounts
      • API Access
    • Events Feed
  • Analytics
    • Using Charts
    • Paywall Analytics
      • Impressions
      • Paywall Conversion Rate
      • Sessions
      • Active Devices
    • Subscription Analytics
      • Revenue
      • MRR
      • Purchases
      • Trial Starts
  • Nami Account
    • Manage your Apps
      • Find your Nami App Platform ID
      • Setting up Legal Text for your Apps
    • Organization
      • Configuring Organization Security Policies
      • Billing
    • Invite your Team
      • Roles
    • Manage your Account
      • Two-Factor Authentication (2FA)
Powered by GitBook
On this page
  • Apple
  • Google Play
  1. Subscription Management
  2. Advanced Use Cases

Restoring Purchases

Last updated 11 months ago

In this guide, we walk through the basics of how to enable customers' ability to restore purchases easily in your app as well as how to present information about the restore purchases process in your app's UI.

Apple

On Apple devices, Apple asks you to explicitly provide the functionality to start the restore purchase process somewhere in your app.

📘 Nami processes the receipt for your app each time the app comes to the foreground. If there are any active purchases, they will be activated by this receipt check process.

Nami Paywalls support adding a Restore Purchases button directly to your paywalls with our .

You may also start the process of restoring purchases by calling the following method.

NamiPurchaseManager.restorePurchases()
[NamiPurchaseManager restorePurchases];

📘 When using Linked Paywalls, if you have a button for Restore Purchases please call the method above to trigger the restoration process.

Reacting to the Restore Purchase Process

🚧 Apple does not present any UI to the user during the Restore Purchase process.

The Nami SDK provides a method for registering a callback that will allow you to respond to different states that occur during the Restore Purchase process, and provide information in your UI to let the user know what has occurred.

There are 3 states you can react to during the process:

  • started

  • finished

  • error

👍 Nami Best Practice

We recommend presenting messages in the correct language in your app's UI for at least the finished and error states.

The code sample below shows how to present a message in the UI to the user letting them know whether any purchases were found and restored during the Restore Purchases process.

It also informs the user if there was an error during the process so they know to try again.

The registerRestorePurchasesHandler returns 2 sets of purchases:

  • oldPurchases - Purchases that were active on the device before the restore purchases process started.

  • newPurchases - All purchases active on the device after the restore purchases process completed.

To check if a new purchase was found and activated, you are looking to see if there is an additional purchase in the newPurchases list that was not present in the oldPurchases list. You can also simplify this check and simply look for any objects in the newPurchases list and indicate to the user that purchases were found and restored.

NamiPurchaseManager.registerRestorePurchasesHandler { state, newPurchases, oldPurchases, error in
  // For Nami Paywalls made with the Paywall Creator, present
  // any alerts from this view controller
  let presentAlertFromVC = NamiPaywallManager.displayedViewController()
                                                     
  switch state {
    case .started:
      // optionally react to start of restore purchases
    case .finished:
      // additionally may want to check that there are more items in
      // newPurchases than oldPurchases
      if oldPurchases != newPurchases {
        // present message to user that purchases were successfully restored
      } else {
        // present message to user that no purchases were found 
      }
    case .error:
      // present message to user that an error occurred
}

For Linked Paywalls the restore purchases call can also trigger the restore purchases handler. See the example below.

NamiPurchaseManager.restorePurchases() { state, newPurchases, oldPurchases, error in
  switch state {
    case .started:
      // optionally react to start of restore purchases
    case .finished:
      // additionally may want to check that there are more items in
      // newPurchases than oldPurchases
      if oldPurchases != newPurchases {
        // present message to user that purchases were successfully restored
      } else {
        // present message to user that no purchases were found 
      }
    case .error:
      // present message to user that an error occurred
  }
}

Google Play

Purchases are automatically restored when our SDK connects to the Play Billing library on app start. There is no manual restore purchase process similar to the one for Apple devices.

On cross-platform frameworks like React Native, Flutter, and Xamarin, calls to restore purchases on Android take no action.

No-Code Paywall Creator