# Payout

## Get Payment Methods

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/payment-methods/`

This API endpoint will return a list of available payment methods with user active payment method status.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "Payment_methods": [
            {
                "key": "<method_key>",
                "name": "<method_name>",
                "<method_key>-status": <user_active_status>
            },
            ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/payment-methods/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/payment-methods/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_POSTFIELDS => array(),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Change Payment Method

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/user/change/payment-method/`

This API endpoint will change user payment method.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

#### Request Body

| Name                                                    | Type   | Description                                                                                      |
| ------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------ |
| \<method\_key>-status<mark style="color:red;">\*</mark> | string | Need to add all available payment method status to update. formate: \<method\_key>-status:1 or 0 |
| \<method\_key>-status<mark style="color:red;">\*</mark> | string | <p>example:<br>bank-status:1<br>paypal-status:0</p>                                              |

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

```
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/change/payment-method/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {
    '<method_key>-status': '<0 or 1>',
    '<method_key>-status': '<0 or 1>',
    ...
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/change/payment-method/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('<method_key>-status' => '<0 or 1>','<method_key>-status' => '<0 or 1>',..),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | Field                 | Description                                                                                                                                   |
| ----------- | ---------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | \<method\_key>-status | <p>\<method\_key>-status field not found.<br>\<method\_key>-status value not found.</p><p>\<method\_key>-status recieved a invalid value.</p> |

## Get Payment Method Settings

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/payment-method/settings/`

This API endpoint will return a payment method settings fields with value.

#### Query Parameters

| Name   | Type   | Description             |
| ------ | ------ | ----------------------- |
| method | string | Payment method key name |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "label": "<method> Settings",
        "fields": [
            {
                "field_name": "<field_name>",
                "value": "<value>",
                "required": <boolean>,
                "max_length": <max_length>,
                "min_length": <min_length>,
                "srtipe": <boolean>,
                "input_type": "<input_type>"
            },
            ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/payment-method/settings/?method=<method_key>',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/payment-method/settings/?method=<method_key>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field  | Description                                                                                                                                        |
| ----------- | ---------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | method | <p>This field is required.</p><p>This field is may not be blank.</p><p>Requested method is not found.</p><p>Requested method is not activated.</p> |

## Get Checksum Token

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/get/checksum-token/`

This API endpoint will give a token to user mail and a checksum token in response.&#x20;

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "success": 1,
        "token_checksum": "<token_checksum>"
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/get/checksum-token/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
    'Cookie': 'store_user=admin_store; sessionid=5zuhah7hbh4newylvnluxvpgt1clo0i1'
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/get/checksum-token/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_POSTFIELDS => array(),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Update Payment Method Settings

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/user/update/payment-method/settings/`

This API endpoint will update payment method configurations.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

#### Request Body

| Name                                                     | Type   | Description                                                                 |
| -------------------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| fields<mark style="color:red;">\*</mark>                 | string | Required fields for the payment method.                                     |
| method<mark style="color:red;">\*</mark>                 | string | Payment method key.                                                         |
| token\_field<mark style="color:red;">\*</mark>           | string | Get token through mail when **Get Checksum Token** endpoint is called.      |
| token\_checksum\_field<mark style="color:red;">\*</mark> | string | Get checksum token through the response of **Get Checksum Token** endpoint. |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/update/payment-method/settings/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {
    'method': '<method_key>',
    'token_field': '<token>',
    'token_checksum_field': '<token_checksum>',
    '<required_field_1>': '<field_value>',
    '<required_field_2>': '<field_value>',
    ...
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/update/payment-method/settings/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('method' => '<method_key>','token_field' => '<token>','token_checksum_field' => '<token_checksum>','<other_required_fields>' => '<field_values>',..),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field                                                       | Description                                                                                                                                        |
| ----------- | ---------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | method                                                      | <p>This field is required.</p><p>This field is may not be blank.</p><p>Requested method is not found.</p><p>Requested method is not activated.</p> |
| 400         | Validation Error | token\_field                                                | <p>This field is required.</p><p>This field is may not be blank.</p>                                                                               |
| 400         | Validation Error | token\_checksum\_field                                      | <p>This field is required.</p><p>This field is may not be blank.</p>                                                                               |
| 400         | Validation Error | <p>other required fields for the </p><p>payment method.</p> | other fields validation errors.                                                                                                                    |

## Payout History

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/payout/history/`

This API endpoint will return a list of payout history.

#### Query Parameters

| Name           | Type   | Description                                                                                                  |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
| offset         | string |                                                                                                              |
| limit          | string |                                                                                                              |
| currency\_code | string |                                                                                                              |
| wallet         | string | wallet1, walle2, ...                                                                                         |
| type           | string | all, active, reject, completed, cancelled                                                                    |
| status         | string | 0:  'Requested',1: 'Processing' ,2: 'Paid',3: 'Rejected / Pay later',4: 'Spam' ,5: 'Removed', 6: 'Cancelled' |
| from\_date     | string | fromate: mm/dd/yyyy                                                                                          |
| to\_date       | string | fromate: mm/dd/yyyy                                                                                          |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Beaere access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
            {
                "id": <id>,
                "amount_requested": "<amount_requested>",
                "charge": "<charge>",
                "payable_amount": "<payable_amount>",
                "status": {
                    "label": "<status_label>",
                    "color ": "<color>"
                },
                "payout_method": "<payout_method>",
                "extra": {
                    "amount": <amount_requested>,
                    "charge": <charge>,
                    "amount_paid": <amount_paid>,
                    "payout_method": "<payout_method>",
                    "payout_wallet": "<payout_wallet>",
                    "payout_currency": "<payout_currency>"
                },
                "payable_converted_amount": "<Ƀ0.00075748>",
                "process_date": "<process_date>"
            }
            ...
        ],
        "count": <list_count>,
        "previous": <previous_page_url>,
        "next": <next_page_url>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/payout/history/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/payout/history/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field          | Description            |
| ----------- | ---------------- | -------------- | ---------------------- |
| 400         | Validation Error | currency\_code | Invalid Currency Code. |
| 400         | Validation Error | from\_date     | Invalid date format    |
| 400         | Validation Error | to\_date       | Invalid date format    |
| 400         | Validation Error | status         | Invalid status value.  |

## Request Payout

### Get Payout Enabled Wallets

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/withdraw/request/`

This API endpoint will return a list of withdrawal enabled wallets.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": [
        {
            "key": "<wallet_key>",
            "name": "<Wallet_name>"
        },
        ...
    ]
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/withdraw/request/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/withdraw/request/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

### Get Payment Methods

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/withdraw/request/`

This API endpoint will return a list of active payment methods and their details, under the selected wallet.

#### Query Parameters

| Name           | Type   | Description                      |
| -------------- | ------ | -------------------------------- |
| wallet         | string | Key of wallet you were selected. |
| currency\_code | string | Currency code                    |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "payout_methods_available": [
            {
                "key": "<method_key>",
                "name": "<method_name>"
            },
            ...
        ],
        "payment_method_settings": [
            [
                {
                    "enable_wallet_withdrwal": <enabled_status>,
                    "payment_method": [
                        "<method_key>",
                        ...
                    ],
                    "available_roles": [
                        <available_roles>
                    ],
                    "min_withdraw_amount": "<min_withdraw_amount>",
                    "max_withdraw_amount": "<max_withdraw_amount>",
                    "widraw_charge": "<widraw_charge>",
                    "widraw_charge_type": "<widraw_charge_type>",
                    "available_days": [
                        "All",
                        "Monday",
                        "Tuesday",
                        "Wednesday",
                        "Thursday",
                        "Friday",
                        "Saturday",
                        "Sunday"
                    ],
                    "payout_limit": "<payout_limit>",
                    "payout_limit_period": [
                        "<payout_limit_period>"
                    ]
                },
                ...
            ]
        ],
        "currency_code": "<currency_code>",
        "currency_rate_details": {
            "decimals": <decimals>,
            "symbol_placement": "<symbol_placement>",
            "symbol": "<currency_symbol>",
            "rate": <currency_convertion_rate>
        },
        "wallet_balance": <wallet_balance>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/withdraw/request/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/withdraw/request/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field          | Description                                               |
| ----------- | ---------------- | -------------- | --------------------------------------------------------- |
| 400         | Validation Error | wallet         | This field may not be blank.                              |
| 400         | Validation Error | wallet         | Wallet withdrawal is disabled, Please contact your admin. |
| 400         | Validation Error | currency\_code | Invalid Currency Code.                                    |

### Request Payout

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/user/withdraw/request/`

This API endpoint will create a withdrawal request.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

#### Request Body

| Name                                                     | Type   | Description                                         |
| -------------------------------------------------------- | ------ | --------------------------------------------------- |
| form\_key<mark style="color:red;">\*</mark>              | string | Get form key through the (**Form Key**) endpoint.   |
| currency\_code<mark style="color:red;">\*</mark>         | string | Currency code                                       |
| wallet<mark style="color:red;">\*</mark>                 | string | wallet key                                          |
| method<mark style="color:red;">\*</mark>                 | string | payment method key                                  |
| amount<mark style="color:red;">\*</mark>                 | string | withdraw amount                                     |
| token\_field<mark style="color:red;">\*</mark>           | string | mail token                                          |
| token\_checksum\_field<mark style="color:red;">\*</mark> | string | token checksum - response of **Get Checksum Token** |

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

```
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/withdraw/request/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <acess token>'
  },
  formData: {
    'method': '<payment_method>',
    'wallet': '<wallet_key>',
    'amount': '<amount>',
    'token_field': '<mail_token>',
    'token_checksum_field': '<token_checksum>'
    'form_key':'<form_post_key>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/withdraw/request/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('method' => '<payment_method>','wallet' => '<wallet_key>','amount' => '<amount>','token_field' => '<mail_token>','token_checksum_field' => '<token_checksum>','form_key':'<form_post_key>'),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------- | ---------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | currency\_code         | Invalid Currency Code.                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 400         | Validation Error | wallet                 | <p>wallet is not defined.</p><p>Wallet withdrawal is disabled, Please contact your admin.</p><p>Already a request is pending.</p><p>Insufficient wallet balance.</p>                                                                                                                                                                                                                                                                    |
| 400         | Validation Error | amount                 | <p>amount is not defined.</p><p>Please enter valid amount.</p><p>Minimum withdrawal amount is \<min\_amount></p><p>Maximum withdrawal amount is \<min\_amount></p>                                                                                                                                                                                                                                                                      |
| 400         | Validation Error | method                 | <p>method is not defined.</p><p>Please choose a valid payout methods.</p><p>Some encryption error occured.</p><p>No account details found for this wallet.</p><p>No payment method details found for this wallet.</p><p>insufficient wallet balance.</p><p>You can't create the request, your \<payout\_limit\_period> balance is \<max\_formated\_amount></p><p>Unable to continue this request, Please contact your administrator</p> |
| 400         | Validation Error | token\_field           | <p>This field is required.</p><p>This field is may not be blank.</p><p>Token is not matching.</p>                                                                                                                                                                                                                                                                                                                                       |
| 400         | Validation Error | token\_checksum\_field | <p>This field is required.</p><p>This field is may not be blank.</p>                                                                                                                                                                                                                                                                                                                                                                    |
| 401         | Request Failed   |                        | <p>Payout Request History Failed.</p><p>Payout Request Failed.</p>                                                                                                                                                                                                                                                                                                                                                                      |
| 400         | Validation Error | form\_key              | <p>This field is required.</p><p>This field is may not be blank.</p><p>You have another form running, Please reload.</p>                                                                                                                                                                                                                                                                                                                |

## Cancel Payout Request

<mark style="color:red;">`DELETE`</mark> `‎https://<domain>/<api prefix>/<version>/user/cancel/withdraw/request/`

This API endpoint will cancel a payout request.

#### Query Parameters

| Name                                         | Type   | Description                          |
| -------------------------------------------- | ------ | ------------------------------------ |
| wallet<mark style="color:red;">\*</mark>     | string | Wallet name eg:wallet1,wallet2,..... |
| payout\_id<mark style="color:red;">\*</mark> | string | Withdrawal request-id.               |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://<domain>/<api prefix>/<version>/user/cancel/withdraw/request/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access tooken>',
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/cancel/withdraw/request/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'DELETE',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type         | Field      | Description                                                                                     |
| ----------- | ------------------ | ---------- | ----------------------------------------------------------------------------------------------- |
| 400         | ￼￼Validation Error | wallet     | <p>This field is required.</p><p>This field may not be blank.</p><p>Invalid wallet.</p>         |
| 400         | ￼￼Validation Error | payout\_id | <p>This field is required.</p><p>This field may not be blank.</p><p>Invalid payout id.</p>      |
| 400         | ￼￼Validation Error | payout\_id | <p>Withdrawal request is invalid.</p><p>Withdrawal request is invalid.No transaction found.</p> |
