> For the complete documentation index, see [llms.txt](https://axis-docs.fuspay.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axis-docs.fuspay.finance/sell-crypto-off-ramp/create-sell-order-endpoint.md).

# Create Sell Order Endpoint

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

All events will be communicated to the callback registered in the post request.

Event request body will be updated as the sell order progresses through the following phases:&#x20;

a. event.sell.init // buy order started, awaiting crypto payment

b. event.sell.received.crypto // crypto payment received by axis

c.event.sell.credited.fiat // transaction completed.user account credited&#x20;

d. event.sell.error // error occured

<mark style="color:red;">Event body is signed with sha 512. sha512(body, public\_key+secret\_key)</mark>

### The diagram below shows the complete flow of a sell order&#x20;

<figure><img src="/files/wWnJH7IO7mmknKi4iRJA" alt=""><figcaption></figcaption></figure>

{% file src="/files/TU7xbEUUR4LgwvOyTsEB" %}

Sample of the Event body would be posted below after the endpoints description&#x20;

#### Headers

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer ${partner\_secret\_key}" |
| x-partner-id<mark style="color:red;">\*</mark>  | String | "pxxxxxx"                        |

#### Request Body

| Name                                                          | Type   | Description                                                                                                                     |
| ------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------- |
| partner\_order\_id<mark style="color:red;">\*</mark>          | String | Id of order generated on partners's system                                                                                      |
| chain<mark style="color:red;">\*</mark>                       | String | e.g usdt-trc20, usdc-matic                                                                                                      |
| crypto\_amount<mark style="color:red;">\*</mark>              | String | the amount of USDT to be exchanged                                                                                              |
| fiat\_currency\_to\_receive<mark style="color:red;">\*</mark> | String | equivalent fiat user would receive based on exchange rate                                                                       |
| partner\_callback\_url<mark style="color:red;">\*</mark>      | String | The partner Id returned from the onboarding endpoint                                                                            |
| seller\_phone<mark style="color:red;">\*</mark>               | String | phone number of the seller                                                                                                      |
| seller\_email<mark style="color:red;">\*</mark>               | String | Email of the seller                                                                                                             |
| first\_name<mark style="color:red;">\*</mark>                 | String | First name of the seller                                                                                                        |
| last\_name<mark style="color:red;">\*</mark>                  | String | last name of the seller                                                                                                         |
| account\_name<mark style="color:red;">\*</mark>               | String | The name of the account holder.                                                                                                 |
| account\_number<mark style="color:red;">\*</mark>             | String | This is the bank account number or phone number if MOMO                                                                         |
| account\_code<mark style="color:red;">\*</mark>               | String | This is the bank code or MOMO provider (Mpesa, MTN) . A code that represents the bank where the fiat would be transferred to    |
| intrapay\_merchant\_id<mark style="color:red;">\*</mark>      | String | Intrapay Merchant ID is a unique identification number gotten by signing up and setting up your wallet on Intrapay.             |
| markup\_fee<mark style="color:red;">\*</mark>                 | String | This is the percentage charge that would be applied in the transaction with the merchant. It is paid into your intrapay wallet. |
| refund\_wallet\_address<mark style="color:red;">\*</mark>     | String | this is the eusd wallet address of the seller                                                                                   |

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

{% code overflow="wrap" %}

```json
Response {
    "message":"OK"
}

The actual response (Event Body) is sent to your callback URL. we send to your callback URL to make responses fast.
```

{% endcode %}
{% endtab %}

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

```
{
     error: true,
     message: string,
     data: null
     }
```

{% endtab %}
{% endtabs %}

SELL EVENTS

{% tabs %}
{% tab title="event.sell.init (1)" %}

```json
{
  "event_name": "event.sell.init",
  "partner_order_id": "BETA-AXIS-SELL-NGN-0004001",
  "fuspay_order_ref": "BETA-AXIS-SELL-NGN-0004001_p176517",
  "fiat_amount_to_receive": 1000,
  "crypto_amount_to_sell": 100,
  "exchange_rate": 10,
  "pair": "USDT/NGN",
  "fiat_currency": "NGN",
  "pay_to_crypto_address": "TXLYE1yx8LyXfTY1utnXEm7DtzWsgvYBWB",
  "chain": "usdt-trc20",
  "fiat_payment_status": "PENDING",
  "crypto_payment_status": "PENDING",
  "seller_fiat_account": {
    "account_name": "",
    "account_number": "",
    "account_code": ""
  },
  "seller_crypto_txn_hash": null,
  "partner_callback_url": "https://webhook.site/7659f3d1-e7a1-4671-88c8-949e6850dbb7",
  "transactional_kyc": {
    "email": "",
    "phone": "",
    "first_name": "",
    "last_name": ""
  },
  "signature": "62f1665caaac7e1084d3100ba41cbc262ea71c5c15dcc329b1e5d13076027e8ad446eccd3f87e7fcd0af1459e8"
}
```

{% endtab %}

{% tab title="event.sell.received.crypto (2)" %}

```json
{
  "event_name": "event.sell.received.crypto",
  "partner_order_id": "BETA-AXIS-SELL-NGN-0004001",
  "fuspay_order_ref": "BETA-AXIS-SELL-NGN-0004001_p176517",
  "fiat_amount_to_receive": 1000,
  "crypto_amount_to_sell": 100,
  "exchange_rate": 10,
  "pair": "USDT/NGN",
  "fiat_currency": "NGN",
  "pay_to_crypto_address": "TXLYE1yx8LyXfTY1utnXEm7DtzWsgvYBWB",
  "chain": "usdt-trc20",
  "fiat_payment_status": "STARTED",
  "crypto_payment_status": "PAID",
  "seller_fiat_account": {
    "account_name": "",
    "account_number": "",
    "account_code": ""
  },
  "seller_crypto_txn_hash": "b9c4e6d87c6a38a43631c2c0a4f047d8038f7bf717723ea3c6346b1084438fa7",
  "partner_callback_url": "https://webhook.site/7659f3d1-e7a1-4671-88c8-949e6850dbb7",
  "transactional_kyc": {
    "email": "",
    "phone": "",
    "first_name": "",
    "last_name": ""
  },
  "signature": "ebc0a4b462b4c656bea4bd74b9cb1673979e991c413f139b7e00d6191c85fd3b3cc"
}
```

{% endtab %}

{% tab title="event.sell.received.fiat\_kyc\_error" %}

```json
{
    "event_name": "event.sell.received.fiat_kyc_error",
    "partner_order_id": "SENTZ-SELL-ORDER-TEST-MY-IP-7",
    "fuspay_order_ref": "SENTZ-SELL-ORDER-TEST-MY-IP-7_p533522",
    "fiat_amount_to_receive": 14700,
    "crypto_amount_to_sell": 10,
    "exchange_rate": 1490,
    "pair": "NGN/USDT",
    "fiat_currency": "NGN",
    "pay_to_crypto_address": "TMy5QkqNiad5VJdidfyg6gnMpuCD7jLEac",
    "chain": "usdt-trc20",
    "fiat_payment_status": "STARTED",
    "crypto_payment_status": "PAID",
    "seller_fiat_account": {
        "account_name": "",
        "account_number": "",
        "account_code": ""
    },
    "seller_crypto_txn_hash": "7c52f888bccdb9c12e88e57a08a8e993fdd578abe8413161be2cf9aaea",,
    "partner_callback_url": "https://ec0b-2600-1700-f90-55f0-494-231d-7b2c-17da.ngrok-free.app",
    "transactional_kyc": {
        "email": "",
        "phone": "",
        "first_name": "",
        "last_name": ""
    },
    "signature": "a52b53238fba0f487b3d0b19769bb4a691fda0f82b8e544c2c05ad66c0afa07e0a9cca8857a7ae7d5235927e88db33912bc",
    "default_kyc_url": "https://kyc.fuspay.finance",
    "message": "Seller needs to perform KYC",
    "kyc_error_type": "NO_KYC"
}
// The kyc_error_type message could either be "NO_KYC", for when user has not done KYC or "THIRD_PARTY_ERROR", for when the sellerfiat payment account name is different from the transctional kyc name. 
```

{% endtab %}

{% tab title="event.sell.credited.fiat (3)" %}

```json
{
  "event_name": "event.sell.received.crypto",
  "partner_order_id": "BETA-AXIS-SELL-NGN-0004001",
  "fuspay_order_ref": "BETA-AXIS-SELL-NGN-0004001_p176517",
  "fiat_amount_to_receive": 1000,
  "crypto_amount_to_sell": 100,
  "exchange_rate": 10,
  "pair": "USDT/NGN",
  "fiat_currency": "NGN",
  "pay_to_crypto_address": "TXLYE1yx8LyXfTY1utnXEm7DtzWsgvYBWB",
  "chain": "usdt-trc20",
  "fiat_payment_status": "STARTED",
  "crypto_payment_status": "PAID",
  "seller_fiat_account": {
    "account_name": "Avis Charles",
    "account_number": "",
    "account_code": "090405"
  },
  "seller_crypto_txn_hash": "b9c4e6d87c6a38a43631c2c0a4f047d8038f7bf717723ea3c6346b1084438fa7",
  "partner_callback_url": "https://webhook.site/7659f3d1-e7a1-4671-88c8-949e6850dbb7",
  "transactional_kyc": {
    "email": "",
    "phone": "",
    "first_name": "",
    "last_name": ""
  },
  "signature": "ebc0a4b462b4c9a4643201e6269994f6a9bf68cac41b52a44d4bd74b9cb1673979e991c522a388a2413f139b7e00d6191c85fd3b3cc"
}
```

{% endtab %}

{% tab title="sell.event.close" %}

```json5
{
  event_name: 'sell.event.close',
  partner_order_id: string,
  fuspay_order_ref: string,
  fiat_amount_to_receive: number,
  crypto_amount_to_sell: number,
  exchange_rate: number,
  pair: string,
  fiat_currency: string,
  pay_to_crypto_address: string,
  chain: string,
  fiat_payment_status: string,
  crypto_payment_status: string,
  seller_fiat_account: { 
    account_name: string, 
    account_number: string, 
    account_code: string 
    },
  seller_crypto_txn_hash: string,
  partner_callback_url: string,
  transactional_kyc: { 
    email: string, 
    phone: string,
    first_name: string, 
    last_name: string 
    },
  signature: string,
  meta_data: {
    status: 'refunded', // refunded 
    message: 'seller has been refunded',
    refund_account: string, // account number to refund
    amount_refunded: string,
    fee: number
  }
}

```

{% endtab %}
{% endtabs %}

### Event Body Description

<table><thead><tr><th width="171">Keys</th><th width="198">Description</th><th>Values</th></tr></thead><tbody><tr><td>event_name</td><td>This is the name of the buy event</td><td>event buy init, event buy received fiat, event buy credited crypto.</td></tr><tr><td>partner_order_id</td><td>Id of order generated on partner's system</td><td></td></tr><tr><td>fuspay_order_ref</td><td>Reference number of order generated on Fuspay system</td><td></td></tr><tr><td>fiat_amount_to_pay</td><td>The equivalent fiat amount user would pay based on exchange rate</td><td></td></tr><tr><td>crypto_amount_to_receive</td><td>This is the amount of cryptocurrency to be received</td><td></td></tr><tr><td>exchange_rate</td><td>This is the exchange rate</td><td></td></tr><tr><td>pair</td><td></td><td></td></tr><tr><td>fiat_currency</td><td>This is the amount of fiat currency to be bought</td><td></td></tr><tr><td>buyer_crypto_address</td><td>The buyer's crypto address </td><td></td></tr><tr><td>chain</td><td>e.g. usdt-trc20, usdc-matic</td><td></td></tr><tr><td>fiat_payment_status</td><td>This is the fiat payment status. </td><td>Pending (payment has not been fully processed yet) or Paid (payment is fully processed and successful)</td></tr><tr><td>crypto_payment_status</td><td>This is the crypto payment status. </td><td>Started (payment is in process), Completed (payment is fully processed and completed)</td></tr><tr><td></td><td></td><td></td></tr><tr><td>account_name</td><td>This is the name of the account holder</td><td></td></tr><tr><td>account_number</td><td>This is the bank account number or phone number if MOMO</td><td></td></tr><tr><td>bank_name</td><td>The name of the bank</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>email</td><td>Email of the buyer</td><td></td></tr><tr><td>phone</td><td>Phone number of the buyer</td><td></td></tr><tr><td>first_name</td><td>First name of the buyer</td><td></td></tr><tr><td>last_name</td><td>Last name of the buyer</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>payment_link</td><td>This is the payment link given to the buyer </td><td>Null (no value), //available for MOMO payments</td></tr><tr><td>crypto_txn_hash</td><td>This is the crypto transaction has given to the buyer</td><td>Null (no value)</td></tr><tr><td>partner_callback_url</td><td>The partner Id returned from the onboarding endpoint</td><td></td></tr><tr><td>signature</td><td>This is the buyer's signature</td><td>Null (no value), // sha512 signed with public key + secret key      }</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

Sample event for Sell Order

```javascript
Event body {
       event_name: "event.sell.init or ...",
       partner_order_id: "",
       fuspay_order_ref: "",
       fiat_amount_to_receive: "",
       crypto_amount_to_sell: "",
       exchange_rate: "",
       pair: "",
       fiat_currency: "",
       pay_to_crypto_address: "",
       chain: "usdt-trc20",
       fiat_payment_status: "", // PENDING, CANCELED, PAID
       crypto_payment_status: "", // PENDING, CANCELED, PAID

     seller_fiat_account: {
     account_name: "",
     account_number: "",
     account_code: ""
     },
     transactional_kyc: {
            email: "",
            phone: "",
            first_name: "",
            last_name: ""
        },
     seller_crypto_txn_hash: null,
     partner_callback_url: ""
     signature: string // sha512 signed with public key + secret key
     } 
```

### Event Body Description

<table><thead><tr><th width="171">Keys</th><th width="178">Description</th><th>Values</th></tr></thead><tbody><tr><td>event_name</td><td>This is the name of the event</td><td>event sell init, event sell received fiat, event sell credited crypto.</td></tr><tr><td>partner_order_id</td><td>Id of order generated on partner's system</td><td></td></tr><tr><td>fuspay_order_ref</td><td>Reference number of order generated on Fuspay system</td><td></td></tr><tr><td>fiat_amount_to_receive</td><td>The equivalent fiat amount user would receive based on exchange rate</td><td></td></tr><tr><td>crypto_amount_to_sell</td><td>This is the amount of cryptocurrency to be received</td><td></td></tr><tr><td>exchange_rate</td><td>This is the exchange rate</td><td></td></tr><tr><td>pair</td><td></td><td></td></tr><tr><td>fiat_currency</td><td>This is the amount of fiat currency to be sold</td><td></td></tr><tr><td>pay_to_crypto_address</td><td>This is the crypto address to pay too</td><td></td></tr><tr><td>chain</td><td>e.g. usdt-trc20, usdc-matic</td><td></td></tr><tr><td>fiat_payment_status</td><td>This is the fiat payment status. </td><td>Pending (payment has not been fully processed yet), Cancelled (payment transaction has been stopped) or Paid (payment is fully processed and successful)</td></tr><tr><td>crypto_payment_status</td><td>This is the crypto payment status. </td><td>Pending (payment has not been fully processed yet), Cancelled (payment transaction has been stopped) or Paid (payment is fully processed and successful)</td></tr><tr><td></td><td></td><td></td></tr><tr><td>account_name</td><td>This is the name of the account holder</td><td></td></tr><tr><td>account_number</td><td>This is the bank account number or phone number if MOMO</td><td></td></tr><tr><td>account_code</td><td>This is the bank code or MOMO provider (Mpesa, MTN) . A code that represents the bank where the fiat would be transferred to.</td><td></td></tr><tr><td>bank_name</td><td>The name of the bank</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>email</td><td>Email of the seller</td><td></td></tr><tr><td>phone</td><td>Phone number of the seller</td><td></td></tr><tr><td>first_name</td><td>First name of the seller</td><td></td></tr><tr><td>last_name</td><td>Last name of the seller</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>seller_crypto_txn_hash</td><td>This is the transaction hash given to the seller</td><td>Null (no value)</td></tr><tr><td>partner_callback_url</td><td>The partner Id returned from the onboarding endpoint</td><td></td></tr><tr><td>signature</td><td>This is the seller's signature</td><td>string // sha512 signed with public key + secret key</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
