# List Future Withdrawals

- Sandbox: `POST https://sandbox.payme.io/api/get-future-withdrawals`
- Production: `POST https://live.payme.io/api/get-future-withdrawals`

## Credentials

- Request body field `seller_payme_id` (required): Our unique seller ID (MPL).

You can retreive data on expected future withdrawals of your sellers using this endpoint. 

#### Query pagination (more than 500 results)

If you are sending a query and expect to receive more than 500 results, make sure you use this function of Query Pagination. 

```json
{
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  ...
  "page_size": 100, // Max allowed page size is 500
  "page": 1
}
```

## Parameters

This endpoint takes no path, query or header parameters.

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `seller_payme_id` | string | yes | Our unique seller ID (MPL). |
| `currency` | string | no | Sale currency. [3-letter ISO 4217 name](https://en.wikipedia.org/wiki/ISO_4217). |

### Request example

```json
{
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "currency": "ILS"
}
```

## Code samples

### curl

```bash
curl -X POST 'https://sandbox.payme.io/api/get-future-withdrawals' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "currency": "ILS"
}'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/get-future-withdrawals", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
    "currency": "ILS"
  }),
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.post(
    "https://sandbox.payme.io/api/get-future-withdrawals",
    json={
        "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
        "currency": "ILS",
    },
)

print(response.text)
```

### PHP

```php
<?php

$body = <<<'BODY'
{
  "seller_payme_id": "MPL1DEMO-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "currency": "ILS"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/get-future-withdrawals');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

### 200 — OK (success)

| Field | Type | Description |
| --- | --- | --- |
| `items_count` | integer | Number of withdrawals |
| `items` | array |  |
| `items[].start_time` | integer | Date of the previous withdrawal (epoch) |
| `items[].end_time` | integer | Date of the end of the period of the withdrawal (epoch) |
| `items[].created_at` | string | Timestamp of the withdrawal creation |
| `items[].withdrawable` | integer | Indicates if the fund is withdrawable |
| `items[].source` | integer | Source of the withdrawal |
| `items[].source_text` | string | Source of the withdrawal |
| `items[].card_brand` | integer | Card brand |
| `items[].card_brand_text` | string | Card brand |
| `items[].total` | string | Withdrawal total amount |
| `items[].withdrawal_payme_code` | string | Withdrawal code |
| `status_code` | integer | Status of the request (0 - success, 1 - error) |

```json
{
  "items_count": 1,
  "items": [
    {
      "start_time": 1687774500,
      "end_time": -1,
      "created_at": "2023-06-20 14:00:20",
      "withdrawable": 1,
      "source": 1,
      "source_text": "פאיימי",
      "card_brand": 1,
      "card_brand_text": "אחר",
      "total": "156390",
      "withdrawal_payme_code": "withdrawal-code"
    }
  ],
  "status_code": 0
}
```
