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
  • Request body
  • Payment Success Response
  1. How to
  2. API Reference (UPI)
  3. Plugins
  4. Realtime Payment Links

Create Realtime Payment Link

You need to create a 'pay link' to receive fiat payments through Ninjapay payment plugin. A pay link contains Payment info added in the dashboard by the merchant(you), capable of accepting payments through the UPI protocol or bank transfers from customers.

Method


POST https://api.ninjapay.me/webextension/api/v1/fiat/realtime-payment-link/link

Parameters

  • type : String - Type of link we are generating (1 for payment link, 2 for subscription) (required)

  • title: String - Title of the payment link(required)

  • amount: Number - Amount to be paid (required)

  • allow_partial_payment : Boolean - User can make partial payment to your link

  • single_use : Boolean - Payment is single use or not

  • currency: String - Currency of your amount

  • redirect_url: String - what url will be redirecting after payment success

  • cust_email: String - Pass email of customer

  • cust_full_name: String - Pass name of customer

  • ask_during_payment: string - Link will ask customer details, if you dont pass here

  • only_phone: String - Ask only phone number.

  • phone_code: String - Phone number code of custmer.

  • only_email: String - Phone number of customer without phone code.

  • cust_phone: String - Phone number of customer without phone code

  • only_phone: String - Link will only ask customer's email

  • is_sms: Boolean - You will get SMS alert after payment

  • is_whatsapp: Boolean - You will get message on whatsapp regarding payment

  • is_invoice_generate: Boolean : Invoice generation will be given after payment or not

  • enable_upi_qr: Boolean - Upi link will be coming in response

  • include_order_id_in_redirect: Boolean - order id will be added in redirect url, mus pass redirect url

  • cust_reference_id: String - Id you can pass your custom reference id

  • include_cust_ref_in_payment_link: Boolean -Include customer reference in the payment link

  • cust_thanks_msg: String - Message shown to customer after payment

  • custom_logo_url: String - Your personalise logo

  • custom_pay_text: String :- Text shown to customer during payment

  • tnc: String - Terms and conditions

  • reference_notes: String - Reference note

  • expiry_id: String - Pass Id according to expire time setting

  • webhook : String- Webhook url on which you want to send payment link updates

  • reference_order_id: String- User side order id to attach to orders.

  • allow_tips: Boolean- Tips field show to customer or not.

Other info

  • If no expiry_id is passed then link will be having no expiry date

  • if include_order_id_in_redirect is passed to true then you need to pass redirection url also

  • If cust_phone is passed, you also need to pass phone_code(country phone number codes) .

  • We can only pass max 1 lakh amount If allow_partial_payment is false

Request body


Body (application/json)
{
    "type": "1",
    "template_id": "null",
    "title": "title of paymeny link",
    "currency": "INR",
    "amount": 1,
    "allow_partial_payment": false,
    "single_use": false,
    "cust_phone": "8302280166",
    "cust_email": "example.com",
    "cust_full_name": "dummy name",
    "ask_during_payment": false,
    "only_phone": false,
    "phone_code": "+91",
    "only_email": false,
    "link_expiry": null,
    "is_sms": false,
    "is_whatsapp": false,
    "is_invoice_generate": false,
    "enable_upi_qr": false,
    "include_order_id_in_redirect": false,
    "cust_reference_id": "",
    "include_cust_ref_in_payment_link": false,
    "redirect_url": "",
    "cust_thanks_msg": "",
    "custom_logo_url": "",
    "custom_pay_text": "",
    "tnc": "",
    "reference_notes": "",
    "expiry_id": null,
    "allow_tips":false,
    "webhook":"",
    "reference_order_id":""    
}

Other info

Parameters
Input options

type

Type of the payment link-

1 -> payment link 2 -> Subscription link

Response


{
    "status": true,
    "data": {
        "link_id": "RTLSpvmCCWL5YbgoQIy1uKO", // id of this payment link
        "super_order_id": "FT_RTPL_SOeK5pKhG51kOcMYaNNGTL", 
        "qr_base64": "", // base 64 image of qr if qr customise is been done
        "pay_link": "", // upi link for direct payment
        "expiry_date": "2024-08-06 08:52:11", // expiry of invoice
        "order_id": "FT_RTPL_SOTbKI1uC7uYfGMvDvOAw9" // 
    },
    "message": "Payment link created successful"
}

Payment Success Response

Upon successful payment, the Ninjapay platform sends the fiat amount to the provided UPI ID and gives a success response to the webhook.

Callback Response

{
    "STATUS":"",  // 
    "ORDER_ID":"",
    "CURRENCY":"",
    "RESP_MSG":"",
    "PAYMENT_MODE":"",
    "TXN_ID":"",
    "AMOUNT":"",
    "CUS_REF_ID":"",
    "TXN_DATE":"",
    "CHECKSUMHASH":"",
    "REFERENCE_ORDER_ID":""
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY'
  },
  body: '{"amount":10,"title":"sample_description","reference_order_id":"myperosnalid","webhook":"https://yourwebhook.com" }'
};

fetch('https://api.ninjapay.me/webextension/api/v1/fiat/realtime-payment-link/link', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  

PreviousRealtime Payment LinksNextCreate Template

Last updated 8 months ago

💻
🧩
🔗