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

# DepositsApi

Deposits via PIX. All methods require login.

## Methods

### createPix()

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

Creates a PIX charge of `amount` (minor units of the operator's currency; convert what the
player typed with `toMinorUnits`). **Idempotent**: sends `Idempotency-Key` — generated on each
call, or the one from `options.idempotencyKey` — and keeps it on the retry after renewing the session. To
repeat after `NETWORK_ERROR`/`TIMEOUT` without creating another charge, generate the key beforehand and
pass the same one in both attempts. The response is always validated in strict mode.

Check `config.limits.minDeposit`/`maxDeposit` first: outside the limits, the gateway rejects with
`INVALID_ARGUMENT` and a ready-made message (e.g. `depósito mínimo é 10.00 BRL`).

#### Parameters

##### input

###### amount

`number`

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

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

#### Example

```ts
const key = crypto.randomUUID()
const pix = await enginex.deposits.createPix(
  { amount: toMinorUnits('50,00', config.currency) },
  { idempotencyKey: key },
)
showQrCode(pix.qrCode, pix.qrCodeText, pix.expiresAt) // expiresAt may be undefined
```

#### Throws

`INVALID_ARGUMENT` (400) for an amount outside the limits or a payment that is not
configured; and, passed through from the payment service, `DEPOSIT_LIMIT_EXCEEDED` (429),
`KYC_REQUIRED` (422) and `PAYMENT_FAILED`/`PAYMENT_*`;
`RESOURCE_EXHAUSTED` (429) for the per-player deposit request limit (see `e.retryAfter`);
`KEY_IN_USE` (409) if the same key is still being processed; `PAYLOAD_MISMATCH` (422) if the
key was already used with another amount; `VALIDATION_ERROR` if the response comes outside the format (the
charge may have been created: check `list`); `UNAUTHENTICATED` without a session.

***

### get()

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

A player's deposit, to track the payment confirmation.

#### Parameters

##### input

###### depositId

`string`

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

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

#### Example

```ts
const deposit = await enginex.deposits.get({ depositId: pix.id })
if (deposit.status === 'completed') showSuccess()
```

#### Throws

`NOT_FOUND` if the id does not exist (or belongs to another player);
`UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money or currency outside
the format.

***

### list()

> **list**(`input?`, `options?`): `Promise`<[`Page`](Page.md)<[`DepositSummary`](DepositSummary.md)>>

The player's deposits, paginated.

#### Parameters

##### input?

[`ListDepositsInput`](ListDepositsInput.md)

##### options?

[`CallOptions`](CallOptions.md)

#### Returns

`Promise`<[`Page`](Page.md)<[`DepositSummary`](DepositSummary.md)>>

#### Example

```ts
const page = await enginex.deposits.list({ page: 1, perPage: 10 })
```

#### Throws

`UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with
money or currency outside the format.
