-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder-success.html
More file actions
46 lines (40 loc) · 1.03 KB
/
order-success.html
File metadata and controls
46 lines (40 loc) · 1.03 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
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>결제 성공</h2>
<script>
const urlParams = new URLSearchParams(window.location.search);
const paymentKey = urlParams.get("paymentKey");
const amount = urlParams.get("amount");
const orderId = urlParams.get("orderId");
console.log("paymentKey:", paymentKey);
console.log("orderId:", orderId);
fetch("http://localhost:9001/api/v1/payments/confirm", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
orderId: orderId,
paymentKey: paymentKey,
amount: Number(amount)
})
})
.then(res => {
if (!res.ok) {
throw new Error("결제 승인 실패");
}
return res.json();
})
.then(data => {
console.log("결제 완료:", data);
})
.catch(err => {
console.error(err);
});
</script>
</body>
</html>