-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
37 lines (30 loc) · 1.05 KB
/
server.js
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
35
36
37
const express = require('express');
const axios = require('axios');
const cors = require('cors');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'src', 'js')));
app.use(express.static(path.join(__dirname, 'src', 'css')));
app.use(cors());
app.get('/supportedpaymentmethods', (req, res) => {
const headers = {
// Replace app-id and private-key with the id and private key of your Business Unit.
// The default provider configured in this Business Unit must support the Get Supported Payment Methods API.
'app-id': 'com.xxx.xxx',
'private-key': 'xxxxxxxxxxxxx',
'x-payments-os-env': 'test',
'api-version': '1.2.0',
};
axios.get('https://api.paymentsos.com/supported-payment-methods', { headers })
.then((response) => {
res.send(response.data);
})
.catch((e) => {
console.log(e.response.data);
res.send(e.response.data);
});
});
app.listen('9000', () => {
console.log('server is up on port 9000');
});