# Check Payment

Check the status of a particular payment using the transaction ID.

#### **Method**

```

GET https://api.ninjapay.me/lapi/v1/checkPayment

```

#### **Parameters**

**`tid: string`** // the transaction ID of the payment request.

#### **Response (send)**

```jsx
 {  
  "status": true,
    "data": {
      "tid": "210A660BI27N7897",
      "payment_mode": "lightning",
      "wallet": "lbtc",
      "amount": "-0.19362077",
      "receiver_ninjatag": null,
      "description": "sample_description",
      "created_at": 1661215876,
      "status": "paid", // undefined, pending, declined, paid status's by ninjapay
      "callback_url": null,
      "callback_status": null, // 200, 400, ... only triggers after payment
      "success_url": null,
      "hosted_checkout_url": null,
      "hosted_checkout_expiry": null,
      "customer_name": "Satoshi Nakamoto";
      "order_id": "21",
      "fiat_currency": "USD",
      "fiat_value": "4000.22",
      "extra": {
          "name": "nakamoto",
          "email": "sample@sample.com"
      },
      "uri": null,
      "ttl": 10,
      "lightning_invoice": {
          "lightning_invoice_type": "lnurl",
          "expires_at": null,
          "payreq": "lnurl193620n1p3sgfyrpp5vsy5xumnky24rvt3aty94d4srrwy2rhp94yqzwu6er5x9eymh2zsdqawdsk6urvv40kgetnvdexjur5d9hkucqzpgxqzjhsp5uvmlp5xkteze6qmty35kuxe3j8cwzk25zsx7t9z84423peps9h9s9qyyssqp2ydxchkqceyzz4ma68kmjm58pr0pnx3anl48ajqlhfcgzqrpa0j7kxzjygdxujptkqjrkk6gxsag87yx9wcd7ugyauq45skvcg9aygqx5geqv"
      },
       "total_fee": {
          "network_fee": "0.00008161 btc",
          "service_fee": "0.00000002 btc (0.1%)",
          "gst_fee": null
      }
  },
  "message": ""
}
```

#### Response (receive)

<pre class="language-jsx"><code class="lang-jsx">  {
   "status": true,
<strong>   "data": {
</strong>      "tid": "198660213997",
      "payment_mode": "lightning",
      "wallet": "lbtc",
      "amount": "1.10771927",
      "receiver_ninjatag": null,
      "description": "sample_description",
      "created_at": 1661215876,
      "status": "undefined", // undefined, pending, declined, paid status's by ninjapay
      "callback_url": "https://yourwebhook.com",
      "callback_status": 201, // 200, 201, 400, ... only triggers after payment
      "success_url": "https://yoursuccessurl.com",
      "hosted_checkout_url": "https://checkout.ninjapay.me/198660213997",
      "hosted_checkout_expiry": 1814912992,
      "customer_name": null;
      "order_id": "210",
      "fiat_currency": "USD",
      "fiat_value": "2000.22",
      "extra": {
          "name": "nakamoto",
          "email": "sample@sample.com"
      },
      "uri": "lightning:lnbc193620n1p3sgfyrpp5vsy5xumnky24rvt3aty94d4srrwy2rhp94yqzwu6er5x9eymh2zsdqawdsk6urvv40kgetnvdexjur5d9hkucqzpgxqzjhsp5uvmlp5xkteze6qmty35kuxe3j8cwzk25zsx7t9z84423peps9h9s9qyyssqp2ydxchkqceyzz4ma68kmjm58pr0pnx3anl48ajqlhfcgzqrpa0j7kxzjygdxujptkqjrkk6gxsag87yx9wcd7ugyauq45skvcg9aygqx5geqv",
      "ttl": 10,
      "lightning_invoice": {
          "lightning_invoice_type": "invoice",
          "expires_at": 1714912921,
          "payreq": "lnbc193620n1p3sgfyrpp5vsy5xumnky24rvt3aty94d4srrwy2rhp94yqzwu6er5x9eymh2zsdqawdsk6urvv40kgetnvdexjur5d9hkucqzpgxqzjhsp5uvmlp5xkteze6qmty35kuxe3j8cwzk25zsx7t9z84423peps9h9s9qyyssqp2ydxchkqceyzz4ma68kmjm58pr0pnx3anl48ajqlhfcgzqrpa0j7kxzjygdxujptkqjrkk6gxsag87yx9wcd7ugyauq45skvcg9aygqx5geqv"
      },
       "total_fee": {
          "network_fee": null,
          "service_fee": null,
          "gst_fee": null
      }
  },
  "message": ""
}
</code></pre>

#### **Code Example**

```jsx

const options = {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY'
  },
  body: '{"tid": "21066027789"}'
};

fetch('https://api.ninjapay.me/lapi/v1/checkPayment', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  
```

If the payment status is Pending, then Check Status API should be called in the following interval: \
The first status check at 20-25 seconds post transaction start, then \
Every 3 seconds once for the next 30 seconds, \
Every 6 seconds once for the next 60 seconds, \
Every 10 seconds for the next 60 seconds, \
Every 30 seconds for the next 60 seconds, and then \
Every 1 min until timeout (10 mins).
