How to use opennode - 6 common examples

To help you get started, we’ve selected a few opennode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tierion / boltwall / src / routes / parseEnv.ts View on Github external
try {
    testEnvVars()
    let { OPEN_NODE_KEY, LND_TLS_CERT, LND_MACAROON, LND_SOCKET } = getEnvVars()
    // if the tests pass above and we don't have a
    // OPEN_NODE_KEY then we need to setup the lnd service
    if (!OPEN_NODE_KEY) {
      const { lnd } = lnService.authenticatedLndGrpc({
        cert: LND_TLS_CERT,
        macaroon: LND_MACAROON,
        socket: LND_SOCKET,
      })
      req.lnd = lnd
    } else {
      const env = process.env.ENVIRONMENT || 'dev'
      const opennode = require('opennode')
      opennode.setCredentials(OPEN_NODE_KEY, env)
      req.opennode = opennode
    }
    next()
  } catch (e) {
    console.error(
      'Problem with configs for connecting to lightning node:',
      e.message
    )
    next("Could not connect to the paywall's lightning node.")
  }
}
github opennodedev / opennode-node / examples / example.js View on Github external
/**
 * Setup your API Key and environment
 */
opennode.setCredentials('MY_API_KEY', 'dev');


/**
 *
 * Fetch charge information
 */

/**
 * Using promises
 */

opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a')
  .then(charge => {
    console.log(charge);
  })
  .catch(error => {
    console.error(`${error.status} | ${error.message}`);
  })

/**
 *
 * Using async/await
 */

;(async () => {

  try {
    const data = await opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a');
github opennodedev / opennode-node / examples / example.js View on Github external
;(async () => {

  try {
    const data = await opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a');
    console.log(data);
  }
  catch (error) {
    console.error(`${error.status} | ${error.message}`);
  }
})()
github opennodedev / opennode-node / examples / example.js View on Github external
;(async () => {
  try {
    const response = await opennode.createCharge(charge);
    console.log(response);
  }
  catch(error) {
    console.error(`${error.status} | ${error.message}`);
  }
})();
github opennodedev / opennode-node / examples / example.js View on Github external
/**
 * Using promises
 */

const charge = {
  amount: 10.5,
  currency: "USD",
  callback_url: "https://example.com/webhook/opennode",
  auto_settle: false
};

/**
 * Using promises
 */

opennode.createCharge(charge)
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error(`${error.status} | ${error.message}`);
  });

/**
 * Using async/await
 */

;(async () => {
  try {
    const response = await opennode.createCharge(charge);
    console.log(response);
  }
github opennodedev / opennode-node / examples / example.js View on Github external
const opennode = require('opennode');

/**
 * Setup your API Key and environment
 */
opennode.setCredentials('MY_API_KEY', 'dev');


/**
 *
 * Fetch charge information
 */

/**
 * Using promises
 */

opennode.chargeInfo('47bb5224-bf50-49d0-a317-4adfd345221a')
  .then(charge => {
    console.log(charge);
  })
  .catch(error => {

opennode

Node.js library for the OpenNode API.

MIT
Latest version published 11 months ago

Package Health Score

56 / 100
Full package analysis