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.
$ yarn install kass-ts
or
$ npm install kass-ts
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();
}
}