# Collection (Virtual Account-NGN )\*\*

This is the Async method of creating collection order it is desiigned to provide speedy responses while creating and fetching orders&#x20;

### Create Order-Without Payment Pages or in Nigeria (Virtual accounts)

#### This endpoint is also used to create an order on Intrapay&#x20;

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

If you have a payment page for collecting your end-user's phone number and network (mobile money regions) or you want to collect in **NIGERIA;** Please add *<mark style="color:green;">**"intrapay\_merchant\_id"**</mark>* and *<mark style="color:green;">**partner\_id**</mark>* in the **request body**. For Nigeria, the virtual bank account is sent as a JSON response from the API

**Note:** 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.

<mark style="color:green;">Once callback is received order appears on intrapay dashboard.</mark>

#### Headers

| Name                                            | Type   | Description                                                  |
| ----------------------------------------------- | ------ | ------------------------------------------------------------ |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json                                             |
| Authorization<mark style="color:red;">\*</mark> | String | Authorization is a bearer token which is Partners public key |

#### Request Body

| Name                                                     | Type   | Description                                                                                                     |
| -------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------- |
| partner\_order\_id<mark style="color:red;">\*</mark>     | String | Id of order generated on partners' system                                                                       |
| amount\_to\_collect<mark style="color:red;">\*</mark>    | String | amount seller or buy as listed                                                                                  |
| timestamp<mark style="color:red;">\*</mark>              | Number | Time order was created. 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 millseconds (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 | payment notification 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 partner's users                                                            |
| 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) |
| intrapay\_merchant\_id<mark style="color:red;">\*</mark> | String | The intrapay merchant id is found on your intrapay dashboard on your fiat tab.                                  |
| partner\_id<mark style="color:red;">\*</mark>            | String | this is the ID gotten from the partner onboard endpoint                                                         |

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

{% code overflow="wrap" %}

```javascript

//API Response 
{
message:"OK"
}


//callback response 1
{ "partner_order_id": "FUSPAY-Y-20251", "callbak_data": "OK" }


//callback response 2 
{ "status": "PENDING", "id": 271046, "partner_id": "p60037", "order_notify_url": " https://webhook.site/f968b3b6-964c-4418-bdb0-169f3c2c3e4c", "exchanger_user_id": 129, "intrapay_merchant_id": "intra_merchant_176833", "messsage": "Fetched successfully", "payment": { "status": "PENDING", "sender_name": "" }, "virtual_account": { "amount": 100, "account_name": "John Ibikunle", "bank_name": "GTB", "account_number": "0845342528", "virtual_account_id": 2 }, "order_details": {}
}
```

{% endcode %}
{% endtab %}

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

```javascript
{
    error: true,
    status: "error",
    message: string,
    data: null
}

```

{% endtab %}
{% endtabs %}

#### Example Request- Code

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

```javascript
const request = require('request')
const options = {
  method: 'POST',
  url: 'http://localhost:5000/api/v1/no-auth/PartnerP2P/CreateOrder',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer pk_partner_xxxxxxxx'
  },
  body: {
    partner_order_id: 'my-server-order-id',
    amount_to_collect: '100',
    timestamp: 1693285902419,
    order_expiration: 1693285902419,
    currency: 'NGN', // GHS | KHS | NGN | UGX | ZAR
    intrapay_merchant_id: "",
    partner_id: "",
    partner_callback_url: 'https://xxx...',
    partner_redirect_url: 'https://example.com?status=success&order=my-server-order-id',
    signature: 'fe04ee69d4f9a93c71f3d1bbf37d49d541e5c4fb159c4a75924f398262e2af146d0e2e33b1379a9b57c641d822c410158e03b64faab34dc98d528bfa234f9dd3'
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
```

{% endtab %}
{% endtabs %}

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

```javascript
{
  "status": "success",
  "messsage": "",
  "data": {
        "payment": {
            "status": "PENDING | PAID | REFUND"

            },
        "virtual_account": {
        "amount": "",
        "account_name": "",
        "bank_name": "",
        "account_number": ""
      },
     "order_details": {
     "status": "PENDING | COMPLETED | EXPIRED | CANCELED",
     "partner_order_id": "",
     "intrapay_order_reference": ""
     }

 }

}
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}
