-
Notifications
You must be signed in to change notification settings - Fork 7
/
server.js
28 lines (25 loc) · 901 Bytes
/
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
const express = require("express");
const app = express();
// This is a public sample test API key.
// Don’t submit any personally identifiable information in requests made with this key.
// Sign in to see your own test API key embedded in code samples.
app.use(express.static("public"));
app.use(express.json());
app.post("/create-payment", async (req, res) => {
fetch("https://sandbox.hyperswitch.io/payments", {
method: "POST",
headers: { "Content-Type": "application/json", 'api-key': "API_KEY" },
body: JSON.stringify({
currency: "USD",
amount: 100,
customer_id: "juspay",
}),
})
.then(resp => resp.json())
.then(data => {
res.send({
clientSecret: data.client_secret
})
})
})
app.listen(4242, () => console.log("Node server listening on port 4242!"));