# 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](/sdk-reference/namipaywallmanager/registerbuyskuhandler.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.namiml.com/sdk-reference/namipaywallmanager/buyskucomplete.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
