Check Voucher

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

Method


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

Parameters

tid: string // the transaction ID of the voucher request.

Response

{
   "status": true,
     "data":{
      "tid": "19B86602A1399N7",
      "created_at": 1414912921, 
      "expires_at": 1714912921, 
      "voucher_count": 2,
      "voucher_redeemed": 1, 
      "amount": 0.00001000, // amount/voucher in BTC
      "from": "Swiggy",
      "title": "Congrats IPL Spinwheel winner",
      "receiver_email": "dev@ninjapay.me", 
      "email_status": "success", // "success", "pending", "undefined" status's
      "unique_design": true,
      "unique_design_url": "https://www.mycompanydesignin600x900pixel.com",
      "callback_url": "https://yourwebhook.com",
      "revoked": false, 
      "revoked_at": null,
      "voucher_static_url": "https://www.ninjapay.me/voucher/198660213997", // This single multi use url can be used to redeem all vouchers.
      "voucher_urls": [
          {
              "voucher_url": "https://www.ninjapay.me/voucher/redeem/7ee15185",
              "voucher_code": "7ee15185",
              "redeemed_by": "ninjatagUsername", // @ninjatag or invoice(lnbc..ndjj)
              "redeemed_tid": 128660213994,
              "redeemed_at": 2014912928,
              "callback_status": 201 // 200, 201, 400, ... only triggers after successful redeem of voucher.
          },
           {
              "voucher_url": "https://www.ninjapay.me/voucher/redeem/39e11981h",
              "voucher_code": "39e11981h",
              "redeemed_by": null, //
              "redeemed_tid": null,
              "redeemed_at": null,
              "callback_status": null // 200, 201, 400, ... only triggers after successful redeem of voucher.
              
         }
       ]
    },
    "message":""
}

Code Example


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

fetch('https://api.ninjapay.me/lapi/v1/checkVoucher', 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).

Last updated