# buySkuComplete

{% hint style="info" %}
**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.
{% endhint %}

{% tabs %}
{% tab title="Swift" %}

```swift
// 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)
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
// 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)
```

{% endtab %}

{% tab title="Flutter" %}

```
// Coming Soon
```

{% endtab %}

{% tab title="React Native" %}

```jsx
// 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',
    });
  }
}
```

{% endtab %}

{% tab title="Unity" %}

```
// Coming soon
```

{% endtab %}
{% endtabs %}

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](https://docs.namiml.com/sdk-reference/namipaywallmanager/registerbuyskuhandler).
