Ninjapay API Docs
  • Namaste
    • ℹ️Welcome to Ninjapay!
    • 🏆Benefits of NinjapayAPI
    • 🛠️Fees & Limit
  • How to
    • ❓How Plugins Work
    • 👨‍💻Getting Started
    • 🔐Authentication
    • 💻API Reference (UPI)
      • 🧩Plugins
        • 🔗Realtime Payment Links
          • Create Realtime Payment Link
          • Create Template
          • List Payment Links
          • Multi super order Id list
          • Get templates
          • Single order Id trx list
          • Generate Upi payment link
          • Record payment
          • Expiry List
          • Delete Payment Link
          • Delete Template
          • Check Payment
        • 🛡️Paywalls
          • Create Paywall
          • Create Paywall QR
          • List Paywalls
          • Detail Paywall
          • Check Paywall
          • Remove Paywall
        • 📄Invoice
          • Add Client
          • Edit Client
          • Get Client
          • Remove Client
          • Add Product
          • Edit Product
          • Get Products
          • Remove Product
          • Upload Attachment
          • Add/Edit Template
          • Create Invoice
          • Get Invoice by ID
          • Add Tracking Details
          • Remove Invoice
        • 🖥️Point of Sale - POS
          • Create POS
          • Create Paywall QR
          • List Paywalls
          • Detail Paywall
          • Check Paywall
          • Remove POS
        • 👨‍💻Build Your Own Plugin
          • Ninjapay Plugin Development Guide
      • Error Handling
      • Limits on API Requests
    • 💻API Reference (P2P)
      • 🧩Plugins
        • 🔗Payment Links (P2P)
          • Dashboard Stats
          • Create Payment Link
          • Submit UTR for Approval
          • List Payment Links
          • Transactions
          • Approve/Decline
          • Check Payment
        • 🛡️Paywalls
          • Create Paywall
          • Create Paywall QR
          • List Paywalls
          • Detail Paywall
          • Check Paywall
          • Remove Paywall
        • 👨‍💻Build Your Own Plugin
          • Ninjapay Plugin Development Guide
      • Error Handling
      • Limits on API Requests
    • 💻API Reference (BTC⚡️)
      • Wallet Info
      • Send Payment
      • Request Payment
      • NinjaAuth
      • Ninjapay URI Intent
      • Check Payment
      • Transactions
      • Get Prices
      • Decode Invoice
      • Error Handling
      • Limits on API Requests
      • 🎁Withdraw Vouchers
        • Request Voucher
        • Check Voucher
        • Revoke Voucher Request
        • Redeem Voucher
      • 📈Spot Trade
        • Asset Balances
        • Asset Prices
        • Buy/Sell
        • Check Order
        • Revoke Order Request
  • other
    • 🤝Partnerships
    • 📓Helpful references
  • Use Cases
    • Game Developers
      • Implementing BTC Points
  • Coming Soon
    • 💻API Reference (Pro)
      • Wallet Info
      • Send Payment
      • Request Payment
      • NinjaAuth
      • Ninjapay URI Intent
      • Check Payment
      • Transactions
      • Get Prices
      • Decode Invoice
      • Error Handling
      • Limits on API Requests
    • 🧩Widget Integration
      • Widget (Onramp)
      • Widget (Offramp)
      • Request Token
      • Check Token
  • Fiat x Web3 Bridge
    • ℹ️Intro to NinjaUPI
    • 👩‍💻Get Started
      • Request Quote ID (BTC<>INR)
      • Request Quote ID (USDT<>INR)
      • Request Invoice for Quote
      • Check Payment
    • 🦸Upgrades
  • Protocols
    • Commerce Onchain Protocol
Powered by GitBook
On this page
  1. How to
  2. API Reference (BTC⚡️)
  3. Withdraw Vouchers

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).

PreviousRequest VoucherNextRevoke Voucher Request

Last updated 1 year ago

💻
🎁