1.0.0-a • Published 6 years ago

project-payment-service v1.0.0-a

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

Payment service

Service to ease work whith payment systems such as LiqudPay, PayPal

Installation

$ npm i project-payment-service

How to use?

const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');

const {LiqPay, PayPal} = require('./src/main');
const app = express();

app.use(express.static(path.resolve(__dirname, './public')));
app.get('/', (request, response) => {
    response.sendFile(path.resolve(__dirname, './public', 'index.html'));
});

app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());

/*
* from front-end call post:
* /paypal for payPal with json {total, currency, description}
* /liquidpay for liquidPay with json {amount, currency, description, order_id}
* */
// if not add second parameter it will be in sandbox mode
const liqPay = new LiqPay(app, 'prod');
const payPay = new PayPal(app);


app.listen(3000, () => {
    console.log(`listening on port 3000`);
});