npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rapidcoin-api

v1.0.2

Published

RapidCoin API Library

Downloads

22

Readme

RapidCoin API

A nodejs library to communicate with the RapidCoin API.

Installation

npm i --save rapidcoin-api

Example Usage

const rapidCoinApi = require("rapidcoin-api");

const config = {
  url: "https://www.rapidcoin.com/api",
  apiKey: "my-api-key",
  apiVersion: "1.0"
};

const rc = new rapidCoinApi(config);
const response = await rc.createInvoice({});

Invoices

Creating an invoice

const response = await rc.createInvoice(params);

Parameters

The object parameters for creating an invoice are

| key | type | description | required? | |------------------------|---------|---------------------------------------------------------------------------------------------------|-----------| | reference_id | string | Custom reference id associated with invoice | no | | customer_id | string | Custom customer id associated with invoice | no | | description | string | Custom description associated with invoice | no | | confirmations_required | integer | Number of blockchains required to complete invoice transaction & trigger confirmation_url IPN | no | | notification_url | string | Notification URL to POST when transaction is received on address | no | | confirmation_url | string | Notification URL to POST when blockchain confirmations reaches confirmations_required | no | | redirect_url | string | URL to redirect to after successful payment (web flow) | no | | currency | string | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | no | | amount | number | Amount of invoice in specified currency | no |

Note: currency and amount are optional, if they are not specified the invoice will be created an "open" invoice

Response

| key | description | |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of invoice | | status | Invoice status, "open", pending", "confirming", "complete", "expired" | | token | Unique token of invoice | | invoice_time | UNIX timestamp when invoice was created | | expiration_time | UNIX timestamp of when invoice address is expired of invoice | | exception_status | Exception status of invoice | | currency | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | | rate | Rate used to convert amount in currency to amount_btc in BTC | | amount | Amount of invoice in specified currency (0 for open invoices) | | amount_btc | Amount of invoice in BTC, calculated from currency, amount, and rate (0 for open invoices) | | paid_currency | Three character currency code, either USD or BTC. Used to show what currency customer will be paid out in | | paid_rate | Rate used to convert amount in BTC to paid amount in paid_currency | | paid_amount | Amount paid out to customer in paid_currency | | paid_amount_btc | Amount paid out to customer in BTC | | redirect_url | URL to redirect to after successful payment | | notification_url | Notification URL to POST when transaction is received on address | | confirmation_url | Notification URL to POST when blockchain confirmations reaches required_confirmations | | confirmations_required | Number of blockchain confirmations required to complete invoice and trigger POST to confirmation_notification_url | | reference_id | Custom reference id associated with invoice provided on creation | | customer_id | Custom customer id associated with invoice provided on creation | | description | Custom description associated with invoice provided on creation (if second deposit on address - description becomes SUB_INVOICE) | | parent_invoice_id | Unique Id of parent invoice (if second deposit made on the same address - will reference the first invoice created. null if first invoice) | | address | Bitcoin deposit address of invoice | | paid_btc | Amount paid by customer in BTC. | | transactions | array of blockchain transactions of payments to invoice invoice eg. "transactions": [ {"hash":"f7b0989105b03d69e1ef913b3f7a12df3886d334d0d8706ff77ea78e6602493f", "amount": 0, "confirmations" : 6, "time": 0, "received_time": 0}] | | current_time | Current timestamp of request |

Reading information from an existing invoice

const response = await rc.readInvoice(id);

Parameters

The id passed in is the uuid of an existing invoice.

Response

| key | description | |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of invoice | | status | Invoice status, "open", pending", "confirming", "complete", "expired" | | token | Unique token of invoice | | invoice_time | UNIX timestamp when invoice was created | | expiration_time | UNIX timestamp of when invoice address is expired of invoice | | exception_status | Exception status of invoice | | currency | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | | rate | Rate used to convert amount in currency to amount_btc in BTC | | amount | Amount of invoice in specified currency (0 for open invoices) | | amount_btc | Amount of invoice in BTC, calculated from currency, amount, and rate (0 for open invoices) | | paid_currency | Three character currency code, either USD or BTC. Used to show what currency customer will be paid out in | | paid_rate | Rate used to convert amount in BTC to paid amount in paid_currency | | paid_amount | Amount paid out to customer in paid_currency | | paid_amount_btc | Amount paid out to customer in BTC | | redirect_url | URL to redirect to after successful payment | | notification_url | Notification URL to POST when transaction is received on address | | confirmation_url | Notification URL to POST when blockchain confirmations reaches required_confirmations | | confirmations_required | Number of blockchain confirmations required to complete invoice and trigger POST to confirmation_notification_url | | reference_id | Custom reference id associated with invoice provided on creation | | customer_id | Custom customer id associated with invoice provided on creation | | description | Custom description associated with invoice provided on creation (if second deposit on address - description becomes SUB_INVOICE) | | parent_invoice_id | Unique Id of parent invoice (if second deposit made on the same address - will reference the first invoice created. null if first invoice) | | address | Bitcoin deposit address of invoice | | paid_btc | Amount paid by customer in BTC. | | transactions | array of blockchain transactions of payments to invoice invoice eg. "transactions": [ {"hash":"f7b0989105b03d69e1ef913b3f7a12df3886d334d0d8706ff77ea78e6602493f", "amount": 0, "confirmations" : 6, "time": 0, "received_time": 0}] | | current_time | Current timestamp of request |

Updating an invoice

const response = await rc.updateInvoice(id, params);

Parameters

The id passed in is the uuid of an existing invoice.

The object parameters for updating an invoice are

| key | type | description | required? | |--------------|--------|---------------------------------------------|-----------| | reference_id | string | Custom reference id associated with invoice | no | | customer_id | string | Custom customer id associated with invoice | no | | description | string | Custom description associated with invoice | no |

Response

| key | description | |------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of invoice | | status | Invoice status, "open", pending", "confirming", "complete", "expired" | | token | Unique token of invoice | | invoice_time | UNIX timestamp when invoice was created | | expiration_time | UNIX timestamp of when invoice address is expired of invoice | | exception_status | Exception status of invoice | | currency | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | | rate | Rate used to convert amount in currency to amount_btc in BTC | | amount | Amount of invoice in specified currency (0 for open invoices) | | amount_btc | Amount of invoice in BTC, calculated from currency, amount, and rate (0 for open invoices) | | paid_currency | Three character currency code, either USD or BTC. Used to show what currency customer will be paid out in | | paid_rate | Rate used to convert amount in BTC to paid amount in paid_currency | | paid_amount | Amount paid out to customer in paid_currency | | paid_amount_btc | Amount paid out to customer in BTC | | redirect_url | URL to redirect to after successful payment | | notification_url | Notification URL to POST when transaction is received on address | | confirmation_url | Notification URL to POST when blockchain confirmations reaches required_confirmations | | confirmations_required | Number of blockchain confirmations required to complete invoice and trigger POST to confirmation_notification_url | | reference_id | Custom reference id associated with invoice provided on creation | | customer_id | Custom customer id associated with invoice provided on creation | | description | Custom description associated with invoice provided on creation (if second deposit on address - description becomes SUB_INVOICE) | | parent_invoice_id | Unique Id of parent invoice (if second deposit made on the same address - will reference the first invoice created. null if first invoice) | | address | Bitcoin deposit address of invoice | | paid_btc | Amount paid by customer in BTC. | | transactions | array of blockchain transactions of payments to invoice invoice eg. "transactions": [{"hash":"f7b0989105b03d69e1ef913b3f7a12df3886d334d0d8706ff77ea78e6602493f", "amount": 0, "confirmations" : 6, "time": 0, "received_time": 0}] | | current_time | Current timestamp of request |

Payouts

Creating a payout

const response = await rc.createPayout(params);

Parameters

The object parameters for creating an invoice are

| key | type | description | required? | |--------------|--------|---------------------------------------------------------------------------------------------------|-----------| | currency | string | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | yes | | amount | number | Amount of payout to send in specified currency | yes | | address | string | Bitcoin address to send payout too | yes | | reference_id | string | Custom reference id associated with payout | no | | customer_id | string | Custom customer id associated with payout | no | | description | string | Custom description associated with payout | no |

Response

| key | description | |--------------|---------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of payout | | status | Payout status, "pending", "complete", "exception" | | address | Bitcoin address of payout | | currency | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | | amount | Amount of payout to send in specified currency | | amount_btc | Amount of payout to send in BTC, calculated from currency, amount, and rate | | rate | Rate used to convert amount in currency to amount_btc in BTC | | reference_id | Custom reference id associated with payout provided on creation | | customer_id | Custom customer id associated with payout provided on creation | | description | Custom description associated with payout provided on creation | | created_at | Datetime payout transaction was created | | completed_at | Datetime payout transaction was completed | | transaction | Details of blockchain transaction of payout eg. "transaction": {"hash":"f7b0989105b03d69e1ef913b3f7a12df3886d334d0d8706ff77ea78e6602493f"} |

Reading information from an existing payout

const response = await rc.readPayout(id);

Parameters

The id passed in is the uuid of an existing invoice.

Response

| key | description | |--------------|---------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of payout | | status | Payout status, "pending", "complete", "exception" | | address | Bitcoin address of payout | | currency | Three character currency code, either USD or BTC. Used with amount to calculate rate & amount_btc | | amount | Amount of payout to send in specified currency | | amount_btc | Amount of payout to send in BTC, calculated from currency, amount, and rate | | rate | Rate used to convert amount in currency to amount_btc in BTC | | reference_id | Custom reference id associated with payout provided on creation | | customer_id | Custom customer id associated with payout provided on creation | | description | Custom description associated with payout provided on creation | | created_at | Datetime payout transaction was created | | completed_at | Datetime payout transaction was completed | | transaction | Details of blockchain transaction of payout eg. "transaction": {"hash":"f7b0989105b03d69e1ef913b3f7a12df3886d334d0d8706ff77ea78e6602493f"} |

Other

Finding the currency exchange rate

const response = await rc.getRate(currency);

Parameters

The currency to look up for the exchange rate (currently only BTC or USD).

Response

| key | description | |----------|------------------------| | currency | the currency | | rate | currency exchange rate |

Getting the available balance

const response = await rc.getOrganizationBalance();

Response

| key | description | |-----|---------------------------------------------------| | btc | the BTC balance | | usd | the amount in USD using the current exchange rate |