export const SuccessPage = () => {
const confirmPayments = async () => {
const url = "https://api.tosspayments.com/v1/payments/confirm";
const requestOptions = {
method: "POST",
headers: {
Authorization: `Basic test_sk_~~~`,
"Content-Type": "application/json",
},
body: JSON.stringify({
paymentKey: paymentKey,
amount: amount,
orderId: orderId,
}),
};
const response = await fetch(url, requestOptions);
if (!response.ok) {
throw new Error("결제 승인 API 호출 실패");
}
const responseJson = await response.json();
console.log(responseJson);
};
confirmPayments().catch((error: any) => {
console.log(error.message);
});
return <div></div>;
};
export const SuccessPage = () => {
const confirmPayments = async () => {
const url = "https://api.tosspayments.com/v1/payments/confirm";
const requestOptions = {
method: "POST",
headers: {
Authorization: `Basic test_sk_~~~`,
"Content-Type": "application/json",
},
body: JSON.stringify({
paymentKey: paymentKey,
amount: amount,
orderId: orderId,
}),
};
const response = await fetch(url, requestOptions);
if (!response.ok) {
throw new Error("결제 승인 API 호출 실패");
}
const responseJson = await response.json();
console.log(responseJson);
};
confirmPayments().catch((error: any) => {
console.log(error.message);
});
return <div></div>;
};