# API Endpoints

{% hint style="info" %}
Be sure to pass your api key in the headers with the name <mark style="color:orange;">`x-api-key`</mark> to authorize your request
{% endhint %}

```json
// Some code
x-api-key: YOUR_API_KEY
Content-Type: application/json
```

## Create Order - POST api/payments/createOrder

#### Body

```json
    {
        "userId": "680a495518220e7e4e07114c",
        "amount": 1,
        "token": "USDC",
        "network": "base",
        "memo": "well",
        "returnAddress": "0xe9b34E87386b5fA5E611c947730D88E773d2DBb0"
    }

```

Response

```json
{
    "message": "Payment order  initiated successfully",
    "status": "success",
    "data": {
        "id": "8b0099f2-1307-439c-8fa2-853a588177d7",
        "amount": "1",
        "token": "USDC",
        "network": "base",
        "receiveAddress": "0x66D55c9Dec20328342668C7dc78C5704023F45aC",
        "validUntil": "2025-05-07T01:20:12.961915157Z",
        "senderFee": "0",
        "transactionFee": "0",
        "reference": ""
    }
}
```

### Order Status - GET /api/payments/checkOrderStatus/:id

#### Query Params

```
{
    id: 8b0099f2-1307-439c-8fa2-853a588177d7
}
```

Response

```json
{
    "message": "Order status fetched successfully",
    "status": {
        "id": "8b0099f2-1307-439c-8fa2-853a588177d7",
        "amount": "1",
        "amountPaid": "0",
        "amountReturned": "0",
        "token": "USDC",
        "senderFee": "0",
        "transactionFee": "0",
        "rate": "1600.9",
        "network": "base",
        "gatewayId": "",
        "recipient": {
            "institution": "Kuda Microfinance Bank",
            "accountIdentifier": "2068001238",
            "accountName": "BILIAMIN, AYOMIDE NOAH",
            "memo": "well",
            "providerId": "",
            "currency": "NGN",
            "nonce": ""
        },
        "fromAddress": "",
        "returnAddress": "0xe9b34E87386b5fA5E611c947730D88E773d2DBb0",
        "receiveAddress": "0x66D55c9Dec20328342668C7dc78C5704023F45aC",
        "feeAddress": "0xe9b34E87386b5fA5E611c947730D88E773d2DBb0",
        "reference": "",
        "createdAt": "2025-05-07T00:20:12.974079Z",
        "updatedAt": "2025-05-07T00:20:12.97408Z",
        "txHash": "",
        "status": "initiated",
        "transactionLogs": [
            {
                "id": "214e2f32-7a1d-43bf-89c5-d538c665dfd8",
                "gateway_id": "",
                "status": "order_initiated",
                "tx_hash": "",
                "created_at": "2025-05-07T00:20:12.968991Z"
            }
        ]
    }
}
```
