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 (P2P)
  3. Plugins
  4. Payment Links (P2P)

Create Payment Link

You need to create a 'pay link' to receive fiat payments through Ninjapay UPI payment gateway. 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://prod.ninjapay.me/uapi/v1/p2p/paymentLink/create

Parameters


Body (application/json)
 {
  amount: int; // Add the amount in inr value
  purpose?: string; // You can add invoice number or payment notes here
  payment_mode?: string; // "upi" and "bank" supported currently. Default is "upi".
  payment_mode_type?: string; // "primary" and "secondary" supported currently. Default is "primary".
  callback_url?: string; // Your webhook url for getting response on successuful payment.
  success_url?: string; // Redirected to this after success from hosted checkout
  order_id?: string; 
  extra?: {} // You can add other extra details like customer name, etc.. here. 
}

Other info

Parameters
Input options

payment_mode

upi, bank

payment_mode_type

primary, secondary

Response

  {
      "link_id": 198660213997,
      "amount": 9362.67,
      "amount_currency": "INR",
      "purpose": "sample_description",
      "payment_mode": "bank"; // "upi" and "bank" supported currently.
      "payment_mode_type": "secondary"; // "primary" and "secondary" supported currently. 
      "created_at": 1661215876,
      "payment_link": "https://bit.ly/3H24Msg", // Hosted checkout url.
      "callback_url": string; // Your webhook url for getting response on successuful payment.
      "success_url": string; // Redirected to this after success from hosted checkout.
      "order_id": string; 
      "extra": {
          "customer_name": "nakamoto",
          "email": "sample@sample.com",
          "total_fee": "0.00 inr (18%)"
      },
      "upi_info": {
          "upi_id": "merchantupi@icici", // null if payment_mode is bank
      },
      "bank_info": {
          "account_number": 001001553534,
          "name": "Nanda Neeraj",
          "ifsc": "icic0000060",
          "bank_name": "icici",
          "address": "vizag, dwarakanagar branch, 530024",
          "swift": "merchantupi@icici"
      },
      "other_info": {
          "paytm": "mypaytmid"
      }
  }

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

Callback Response


{
  "tid": int, // The transaction ID for the successful payment.
  "link_id": int, 
  "utr": string, // The utr number of the transaction added by payer or payment gateway.
  "payer_info": string, // The email or phone added by payer when paying.
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'API_KEY'
  },
  body: '{"amount":0.0018,"purpose":"sample_description","order_id":"21","callback_url":"https://yourwebhook.com"}'
};

fetch('https://prod.ninjapay.me/uapi/v1/p2p/paymentLink/create', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  

You can use Ninjapay's native checkout experience by redirecting your user to the checkout endpoint:

PreviousDashboard StatsNextSubmit UTR for Approval

Last updated 1 year ago

Production - {link_id}

đŸ’ģ
🧩
🔗
https://checkout.ninjapay.me/