# Transaction

## Making a payment

<mark style="color:green;">`POST`</mark> `https://api.vendex.app/api_merchant/transaction/payment/`

To confirm and execute payment. Once this api is called, credit value of the payer will be deducted. Authorization signature is required for this API call.

#### Headers

| Name                 | Type   | Description                                                      |
| -------------------- | ------ | ---------------------------------------------------------------- |
| Api-Client-Token     | string | Client token obtained from client authentication method.         |
| Api-Sale-Point-Token | string | Sale point token obtained from sale point authentication method. |
| Content-type         | string | Content type need to be set as application/json.                 |

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

```javascript
// Successfull payment 
{
    "status": "success",
    "detail": "Payment success",
    "data": {
        "transaction_signature": "6nbv84e5f81dacd2b844c28a7e674cd13961e821c9b559a08b926c736fc5aaff"
    }
}


// Payment failed (validation failed or network error)
{
    "status": "error",
    "detail": "Not enough balance"
}
```

{% endtab %}
{% endtabs %}

#### Example of POST data(JSON)

```javascript
{
    "amount": 100.00,
    "currency_code": "USD",
    "transaction_signature": "9ef4e5f81dacd2b844c28a7e674cd13961e821c9b559a08b926c736fc5aaffa2"
    "authorization_signature": "5nbv84e5f81dacd2b844c28a7e674cd13961e821c9b559a08b926c736fc5aaff"
    "description": "1 x Oreo"
}
```

## &#x20;Payment refund

<mark style="color:green;">`POST`</mark> `https://api.vendex.app/api_merchant/transaction/refund/`

This endpoint allow sale point to refund previous payment. In normal condition refund payment can be done if product not delivered or dispensed fail.

#### Headers

| Name                 | Type   | Description                                                     |
| -------------------- | ------ | --------------------------------------------------------------- |
| Api-Client\_Token    | string | Client token obtained from client authentication method         |
| Api-Sale-Point-Token | string | Sale point token obtained from sale point authentication method |
| Content-Type         | string | Content type need to be set as application/json.                |

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

```javascript
{
    "status": "success",
    "detail": "Refund payment success"
}
```

{% endtab %}
{% endtabs %}

```javascript
{
    "amount": 100.00,
    "currency_code": "USD",
    "transaction_signature": "9ef4e5f81dacd2b844c28a7e674cd13961e821c9b559a08b926c736fc5aaffa2"
    "authorization_signature": "5nbv84e5f81dacd2b844c28a7e674cd13961e821c9b559a08b926c736fc5aaff"
    "description": "Sale point refund."
}
```
