# createTransaction

## Creating a new transaction

## Create a new transaction

<mark style="color:green;">`POST`</mark> `https://pay.imal.dev/api/createTransaction`

Creates a new transaction.

#### Request Body

| Name                                          | Type   | Description                                                                                            |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| key<mark style="color:red;">\*</mark>         | string | Your merchant API key.                                                                                 |
| description<mark style="color:red;">\*</mark> | string | Description of the transaction (eg. Invoice #63729)                                                    |
| tokenid<mark style="color:red;">\*</mark>     | string | tti\_ of the vite token used for the transaction                                                       |
| amount<mark style="color:red;">\*</mark>      | String | RAW Amount of the token used for the transaction                                                       |
| memoprefix                                    | String | Prefix for the memo used in the transaction (eg. "gifts" would result in something like "gifts823729") |
| destination<mark style="color:red;">\*</mark> | String | Address the funds should be sent to.                                                                   |
| redirecturl<mark style="color:red;">\*</mark> | String | "Back to merchant" URL                                                                                 |

{% tabs %}
{% tab title="200 Transaction successfully created" %}

```javascript
{
  "code": 1,
  "id": "927192719",
  "expires": "192019281",
  "url": "https://pay.imal.dev/pay/82837829"
}
```

{% endtab %}

{% tab title="400: Bad Request memoPrefix too long" %}

```javascript
{
  "code": 2
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid TokenID" %}

```javascript
{
  "code": 3
}
```

{% endtab %}

{% tab title="400: Bad Request Incorrect destination address" %}

```javascript
{
  "code": 4
}
```

{% endtab %}

{% tab title="400: Bad Request Amount is NaN (Not a number)" %}

```javascript
{
  "code": 5
}
```

{% endtab %}

{% tab title="400: Bad Request Redirect URL invalid or empty." %}

```javascript
{
  "code": 7
}
```

{% endtab %}

{% tab title="400: Bad Request Description too long (max. 75 characters)" %}

```javascript
{
  "code": 6
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API Key" %}

```javascript
{
  "code": 8
}
```

{% endtab %}

{% tab title="500: Internal Server Error SQL/Server Error" %}

```javascript
{
  "code": 500
}
```

{% endtab %}
{% endtabs %}
