-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget-otu-and-pay.js
47 lines (40 loc) · 1 KB
/
get-otu-and-pay.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
38
39
40
41
42
43
44
45
46
47
const express = require('express')
const fetch = require('node-fetch');
const cors = require('cors')
const bodyParser = require('body-parser');
const app = express()
const port = 3000
app.use(bodyParser.urlencoded({
extended: false
}))
app.use(bodyParser.json())
app.use(cors())
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
app.get('/', (req, res) => {
fetch('https://api.nexiopaysandbox.com/pay/v3/token', {
method: 'post',
body: JSON.stringify(otuRequest),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic eW91clVzZXJOYW1lOnlvdXJQYXNzd29yZA=='
},
}).then((fetchResponse) => {
return fetchResponse.json()
}).then((objData) => {
console.log(objData)
res.json(objData)
});
})
app.post('/pay', (req, res) => {
//get credit token from req
//call out to nexiopaysandbox
//use token to make payment
})
const otuRequest = {
uiOptions:{
displaySubmitButton: true,
hideBilling:true
}
}