stancer-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

Stancer Node.js Library

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

This package isn't an official package but a community made.


Documentation

Installation

To install the latest version on npm locally and save it in your package's package.json file:

npm install stancer-api --save

To install the latest development version locally, without updating your project's package.json file:

npm install git+https://github.com/Arkmind/stancer-api.git


Usage

Simple usage

import { Client } from "stancer-api";

const client = new Client({
    stest: process.env.SECRET_TEST_STANCER_API_KEY,
    sprod: process.env.SECRET_PROD_STANCER_API_KEY,
});

client.customer.get('cust_id');

Using your own fetch

import { Client } from "stancer-api";
import fetch from "node-fetch@2";

const client = new Client(
    {
        stest: process.env.SECRET_TEST_STANCER_API_KEY,
        sprod: process.env.SECRET_PROD_STANCER_API_KEY,
    }, 
    { 
        environment: process.env.NODE_ENV, // 'test' | 'prod'
        fetch 
    },
);

API Reference

Payments

The export Client as a property named payment that is an instance of Payment, containing methods to manipulate payments.

Get payment data Client.payment.get(id: string)

Create a payment Client.payment.create(data: PaymentCreate)
PaymentCreate

Update a payment Client.payment.update(id: string, data: PaymentUpdate)
PaymentUpdate

List all payment Client.payment.list(data: PaymentList)
PaymentList

Credit Card

The export Client as a property named creditCard that is an instance of CreditCard, containing methods to manipulate credit cards.

Get credit card data Client.creditCard.get(id: string)

Create a credit card Client.creditCard.create(data: CreditCardCreate)
CreditCardCreate

Update a credit card Client.creditCard.update(id: string, data: CreditCardUpdate)
CreditCardUpdate

Delete a credit card Client.creditCard.delete(data: CreditCardDelete)
CreditCardDelete

SEPA

The export Client as a property named sepa that is an instance of Sepa, containing methods to manipulate SEPAs.

Get SEPA data Client.sepa.get(id: string)

Create a SEPA Client.sepa.create(data: SepaCreate)
SepaCreate

Update a SEPA Client.sepa.update(id: string, data: SepaUpdate)
SepaUpdate

Delete a SEPA Client.sepa.delete(data: SepaDelete)
SepaDelete

Customers

The export Client as a property named customer that is an instance of Customer, containing methods to manipulate Customers.

Get Customer data Client.customer.get(id: string)

Create a Customer Client.customer.create(data: CustomerCreate)
CustomerCreate

Update a Customer Client.customer.update(id: string, data: CustomerUpdate)
CustomerUpdate

Delete a Customer Client.customer.delete(data: CustomerDelete)
CustomerDelete

Refunds

The export Client as a property named refund that is an instance of Refund, containing methods to manipulate Refunds.

Get Refund data Client.refund.get(id: string)

Create a Refund Client.refund.create(data: CustomerCreate)
RefundCreate

Disputes

The export Client as a property named dispute that is an instance of Dispute, containing methods to manipulate Disputes.

Get Dispute data Client.dispute.get(id: string)

List all Dispute Client.dispute.delete(data: DisputeList)
DisputeList

Payouts

The export Client as a property named payout that is an instance of Payout, containing methods to manipulate Payouts.

Get a Payout detail Client.payout.get(id: string, type: PayoutTypes, data?: PayoutList) PayoutTypes, PayoutList

List all Payouts Client.payout.list(data: PayoutList)
PayoutList


Contribute

Requirements :

  • Node.JS > 18.0.0

Clone the Git repository and start building good stuff.

$ git clone git@github.com:Arkmind/stancer-api.git
$ cd stancer-api
$ npm install

When done build everything with npm run build and create a pull request respecting git convention.


Credits


License

MIT

Package Sidebar

Install

npm i stancer-api

Weekly Downloads

1

Version

1.0.10

License

MIT

Unpacked Size

106 kB

Total Files

51

Last publish

Collaborators

  • xonlly
  • dashh
  • baldurzz
  • arkmind_