# Create Order- using Available Virtual Account from your Account Pool

<mark style="color:green;">`POST`</mark> `https://exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/CreateOrder/`

This endpoint puts you in charge of assigning virtual accounts to your collection orders.  So to create orders this way,  we have provided an endpoint above where you can get the list of available Virtual accounts (Accounts not assigned to any transaction yet) and once you get the free VA you send it along with your new order.&#x20;

The intrapay merchant id is different for each account (currency) created on Intrapay. You can find your intrapay merchant id at the bottom left AFTER YOU HAVE SETUP the wallet of that currency.&#x20;

The merchant secret is also different per currency. Find your merchant secret at the partner mapping screen by clicking on your name on the partner list.

#### Headers

| Name                                            | Type   | Description                   |
| ----------------------------------------------- | ------ | ----------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | ***Bearer*** pk\_partner\_xxx |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json              |

#### Request Body

| Name                                                                 | Type   | Description                                                                                                      |
| -------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------- |
| partner\_order\_id<mark style="color:red;">\*</mark>                 | String | Id of order generated on partners's system                                                                       |
| amount\_to\_collect<mark style="color:red;">\*</mark>                | String | amount seller or buy as listed                                                                                   |
| intrapay\_merchant\_id<mark style="color:red;">\*</mark>             | Number | merchant id on Intrapay (this is different per account)                                                          |
| timestamp<mark style="color:red;">\*</mark>                          | Number | Time order was signed. unix or epoch time in milleseconds (GMT+0)                                                |
| order\_expiration<mark style="color:red;">\*</mark>                  | String | the time to be elapsed before order becomes invalid.  unix or epoch time in milleseconds (GMT+0)                 |
| currency<mark style="color:red;">\*</mark>                           | String | currency the buyer is paying the merchant with                                                                   |
| partner\_callback\_url<mark style="color:red;">\*</mark>             | String | partner payment notification url used by IntraPay to notify Partner System about the Payment status of the order |
| partner\_redirect\_url<mark style="color:red;">\*</mark>             | String | provided by partner url to redirect buyer                                                                        |
| signature<mark style="color:red;">\*</mark>                          | String | SHA-512 of request payload signed with both merchant and partner secret key(SK\_merchant\_xxx+SK\_partner\_xxx)  |
| assigned\_virtual\_account\_number<mark style="color:red;">\*</mark> | String | The virtual account picked from the get free account endpoint. eg 1234567890                                     |
| partner\_id<mark style="color:red;">\*</mark>                        | String | The partner Id returned from the onboarding endpoint                                                             |

{% tabs %}
{% tab title="200: OK successful response" %}

```javascript
//API Response 
{
message:"OK",
redirect_url:""
}

//Response sent to callback URL
{
  "status": "success",
  "messsage": "",
  "virtual_account": {
  "account_name": "",
    "bank_name": "",
    "account_number": ""
  },
  "order_details": {
  "status": "PENDING",
  "partner_order_id": "",
  "intrapay_order_reference": ""
 }

}
```

{% endtab %}

{% tab title="400: Bad Request failed responses" %}

```javascript
{
  "status": "fail",
  "messsage": "",
  "error_code": ""
}


1001 - Order is already open / pending
1002 - Order has been canceled
1003- Order has been completed
1004- Order has expired
```

{% endtab %}
{% endtabs %}

#### Example Request- Code

```json
// request body sample
{
    "partner_order_id": "Shayo_8",
    "amount_to_collect": "300",
    "timestamp": "1726059780",
    "order_expiration": "1726061000",
    "partner_id": "p890458",
    "currency": "NGN",
    "intrapay_merchant_id": "intra_merchant_999419",
    "partner_callback_url": "https://webhook.site/fd6cdcfc76eebdfb",
    "partner_redirect_url": "https://google.com",
    "assigned_virtual_account_number": "123457812",
    "signature": "ce3822ba01f064a8ed5289b8523ddd39cea25a78ec37185ee36eedb568ff8ffd994859e10716210a627dc46a5571"
}
```
