---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk-igaming/interfaces/LoyaltyApi.md
---
[Reference](../../../index.md) / [@getenginex/sdk-igaming](../index.md) / LoyaltyApi

# LoyaltyApi

The player's loyalty (points and tier). Both methods require login.

## Methods

### get()

> **get**(`params?`, `options?`): `Promise`<[`LoyaltyStatus`](LoyaltyStatus.md)>

The player's points balance, tier and benefits.

#### Parameters

##### params?

[`NoParams`](../../sdk/type-aliases/NoParams.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`LoyaltyStatus`](LoyaltyStatus.md)>

#### Example

```ts
const loyalty = await igaming.loyalty.get()
console.log(loyalty.currentPoints, loyalty.currentTier, loyalty.tierBenefits)
```

#### Throws

`UNAUTHENTICATED` without a session. With `validation: 'strict'`,
`VALIDATION_ERROR` if `tier_benefits_json` is not a JSON object.

***

### redeem()

> **redeem**(`input`, `options?`): `Promise`<[`RedeemedPoints`](RedeemedPoints.md)>

Exchanges points for a bonus, cash or a free bet. It sends `Idempotency-Key` (generated per call
or the one in `options.idempotencyKey`, kept on the retry after renewing the session), **but the gateway does not
apply the idempotency middleware on this route yet**: a double click may redeem twice.
Lock the button until the call finishes.

#### Parameters

##### input

[`RedeemPointsInput`](RedeemPointsInput.md)

##### options?

[`CallOptions`](../../sdk/interfaces/CallOptions.md)

#### Returns

`Promise`<[`RedeemedPoints`](RedeemedPoints.md)>

#### Example

```ts
const result = await igaming.loyalty.redeem({ points: 500, redemptionType: 'bonus' })
console.log(result.redeemedPoints, result.bonusId)
```

#### Throws

`CONFIGURATION_ERROR` (without a request) if `points` is not an integer > 0 or
`redemptionType` is empty; `INSUFFICIENT_BALANCE` or `FAILED_PRECONDITION` when the service
refuses the redemption (always identify by `error.code`); `UNKNOWN` with `status` 200 if the gateway
answers without confirming the redemption (`success: false`, absent or malformed; it also applies in
`validation: 'warn'`; `message` is the gateway's when it comes, otherwise the SDK's). General rule:
`UNKNOWN` with a 2xx `status` = unconfirmed operation: re-read the state ([LoyaltyApi.get](#get))
before trying again. `UNAUTHENTICATED` without a session.
