-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.js
More file actions
34 lines (28 loc) · 1.17 KB
/
example.js
File metadata and controls
34 lines (28 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const express = require('express');
const { SQLiteDB } = require('multi-db-orm');
const { createPaymentMiddleware } = require('./dist');
try { require('dotenv').config(); } catch (e) { }
const app = express();
// Local SQLite sample DB via multi-db-orm; swap for your own adapter
const db = new SQLiteDB('test.db');
const payment = createPaymentMiddleware(app,{
host_url: process.env.NP_HOST_URL || 'http://localhost:5543',
path_prefix: process.env.NP_PATH_PREFIX || '_pay',
homepage: '/',
payu_url: 'https://secure.payu.in', // use https://test.payu.in for sandbox
MID: process.env.NP_MID || '12345',
WEBSITE: process.env.NP_WEBSITE || 'WEBSTAGING',
KEY: process.env.NP_KEY || 'abcdef',
SECRET: process.env.NP_SECRET || 'abcdef', // salt for payu / razor
CHANNEL_ID: process.env.NP_CHANNEL_ID || 'WAP',
INDUSTRY_TYPE_ID: process.env.NP_INDUSTRY_TYPE_ID || 'Retail',
theme: {
primary: '#231530',
accent: '#5ce1e6',
},
brand: 'DemoPay',
}, db);
app.use('/_pay',payment);
app.listen(process.env.PORT || 5543, function () {
console.log('Server started at', process.env.PORT || 5543);
});