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

cardsuite-api

v1.0.0

Published

Cardsuite API Library

Downloads

11

Readme

Cardsuite API

A nodejs library to communicate with the Cardsuite API.

Installation

npm i --save cardsuite-api

Example Usage

const cardsuiteApi = require("cardsuite-api");

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

const cs = new cardsuiteApi(config);
const response = await cs.createPayment({});

Payments

Creating a payment

const response = await cs.createPayments(params);

Parameters

The object parameters for creating a payment are

| key | type | description | required? | |------------------------|---------|---------------------------------------------------------------------------------------------------|-----------| | currency | string | Three character currency code, either BTC, USD, CAD, EUR | yes | | amount | number | Amount of invoice in specified currency in cents | yes | | reference_id | string | Custom reference id associated with the payment | no | | callback_url | string | A callback url to receive notifications when a payment is successful | no | | redirect_url | string | A redirect url to re-direct the user after a successful payment has been made | no | | btc_address | string | A destination BTC address where the BTC purchased will be sent after a successful payment | yes | | notify_only | boolean | A flag if true will only notify of a successful payment but NOT broadcast BTC onto the network | no |

Response

| key | description | |:-----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of payment | | status | Payment status, "open", "cc_failed", "cc_paid", "cc_refunded", "btc_failed", "btc_paid", "complete", "cc_chargeback" | | source_currency | Three character currency code, either BTC, USD, CAD, or EUR | | source_rate | The exchange rate of the source currency to BTC | | amount_btc | The converted amount of BTC in BTC purchased from the payment | | amount_satoshi | The converted amount of BTC in satoshi purchased from the payment | | reference_id | Custom reference id associated with invoice provided on creation | | expired_at | The timestamp when the payment is no longer valid | | quoted_at | The timestamp when the payment and exchange rate was originally quoted | | process_fee_type | The type of process fee for the payment, can be: "percentage", "fixed", "fixed_percentage" | | completed_at | The timestamp when the payment was completed | | callback_url | A callback url to receive notifications when a payment is successful | | redirect_url | A redirect url to re-direct the user after a successful payment has been made | | btc_address | A destination BTC address where the BTC purchased will be sent after a successful payment | | btc_hash | The Bitcoin transaction hash of the transaction where the BTC was sent to the destination address | | process_fee_amount | The total processing fee associated to the payment in base units | | cc_fee_amount | The total credit card processing fee amount related to the payment in base units | | cc_fee_type | The type of credit card fee for the payment, can be: "percentage", "fixed", "fixed_percentage" | | callback_ack | The last payment status of a successful callback awknowledgement made from the callback_url: "open", "cc_failed", "cc_paid", "cc_refunded", "btc_failed", "btc_paid", "complete", "cc_chargeback" | | source_amount | The total amount charged on the credit card for the payment in base units | | tx_fee_satoshi | The total miner fee charged for broadcasting the Bitcoin transcation onto the Bitcoin network in satoshi | | notify_only | A flag if true will only notify of a successful payment but NOT broadcast BTC onto the network | | process_fee_percentage | The processing fee percentage charged in a decimal percentage (IE. 5% = 0.05) | | cc_fee_percentage | The credit card fee percentage charged in decimal percentage |

Reading information from an existing payment

const response = await cs.readPayment(id);

Parameters

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

Response

| key | description | |:-----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of payment | | status | Payment status, "open", "cc_failed", "cc_paid", "cc_refunded", "btc_failed", "btc_paid", "complete", "cc_chargeback" | | source_currency | Three character currency code, either BTC, USD, CAD, or EUR | | source_rate | The exchange rate of the source currency to BTC | | amount_btc | The converted amount of BTC in BTC purchased from the payment | | amount_satoshi | The converted amount of BTC in satoshi purchased from the payment | | reference_id | Custom reference id associated with invoice provided on creation | | expired_at | The timestamp when the payment is no longer valid | | quoted_at | The timestamp when the payment and exchange rate was originally quoted | | process_fee_type | The type of process fee for the payment, can be: "percentage", "fixed", "fixed_percentage" | | completed_at | The timestamp when the payment was completed | | callback_url | A callback url to receive notifications when a payment is successful | | redirect_url | A redirect url to re-direct the user after a successful payment has been made | | btc_address | A destination BTC address where the BTC purchased will be sent after a successful payment | | btc_hash | The Bitcoin transaction hash of the transaction where the BTC was sent to the destination address | | process_fee_amount | The total processing fee associated to the payment in base units | | cc_fee_amount | The total credit card processing fee amount related to the payment in base units | | cc_fee_type | The type of credit card fee for the payment, can be: "percentage", "fixed", "fixed_percentage" | | callback_ack | The last payment status of a successful callback awknowledgement made from the callback_url: "open", "cc_failed", "cc_paid", "cc_refunded", "btc_failed", "btc_paid", "complete", "cc_chargeback" | | source_amount | The total amount charged on the credit card for the payment in base units | | tx_fee_satoshi | The total miner fee charged for broadcasting the Bitcoin transcation onto the Bitcoin network in satoshi | | notify_only | A flag if true will only notify of a successful payment but NOT broadcast BTC onto the network | | process_fee_percentage | The processing fee percentage charged in a decimal percentage (IE. 5% = 0.05) | | cc_fee_percentage | The credit card fee percentage charged in decimal percentage |

Process payment

const response = await cs.processPayment(params);

Parameters

The object parameters for processing a payment are

| key | type | description | required? | |:---------------|:-------|:--------------------------------------------------------|:----------| | payment_id | string | Unique id of payment | yes | | ip_address | string | IP address of the purchaser | yes | | credit_card | string | Credit card number used to make the purchase | yes | | ccv | number | CCV number of the credit card used to make the purchase | yes | | cc_expiry_date | string | Credit card expiry date in MM/YY formart | yes | | address_1 | string | Address line 1 of the credit card purchaser | yes | | address_2 | string | Address line 2 of the credit card purchaser | yes | | city | string | City of the credit card purchaser | yes | | state | string | State of the credit card purchaser | no | | country | string | Country of the credit card purchaser | yes | | zip | string | Zip code of the credit card purchaser | no | | first_name | string | First name of the credit card purchaser | yes | | last_name | string | Last name of the credit card purchaser | no | | phone | string | Phone number of the credit card purchaser | yes | | email | string | Email of the credit card purchaser | no |

Response

| key | description | |:-----------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | Unique id of payment | | status | Payment status, "open", "cc_failed", "cc_paid", "cc_refunded", "btc_failed", "btc_paid", "complete", "cc_chargeback" | | source_amount | The total amount charged on the credit card for the payment in base units | | source_currency | Three character currency code, either BTC, USD, CAD, or EUR | | source_rate | The exchange rate of the source currency to BTC | | amount_btc | The converted amount of BTC in BTC purchased from the payment | | amount_satoshi | The converted amount of BTC in satoshi purchased from the payment | | reference_id | Custom reference id associated with invoice provided on creation | | expired_at | The timestamp when the payment is no longer valid | | quoted_at | The timestamp when the payment and exchange rate was originally quoted | | process_fee_type | The type of process fee for the payment, can be: "percentage", "fixed", "fixed_percentage" | | completed_at | The timestamp when the payment was completed | | callback_url | A callback url to receive notifications when a payment is successful | | redirect_url | A redirect url to re-direct the user after a successful payment has been made | | btc_address | A destination BTC address where the BTC purchased will be sent after a successful payment | | btc_hash | The Bitcoin transaction hash of the transaction where the BTC was sent to the destination address | | process_fee_amount | The total processing fee associated to the payment in base units | | cc_fee_amount | The total credit card processing fee amount related to the payment in base units | | cc_fee_type | The type of credit card fee for the payment, can be: "percentage", "fixed", "fixed_percentage" | | callback_ack | The last payment status of a successful callback awknowledgement made from the callback_url: "open", "cc_failed", "cc_paid", "cc_refunded", "btc_failed", "btc_paid", "complete", "cc_chargeback" | | tx_fee_satoshi | The total miner fee charged for broadcasting the Bitcoin transcation onto the Bitcoin network in satoshi | | notify_only | A flag if true will only notify of a successful payment but NOT broadcast BTC onto the network | | process_fee_percentage | The processing fee percentage charged in a decimal percentage (IE. 5% = 0.05) | | cc_fee_percentage | The credit card fee percentage charged in decimal percentage |

Refunds

Refund payment

const response = await cs.refundPayment(params);

Parameters

The object parameters for refunding a payment are

| key | type | description | required? | |:---------------|:-------|:--------------------------------------------------------|:----------| | payment_id | string | Unique id of payment | yes | | reason | string | Reason for the refund | yes |

Response

| key | description | |:----------------|:---------------------------------------------------------------------------| | payment_id | Unique id of payment | | source_currency | Three character currency code, either BTC, USD, CAD, or EUR | | source_amount | The total amount refunded on the credit card for the payment in base units | | status | Refund status, "open", "complete" | | reason | Reason for the refund |

Chargebacks

Chargeback a payment

const response = await cs.chargebackPayment(params);

Parameters

The object parameters for refunding a payment are

| key | type | description | required? | |:---------------|:-------|:--------------------------------------------------------|:----------| | payment_id | string | Unique id of payment | yes | | reason | string | Reason for the chargebac | yes |

Response

| key | description | |:----------------|:-------------------------------------------------------------------------------| | payment_id | Unique id of payment | | source_currency | Three character currency code, either BTC, USD, CAD, or EUR | | source_amount | The total amount chargebacked on the credit card for the payment in base units | | status | Refund status, "open", "complete" | | reason | Reason for the chargeback |

Payment Tokens

Creating a payment token

const response = await cs.createPaymentToken();

Response

| key | description | |:------------|:------------------------------------------------------------------| | expired | Whether or not the payment token is expired or not: true or false | | expiry_date | Timestamp of when the payment token will be expired | | created_at | Timestamp of when the payment token was created | | id | The payment token to be used in the hosted URL payment page |