@kipling/chpter
v0.1.8
Published
chpter.co npm sdk for easy Payments and Payouts Integration.
Downloads
3
Maintainers
Readme
chpter node
Seamlessly accept payments from anywhere in the world.
Install
npm install @kipling/chpter
NOTE
Add the following files to your .env (Ensure it is named as the examples below)
CHPTER_CLIENT_DOMAIN=
CHPTER_TOKEN=
eg.
CHPTER_CLIENT_DOMAIN=chpter.co
CHPTER_TOKEN=chpter_pk_2b4037c1c8
Usage
Payments
Mpesa Payment with STK Push
const chpter = require("@kipling/chpter");
customer = {
"payment_method": "MPesa",
"full_name": "Albert Chela",
"location": "Nairobi",
"phone_number": "254700000000",
"email": "[email protected]" };
products = [{
"product_id": "08",
"product_name": "HoodEez",
"quantity": "1",
"unit_price": "1" }];
amount = {
"delivery_fee": "0",
"discount_fee": "0",
"total" : "1",
"currency" : "kes"};
callback_details = {
"transaction_reference": "123456789123",
"callback_url": "https://eoeqwmbxsqqxo59.m.pipedream.net" };
var response = await chpter.mpesaPayment(customer,products,amount,callback_details);
Card Payment
const chpter = require("@kipling/chpter");
customer = {
"payment_method": "MPesa",
"full_name": "Albert Chela",
"location": "Nairobi",
"phone_number": "254700000000",
"email": "[email protected]" };
products = [{
"product_id": "08",
"product_name": "HoodEez",
"quantity": "1",
"unit_price": "1" }];
amount = {
"card_number": "4242424242424242",
"expiry_month": "08",
"expiry_year": "2030",
"cvc": "123"};
card_details = {
"delivery_fee": "0",
"discount_fee": "0",
"total" : "1",
"currency" : "kes"};
callback_details = {
"transaction_reference": "123456789123",
"callback_url": "https://eoeqwmbxsqqxo59.m.pipedream.net" };
var response = await chpter.cardPayment(customer,products,amount, card_details, callback_details);