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)")
}

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)

Additional Documentation

Last updated