Skip to content

lodmfjord/kass-ts

Repository files navigation

Kass TS (DEPRECATED) (NOT BEING UPDATED)

Javascript module for KASS payment gateway. Based on Python module KASS Flow.

See the KASS API docs for more info.

This module is not affiliated with KASS.

Installation

$ yarn install kass-ts

or

$ npm install kass-ts

Example

import { KassClient } from 'kass-ts';

const client = new KassClient({token: 'kass_test_auth_token'});

const test = async () => {
    const payment = await client.createPayment({
                        amount: 100,
                        recipient: '1001001',
                    });
    if (payment.success) {
        // TODO: Save our ID?
        const { id } = payment;
        const paymentState = await payment.paymentState;
        if (paymentState === 'payed') {
            console.log('We got payed')
            return;
        }
        console.log('Something went wrong');
    }
}
const test2 = async () => {
    const payment = await client.createPayment({
                        amount: 100,
                        recipient: '1001000',
                    });
    if (payment.success) {
        // NO! We do not need this.
        payment.cancel();
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published