Manually trigger a system purchase of a specific Nami SKU.

NamiPurchaseManager.buySKU(_ sku: NamiSKU, fromPaywall paywall: NamiPaywall? = .none, responseHandler : @escaping NamiPurchaseResponseHandler)
[NamiPurchaseManager buySKU:<(NamiSKU * _Nonnull)> fromPaywall:<(NamiPaywall * _Nullable)> responseHandler:<^(NSArray<NamiPurchase *> * _Nonnull, enum NamiPurchaseState, NSError * _Nullable)responseHandler>]
NamiPurchaseManager.buySKU(activity, skuId) { namiPurchaseCompleteResult ->
    if (namiPurchaseCompleteResult.isSuccessful) {
        // purchase successful
    }
}
NamiPurchaseManager.buySKU(this, skuId, namiPurchaseCompleteResult -> {
    if(namiPurchaseCompleteResult.isSuccessful()) {
        // Purchase Complete
    }
    return Unit.INSTANCE;
});
NativeModules.NamiPurchaseManagerBridge.buySKU(skuIdentifier: String, paywallDeveloperID: String, (purchased) => {})
NamiPurchaseCompleteResult result = await NamiPurchaseManager.buySKU(skuRefId);

if (result != null) {    
    if (result.purchaseState == NamiPurchaseState.purchased) {
        // Purchase complete with purchased state        
    }
}
void NamiPurchaseManager.BuySKU(NamiSKU sku, [NullAllowed] NamiPaywall paywall, (namiPurchaseArray, purchaseState, error) => {
  // process purchase state
});

Arguments

  • sku - A NamiSKU object to purchase.
  • fromPaywall (optional) - if you are using a linked or cloud Nami paywall, this tells the SDK which paywall the product SDK was purchased from. Recommended that you include for data quality.
  • responseHandler - Callback to provide purchase and status details around the purchase attempt.

React Native

The React Native method does not use the full objects, but just their identifiers.

  • skuIdentifier - The string that identifies the SKU being purchased, from the Control Center.
  • paywallDeveloperID - The paywall developer ID from the Control Center for the paywall where the purchase was made. If purchase was not made from a paywall, pass an empty string.
  • callback to handle any additional response from the success or failure of the purchase.