Nami Public Documentation
SDK Reference
SDK Reference
  • NAMI
    • configure
    • NamiConfiguration
    • NamiLanguageCodes
  • NamiCampaignManager
    • launch
    • allCampaigns
    • isCampaignAvailable
    • refresh
    • registerAvailableCampaignsHandler
    • NamiCampaign
    • NamiCampaignRuleType
    • LaunchCampaignError
  • NamiCustomerManager
    • CustomerJourneyState
    • isLoggedIn
    • journeyState
    • loggedInId
    • login
    • logout
    • registerAccountStateHandler
    • registerJourneyStateHandler
    • setCustomerAttribute
    • getCustomerAttribute
    • clearCustomerAttribute
    • clearAllCustomerAttributes
  • NamiEntitlementManager
    • active
    • isEntitlementActive
    • NamiEntitlement
    • refresh
    • registerActiveEntitlementsHandler
  • NamiPaywallManager
    • dismiss
    • displayedViewController
    • registerSignInHandler
    • registerCloseHandler
    • registerBuySkuHandler
    • registerDeeplinkActionHandler
    • buySkuComplete
    • NamiPurchaseSuccess
    • NamiPaywallAction
    • NamiSKUType
  • NamiPurchaseManager
    • anySkuPurchased
    • consumePurchasedSku
    • NamiPurchase
    • NamiPurchaseState
    • NamiRestorePurchasesState
    • NamiSKU
    • presentCodeRedemptionSheet
    • registerPurchasesChangedHandler
    • registerRestorePurchasesHandler
    • restorePurchases
    • skuPurchased
  • NamiMLManager
    • coreAction
    • enterCoreContent
    • exitCoreContent
Powered by GitBook
On this page
  1. NamiPaywallManager

buySkuComplete

For Paywalls-0nly Plans

This method is for customers who have implemented their own in-app purchases or subscription code directly with the App Store, Google Play, etc. or who are using another third-party for subscription or purchase management.

Your Nami account needs to be on a Paywalls only plan to use this interface. Contact support@nami.ml for details.

// 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)
// Coming Soon
// 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:
        'jolbnkpmojnpnjecgmphbmkc.AO-J1OznE4AIzyUvKFe1RSVkxw4KEtv0WfyL_tkzozOqnlSvIPsyQJBphCN80gwIMaex4EMII95rFCZhMCbVPZDc-y_VVhQU5Ddua1dLn8zV7ms_tdwoDmE',
      orderId: 'GPA.3317-0284-9993-42221',
    });
  }
}
// Coming soon

Once your billing implementation has successfully processed a user's purchase, let the Nami SDK know by calling NamiPaywallManager.buySkuComplete. Once invoked, the paywall view will be closed.

To known when to start the purchase process, see registerBuySkuHandler.

PreviousregisterDeeplinkActionHandlerNextNamiPurchaseSuccess

Last updated 1 year ago