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

Request Voucher

Create a withdraw voucher request to be redeemed by anyone. Money will be deducted from your lightning wallet.

Method


POST https://api.ninjapay.me/lapi/v1/requestVoucher

Parameters

Body (application/json)
{
  amount: number, // The amount in BTC(not SAT) per voucher
  voucher_count: number; // Number of vouhers required (1min - 100max)
  from?: string; // Optional From title for voucher giveaway
  title?: string; // Title/message of the voucher 
  expiry?: number; // Optional voucher expiry in mins
  receiver_email?: string, // Add this email ID if you want to send the voucher to an email. Note: voucher_count has to be one for email trigger!
  unique_design?: bool, // Add "true" if you want to use your own custom design for voucher.
  unique_design_url?: string, // Custom voucher design url in 640x360px(16:9) in size.
  callback_url?: string, // Add this if you want a success response upon 
}

Response

{
  "status": true,
    "data": {
        "tid": "19M86602AN139N97", 
        "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": null, // Note: voucher_count has to be one for email trigger!
        "email_status": "undefined", // "success", "pending", "undefined" status's
        "unique_design": true,
        "unique_design_url": "https://www.mycompanydesignin600x900pixel.com",
        "callback_url": "https://yourwebhook.com",
        "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_url": "https://www.ninjapay.me/voucher/redeem/39e11981h",
               },
          ]
      },
     "message": "", 
}

Note: By default for static voucher url's, a ninjapay user(@username) can redeem only once. This will avoid ass-milking.

Webhook Response


{
  "tid":"1986B6021A3N997",
  "voucher_url": "https://www.ninjapay.me/voucher/redeem/7ee15185",
  "redeemed_by": "ninjatagUsername", // @ninjatag(ninjapay username) or invoice(lnbc..ndjj)
  "redeemed_tid": 128660213994,
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY' //Admin key required
  },
  body: '{"amount":0.00180204,"voucher_count":1,"title":"Happy Birthday🥳"}'
};

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

Last updated 1 year ago

💻
🎁