@easypayrim/easypay-js
v1.0.0
Published
[![npm version](https://img.shields.io/npm/v/easypay.svg?style=flat-square)](https://www.npmjs.com/package/easypay)
Downloads
3
Readme
easypay
Installation
Using npm
to install the Easypay.js module:
npm install @easypayrim/easypay-js
Using yarn
to install the Easypay.js module:
yarn add @easypayrim/easypay-js
Usage
Init PaymentSDK
This class returns an object that encapsulate all features (create_payment, retriev_prayment, etc..). It takes one parameter api_key
passed in constructor.
import {PaymentSDK} from '@easypayrim/easypay-js';
const easypay = new PaymentSDK('test_RB0HjaoJqMkkFSh2mWhNIvYUhy4EGVcAy5G5mJuX');
We’ve placed a random API key in this example. Replace it with your actual API key to test this code through your Easypay account.
Make a payment
/* return a payment promise */
const payment = easypay.createPayment({
provider:"bankily",
amount: "100",
phone_number: "48110011",
passcode: "2580"
});
/* print payment return */
payment.then(
res => console.log(`Code: ${res.code}, Operation_id: ${res.operation_id}`)
).catch(err => {return err});