npm.io
1.0.1 • Published yesterday

tresorpay

Licence
ISC
Version
1.0.1
Deps
4
Size
226 kB
Vulns
25
Weekly
0

TresorPay NodeJS Library

The TresorPay Node library provides convenient access to the TresorPay API from applications written in server-side JavaScript.

Installation

Install the package with:

npm install tresorpay --save

Usage

The package needs to be configured with your account's secret key. Set it with:

import { TresorPay, Customer } from 'tresorpay';

TresorPay.setApiKey('sk_sandbox_xxx');

let customers = await Customer.all();

Environments

By default the library targets the sandbox environment. Switch environment with:

TresorPay.setEnvironment('production'); // https://prod.tresorpay.bj
// or
TresorPay.setEnvironment('sandbox'); // https://sandbox.tresorpay.bj (default)

Documentation

See docs/API.md for the full API reference: all resources (Customer, Transaction, Account, ApiKey, Currency, Event, Log, PhoneNumber, Webhook), error handling, custom HTTP client/interceptors, and testing tips.

Keywords