# Order Management (Async)&#x20;

### Mobile Money Providers&#x20;

## Get the available mobile money operators of a country

<mark style="color:blue;">`GET`</mark> `https://exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/MobileMoney/`

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | String | application/json |

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

```javascript
{
    "ghana": {
        "Country": "Ghana",
        "list": [
            {
                "name": "MTN",
                "code": "MTN"
            },
            {
                "name": "Vodacom",
                "code": "VOD"
            },
            {
                "name": "Airtel Money",
                "code": "ATM"
            }
        ]
    },
    "kenya": {
        "Country": "Kenya",
        "list": [
            {
                "name": "MPESA (Safaricom)",
                "code": "MPESA"
            }
        ]
    },
    "uganda": {
        "Country": "Uganda",
        "list": [
            {
                "name": "MTN",
                "code": "MTN"
            },
            {
                "name": "Airtel Money",
                "code": "ATM"
            },
            {
                "name": "Warid Pesa",
                "code": "WARID"
            },
            {
                "name": "Orange money",
                "code": "ORANGE"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### Digital Signature

## This endpoint is used to sign the request body. and generate the digital signature.

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

The object is signed without including the signature field.&#x20;

#### Headers

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

#### Request Body

<table><thead><tr><th width="221">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>partner_order_id<mark style="color:red;">*</mark></td><td>String</td><td>the order id on partners end</td></tr><tr><td>amount_to_collect<mark style="color:red;">*</mark></td><td>String</td><td>the amount to be collected </td></tr><tr><td>timestamp<mark style="color:red;">*</mark></td><td>String</td><td>the time the order was created</td></tr><tr><td>order_expiration<mark style="color:red;">*</mark></td><td>String</td><td>the time the order would expire</td></tr><tr><td>currency<mark style="color:red;">*</mark></td><td>String</td><td>the currency of collection eg GHS, NGN</td></tr><tr><td>partner_callback_url<mark style="color:red;">*</mark></td><td>String</td><td>the url where payment confirmation would be posted</td></tr><tr><td>partner_redirect_url<mark style="color:red;">*</mark></td><td>String</td><td>partners site where users would be redirected after successful payment </td></tr><tr><td>secret<mark style="color:red;">*</mark></td><td>String</td><td>merchant secret and partner secret concatenated </td></tr></tbody></table>

#### Sample code

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

```javascript
const request = require('request');


const options = {
  method: 'POST',
  url: 'https://exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/SignRequestSha512',
  headers: {'Content-Type': 'application/json'},
  body: {
    partner_order_id: 'FUSPAY-00400-001-091-008',
    amount_to_collect: '3',
    timestamp: 1693285902419,
    order_expiration: 1693285902419,
    currency: 'GHS',
    partner_callback_url: 'https://webhook.site/xxxxxxxx',
    partner_redirect_url: 'https://google.com',
    secret: '4LJDHGA-SJTECNA-XXXX-XXXXsk_partner_ph25sjy-qtfeoxy-rqbvzyq-z-xx'
  },
  json: true
};

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

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

{% endtab %}
{% endtabs %}

### Create Order - Using Payment Pages

## This endpoint is 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/`

So,  if you want a payment page (a screen that allows your users input their phone number & network), Please include *<mark style="color:green;">**x-partner-id, x-merchant-secret**</mark>* in the **header** and ignore *<mark style="color:red;">**intrapay\_merchant\_id**</mark>* in the request body.

**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;">Orders start to appear on Intrapay dashboard after user has visited the payment page and has accepted payment on their phone.</mark>&#x20;

#### Headers

| Name                                                | Type   | Description                                                                                                                 |
| --------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| x-merchant-secret<mark style="color:red;">\*</mark> | String | The secret key of the merchant (this is different for each country) and can be gotten from your dashboard (partner mapping) |
| Content-Type<mark style="color:red;">\*</mark>      | String | application/json                                                                                                            |
| x-partner-id<mark style="color:red;">\*</mark>      | String | The ID of the partner (Binance) sending the order                                                                           |
| 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) |
| phone                                                    | String | The phone number of the sender. for Mobile Money only                                                           |
| mobile\_money\_network                                   | String | This is the mobile money provider. eg MTN, VOD, ATM                                                             |

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

{% code overflow="wrap" %}

```javascript
//API response
OK 





//Callback Response 1
{ "partner_order_id": "FUSPAY-Y-20251", "callbak_data": "OK" }




//Callback response 2
{"": "https://intrapay.fuspay.finance/b2b?partner_id=p60037&currency=KHS&amount=1001&fee=0&order_id=593163277406920704&lang=eng-NG&country=kenya&tk=YN6ITFY-ECIEG2A-VCEAT2I-ARZKZEA7388"}

```

{% endcode %}
{% endtab %}

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

{% code overflow="wrap" %}

```javascript
{ "status": "error", "message": "Public Key combination is not valid", "partner_order_id": "FUSPAY-Y-20251", "signature": "8cb88b058e32460560d707788c759f25201c5a353596c9d271922ba2b0f89541f779642c08a8993bc37ab96cd7cb97ff291a38b6d29ab6642e0979de9077a992" }



```

{% endcode %}
{% 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',
    'x-partner-id': 'pxxxx',
    'x-merchant-secret': 'xxx-xxx-xxx',
    Authorization: 'Bearer pk_partner_xxxxxxxx'
  },
  body: {
    partner_order_id: 'my-server-order-id',
    amount_to_collect: '10',
    phone: "254XXXXXX",
    mobile_money_network: "MTN",
    timestamp: 1693285902419,
    order_expiration: 1693285902419,
    currency: 'GHS', // GHS | KHS | NGN | UGX | ZAR
    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 %}

{% tab title="cURL" %}

```
curl "https://exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/CreateOrder" \
  -H 'Content-Type: application/json' \
  -H 'x-intrapay-partner-secret: H36ZOEA-HK7EWOQ-TVM2C6A-QH6BW2Q53954' \
  -H 'Authorization: Bearer pk_partner_xxxx' \
  -X POST \
  -b 'connect.sid'='s%3AoNBPv4ez8npeuKVKlS9KwX_1Dshiamlf.n8opjPuoF3XsU%2Be0VTLMUe6xzeAXmpCfQrpW9KW1KDs' \
  -d '{
  "partner_order_id": "",
  "amount_to_collect": "",
  "intrapay_merchant_id": "",
  "timestamp": "",
  "order_expiration": "",
  "currency": "",
  "partner_callback_url": "",
  "partner_redirect_url": "",
  "signature": "sha-512-of-req-body-signed-with-SK_merchant_xxx+SK_partner_xxx"
}' 
```

{% endtab %}
{% endtabs %}

### Create Order-Without Payment Pages or in Nigeria

## 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) |
| phone                                                    | String | The phone number of the sender. for Mobile Money only                                                           |
| mobile\_money\_network                                   | String | This is the mobile money provider. eg MTN, VOD, ATM                                                             |
| 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 %}

### fetch order

## This endpoint is used to fetch an order to verify its status

<mark style="color:blue;">`GET`</mark> `https://prod-order-exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/FetchOrder?partner_order_id=xx&partner_id=xx/`

**Order Status**&#x20;

Pending = newly created orders that has not been fulfilled in 45 mins&#x20;

Completed = Order that has been fulfilled and a callback has been returned in 45 mins&#x20;

Mismatched = this is when a user pays above or below the amount on the order.&#x20;

Expired = Order that payment was made but callback wasnt returned in 45 mins&#x20;

Abandoned = an order that a user hasnt paid into in over 45 mins&#x20;

Claimed = in cases of mismatched and expired merchants can decide to claim the money paid&#x20;

#### Query Parameters

| Name                                                 | Type   | Description                   |
| ---------------------------------------------------- | ------ | ----------------------------- |
| partner\_order\_id<mark style="color:red;">\*</mark> | String | the id of the order generated |
| partner\_id<mark style="color:red;">\*</mark>        | String | the Id of the partner         |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | partners public key |
| Content-Type<mark style="color:red;">\*</mark>  | String | application/json    |

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

```
{
  "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" %}

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

{% endtab %}
{% endtabs %}

#### Example Request- Code&#x20;

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

```javascript
const fetch = require('node-fetch');

fetch("https://exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/FetchOrder?partner_order_id=xxxxx", {
  "method": "GET",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer pk_partner_xxxx",
    "cookie": "connect.sid=s%253AoNBPv4ez8npeuKVKlS9KwX_1Dshiamlf.n8opjPuoF3XsU%252Be0VTLMUe6xzeAXmpCfQrpW9KW1KDs"
  }
})
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

{% endtab %}

{% tab title="cURL" %}

```
curl "https://exchanger-api.fuspay.finance/api/v1/no-auth/PartnerP2P/FetchOrder?partner_order_id=xxxxx" \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer pk_partner_xxxx' \
  -X GET \
  -b 'connect.sid'='s%3AoNBPv4ez8npeuKVKlS9KwX_1Dshiamlf.n8opjPuoF3XsU%2Be0VTLMUe6xzeAXmpCfQrpW9KW1KDs' 
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fuspay.gitbook.io/intrapay-p2p-automation/integration/order-management-async.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
