# registerPurchasesChangedHandler

Register a callback that will be made anytime there is a change to purchases made on the device. This will be triggered when a purchase process is started and may have different states based on the particular store platform.

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

```swift
NamiPurchaseManager.registerPurchasesChangedHandler { (purchases, purchaseState, error) in
	// process purchases data
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
NamiPurchaseManager.registerPurchasesChangedHandler { purchases, purchaseState, error ->
  // process purchases change
}
```

{% endtab %}

{% tab title="Flutter" %}

```dart
NamiPurchaseManager.registerPurchasesChangedHandler()
    .listen((purchasesResponseHandlerData) {
    // process purchases change
});
```

{% endtab %}

{% tab title="React Native" %}

```Text
// Coming soon
```

{% endtab %}

{% tab title="Unity" %}

```c
NamiPurchaseManager.RegisterPurchasesChangedHandler(purchasesChangedCallback);
```

{% endtab %}
{% endtabs %}

**Returns**

* `purchases` - a list of the current purchases
* `purchaseState` - the state of the purchase, see [NamiPurchaseState](https://docs.namiml.com/sdk-reference/namipurchasemanager/namipurchasestate) for all options
* `error` - information about an error if one occurred, generated by the store platform making the purchase
