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. Coming Soon
  2. API Reference (Pro)

Decode Invoice

PreviousGet PricesNextError Handling

Last updated 1 year ago

This API is used for further decyphering the details of a lightning invoice. The idea is to use this API endpoint if you have to validate any of the specific properties of any .

Method


GET https://prod.ninjapay.me/sapi/v1/decode

Parameters

payreq: string // Pass the invoice address which starts with "lnbc..."

Response

  {
    "amount": "0.00021350", // amount in BTC, not SAT
    "payreq": "lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2",
    "expires_at": "2023-03-15T11:22:27.000Z",
    "network": "lightning",
    "description": "Paying for Master Sword #5546",
    "descriptionHash": "c9978e102a33c8d4ba69b8f14c38c7e88d9ccd48f5cc3516baae44c9c6da7292",
    "paymentHash": "56951aaff209a9ea683d524925086ddcd4b988a3bca95b6d50f358f0f43162ec",
    "paymentSecret": "30b3fba9d15b9752418ceab88e2adfe0f63ffa763deba32af85dd25c33395564",
    "payee": "036ff83834666d3ebfe61c2a7d1f8fc5d6b339a26559a61819e2b0d1b5f540fdfc",
    "signature": "d76655c92b91372cdbf91cb6e3e195c60306354c170469d38159611f5e6e50de27ce9869f0001e40a67707bd7c42e929ba929be2b19ea5ad26dd4ab78261cf58"
  }

Example


const options = {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'API_KEY'
  },
  body: '{"payreq":"lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2"}'
};

fetch('https://prod.ninjapay.me/sapi/v1/decode', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  
đŸ’ģ
Payment Request