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
  • 1. Register for Paywall Buy Sku Callbacks
  • 2. Notify Nami of Successful Purchase
  • Additional Documentation
  1. Integrations
  2. Subscription Management

Bring your Own Payment Code

You can use Nami paywalls on-top of your own in-app purchase code or a third-party subscription management solution.

Developer Task

Send this doc to your development team

1. Register for Paywall Buy Sku Callbacks

When an end user wants to make a purchase from a Nami Paywall, register for a callback so your app code can start the purchase flow.

The callback will fire when the user is ready to buy and include the product sku information you need to transaction.

Use this approach if you have your own in-app purchase implementation or use a third-party solution for subscription management.

// Receive a callback when the end user is ready to make a purchase
// from a Nami paywall. Implement your purchase code here. by starting the purchase flow.
NamiPaywallManager.registerBuySkuHandler { sku in
    print("Start the purchase flow for App Store product: \(sku.storeId)")
}
// Receive a callback when the end user is ready to make a purchase
// from a Nami paywall. Implement your purchase code here.
NamiPaywallManager.registerBuySkuHandler { paywall, sku ->
    Log.d(LOG_TAG, "Start the purchase flow for Google Play/Amazon Appstore product: $skuRefId")
}
useEffect(() => {
  NamiPaywallManager.registerBuySkuHandler((sku) => {
    
    // Start your purchase flow   
    console.log(
      'buy sku handler - start purchase flow for sku:',
      sku.skuId,
    );
}
// Coming soon
NamiPaywallManager.RegisterBuySkuHandler(buySkuCallback);
// Coming soon

2. Notify Nami of Successful Purchase

Once your billing implementation has successfully processed a user's purchase, let the Nami SDK know by calling this method.

Once received, the paywall view will be closed.

// Call this method to tell Nami the purchase, handled by you, was successful and the paywall
// should be closed. Additional parameters used to provide a more complete picture for paywall
// conversion metrics and analytics.

// Pass back the NamiSKU that was passed to you via NamiPurchaseManager.registerBuySkuHandler callback
// plus, some artifacts from the purchase from either StoreKit 1 or StoreKit 2

// StoreKit 2 Product & Transaction objects
NamiPaywallManager.buySkuComplete(sku: NamiSKU, product: Product, transaction: Transaction) 
                                  
// StoreKit 1 SKProduct & SKPaymentTransaction objects
NamiPaywallManager.buySkuComplete(sku: NamiSKU, product: SKProduct, transaction: SKPaymentTransaction)

// or pass in the individual data elements used by Nami, wrapped in a `NamiPurchaseSuccess` object
let purchaseSuccess = NamiPurchaseSuccess(product: sku, transactionID: transactionId, originalTransactionID: originalTransactionId, originalPurchaseDate: originalPurchaseDate, purchaseDate: purchaseDate, expiresDate: expirationDate, price: price, currencyCode: currency, locale: locale)
NamiPaywallManager.buySkuComplete(purchaseSuccess: purchaseSuccess)
// paywall, and skuRefId were passed to you via NamiPurchaseManager.registerBuySkuHandler
// purchase is the purchase object from Google Play Billing
NamiPaywallManager.buySkuComplete(paywallActivity, purchase, sku)
  
  
// or provided a NamiPurchaseSuccess.Google or NamiPurchaseSuccess.Amazon object  
NamiPaywallManager.buySkuComplete(paywallActivity, purchaseSuccess)
// Once purchase flow is complete:    
if (Platform.OS === 'ios' || Platform.isTVOS) {
  NamiPaywallManager.buySkuCompleteApple({
    product: sku,
    transactionID: '12345',
    originalTransactionID: '12345',
    originalPurchaseDate: 1684823428,
    purchaseDate: 1684823428,
    price: '120',
    currencyCode: 'USD',
    locale: 'US',
  });
} else if (Platform.OS === 'android') {
  if (Platform.constants.Manufacturer === 'Amazon') {
    NamiPaywallManager.buySkuCompleteAmazon({
      product: sku,
      purchaseDate: 1684823428,
      purchaseSource: 'CAMPAIGN',
      receiptId: '12345',
      localizedPrice: '120',
      userId: '12345',
      marketplace: '12345',
    });
  } else {
    NamiPaywallManager.buySkuCompleteGooglePlay({
      product: sku,
      purchaseDate: 1684823428,
      purchaseSource: 'CAMPAIGN',
      purchaseToken: '_token_',
      orderId: 'GPA.123.456.789',
    });
  }
}
// Coming soon
// Coming soon
// Coming soon

Additional Documentation

Last updated 11 months ago

See our

SDK Reference