> For the complete documentation index, see [llms.txt](https://vitawallet.gitbook.io/vita-business-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vitawallet.gitbook.io/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros.md).

# Withdrawal

Allows to make withdrawals from a wallet to a bank account

### Use case

Consider the client wishes to withdraw their money from the e-commerce to their personal bank account. For this, Vita Business provides the withdrawal service, which discounts money from the client's wallet and sends it to the bank account.<br>

{% hint style="warning" %}
Keep in mind that the fields required by the endpoint to make a withdrawal to a country are now dynamic, you can see more information in the forms section.
{% endhint %}

## Create Withdrawal Transaction

<mark style="color:green;">`POST`</mark> `api.vitawallet.io/api/businesses/transactions`

This method allows you to create a **withdrawal type** transaction from a wallet, the amount will be reflected negatively in the wallet's balance.&#x20;

#### Request Body

| Name                                                 | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url\_notify<mark style="color:red;">\*</mark>        | string | **HTTPS** url for **IPN** sending                                                                                                                                                                                                                                                                                                                                                                                                                         |
| beneficiary\_document\_type                          | string | <p>Recipient document tyoe<br><br>Note: visit the <a href="/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros/forms.md"><strong>forms</strong></a> to get the available document types depending on the withdrawal country.</p>                                                                                                                                                                                      |
| beneficiary\_document\_number                        | string | <p>Recipient document number<br><br><strong>Chile</strong><br>You can send this field in one of these formats:<br>11.111.111-1<br>11.111.111-K<br>11111111K<br><br><strong>Othe countries</strong><br>Only <strong>numbers</strong></p>                                                                                                                                                                                                                   |
| account\_type\_bank                                  | string | <p>Bank account type<br><br>Supported types:<br>Other than <strong>Mexico</strong><br><strong>CA</strong> Savings account<br><strong>CC</strong> Checking account<br><br><strong>CLABE</strong> only for Mexico</p><p></p><p>Note: visit the <a href="/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros/forms.md"><strong>forms</strong></a> to get the bank account types depending on the withdrawal country.</p> |
| account\_bank                                        | string | Bank account number, only **NUMBERS,** the digits count is verified according to the bank.                                                                                                                                                                                                                                                                                                                                                                |
| bank\_code                                           | string | <p>Destination bank code.</p><p><br>Note: visit the <a href="/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros/forms.md"><strong>forms</strong></a> to get the available bank codes depending on the withdrawal country.</p>                                                                                                                                                                                        |
| beneficiary\_email                                   | string | Recipient email address                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| beneficiary\_address                                 | string | Recipient residence address                                                                                                                                                                                                                                                                                                                                                                                                                               |
| beneficiary\_last\_name                              | string | Recipient Last Name                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| beneficiary\_first\_name                             | string | Recipient First Name                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| purpose\_comentary<mark style="color:red;">\*</mark> | string | Transaction description                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| purpose<mark style="color:red;">\*</mark>            | string | Transaction purpose code                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| country<mark style="color:red;">\*</mark>            | string | <p>Withdrawal country <strong>ISO</strong> code<br><br><strong>Supported countries:</strong><br><strong>CL</strong> Chile<br><strong>CO</strong> Colombia<br><strong>MX</strong> Mexico<br><strong>VE</strong> Venezuela</p>                                                                                                                                                                                                                              |
| currency<mark style="color:red;">\*</mark>           | string | \[clp, usd]                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| order<mark style="color:red;">\*</mark>              | string | **Unique** payment order id                                                                                                                                                                                                                                                                                                                                                                                                                               |
| amount<mark style="color:red;">\*</mark>             | number | <p>Transaction amount<br><br>Min amount: <strong>1000 CLP</strong></p>                                                                                                                                                                                                                                                                                                                                                                                    |
| transactions\_type<mark style="color:red;">\*</mark> | string | withdrawal                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| wallet<mark style="color:red;">\*</mark>             | string | Sender wallet **UUID**                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| city                                                 | string | <p>Recipient city<br><br>Note: visit the <a href="/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros/forms.md"><strong>forms</strong></a> to get the available bank codes depending on the withdrawal country.</p>                                                                                                                                                                                                   |
| phone                                                | string | <p>Recipient phone number</p><p></p><p>Note: visit the <a href="/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros/forms.md"><strong>forms</strong></a> to get the required fields depending on the withdrawal country.</p>                                                                                                                                                                                          |

{% tabs %}
{% tab title="201 Request CREATED" %}

```
{
    "transaction": {
        "id": "27",
        "type": "business_transaction",
        "attributes": {
            "recipient_wallet": null,
            "sender_wallet": {
                "token": "1234567890",
                "uuid": "5cb344ae-7479-4c96-b17c-f469b12a7e8b",
                "balances": {
                    "clp": 884500.0
                },
                "is_master": false,
                "created_at": "2020-01-15T20:37:17.926Z"
            },
            "status": "pending",
            "order": "12345678978945612s3181a014234",
            "currency": "clp",
            "category": "withdrawal",
            "amount": "15000.0",
            "total": "15000.0",
            "fee_value": "0.0",
            "total_fee": "0.0",
            "created_at": "2020-05-01T15:45:56.197Z"
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Note:**

For security issues, is not possible to create more than one transaction every 5 seconds. You must consider this validation for your integration.
{% endhint %}

## Forms

**Non required fields must be obtained from /withdrawal\_rules method on the forms section, since can be changed anytime.**

{% content-ref url="/pages/K2mFymU628rxdBAPFLPN" %}
[Forms](/vita-business-documentation/english/gestion-de-transacciones/crear-transaccion/retiros/forms.md)
{% endcontent-ref %}

### SDK

{% tabs %}
{% tab title="Node" %}
To make a withdrawal, the wallets module receives the **uuid** of the wallet with which you want to withdraw the money using the **withdrawal** method.

```javascript
import Business from 'vita-business-code';

try {
    // You must update prices,
    // remember prices must be updated every certain time,
    // depending on the valid_until value
    // so you can know the final amount on the recipient country
    
    await Business.wallets(uuid).updatePrices();
} catch {}

try {
    const response = await Business.wallets(uuid).withdrawal({
        url_notify: "https://example.com/notify",
        beneficiary_document_type: "CC",
        beneficiary_document_number: "1487498569",
        account_type_bank: "CA",
        account_bank: "874895988",
        bank_code: "000050",
        beneficiary_email: "example@example.com",
        beneficiary_address: "example address #33-37",
        beneficiary_last_name: "Toledo Parra",
        beneficiary_first_name: "Juan Victor",
        purpose_comentary: "send for friend",
        purpose: "EPTOUR",
        country: "CO",
        currency: "clp",
        order: "order",
        amount: 1000,
    });
} catch {}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
**Minimum withdraw amount**

The minimum amount allowed for a withdrawal is **1000 CLP**
{% endhint %}
