Request Token

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

Method


POST https://prod.ninjapay.me/lapi/v1/requestToken

Parameters

Body (application/json)
{
  widget_mode: string, // Add "onramp" for receiving or "offramp" for withdrawing.
  amount: number, // The amount in BTC(not SAT)
  order_id?: string; // Optional From title for voucher giveaway
  callback_url?: string, // Add this if you want a success response upon 
}

Other info

Parameters
Input options

widget_mode

onramp , offramp

Response


{
  "token": 198660213997
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'API_KEY' //Admin key required
  },
  body: '{"amount":0.00180204,"voucher_count":1,"title":"Happy BirthdayπŸ₯³"}'
};

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

Last updated