Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

An NPM package for communicating with the Privacy API

Notifications You must be signed in to change notification settings

Loophole-Labs-Archive/privacy-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Privacy API

CircleCI NPM

NPM NPM

Privacy API is an NPM Package for for communicating with the privacy.com API

Installation

Use the package manager npm to install privacy-api.

$ npm install privacy-api

Usage

Responses are returned as standard axios responses

Constructor: privacy(API_KEY, sandbox = true, version = 1)

  • API_KEY: Your developer environment API Key
  • sandbox: Whether you want to use the sandbox API or the production API
  • version: The API version to use (currently only supports version 1)
const privacy = require('privacy-api');
let privacy_api = new privacy(<API-KEY>); // Initialize the privacy object with your API key
let response = await privacy_api.list_cards(); // Async functions

console.log(response.data);

Available Functions

list_cards

let response = await list_cards(page, page_size, begin, end, card_token);

list_transactions

let response = await list_transactions(approval_status, page, page_size, begin, end, card_token, transaction_token);

create_card

let response = await create_card(type, memo, spend_limit, spend_limit_duration);

update_card

let response = await update_card(card_token, state, memo, spend_limit, spend_limit_duration);

simulate_authorization Sandbox Only

let response = await simulate_authorization(descriptor, pan, amount);

simulate_void Sandbox Only

let response = await simulate_void(token, amount);

simulate_clearing Sandbox Only

let response = await simulate_clearing(token, amount);

simulate_return Sandbox Only

let response = await simulate_return(descriptor, pan, amount);

hosted_card_ui

let response = await hosted_card_ui(api_key, card_uuid, css_url);

Returns an HTML string of the form:

<div id="card">
  <div id="pan">{PAN}</div>
  <div id="expiry">
    <span id="month">{expMonth}</span>
    <span id="separator">/</span>
    <span id="year">{expYear}</span>
  </div>
  <div id="cvv">{CVV}</div>
</div>

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

An NPM package for communicating with the Privacy API

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published