토스 v1/payments/confirm 에러

const { TOSS_NAME, amount, orderId, paymentKey, paymentType } = req.body;
const TOSS_SECRET_KEY = process.env.TOSS_SECRET_KEY;
console.log(TOSS_NAME, amount, orderId, paymentKey, paymentType, TOSS_SECRET_KEY)
const BASIC_TOKEN = Buffer.from(${TOSS_SECRET_KEY}:, "utf-8").toString('base64'); // Base64
const TOSS_RESPONSE = await fetch("https://api.tosspayments.com/v1/payments/confirm", { // TOSS Payments API
method: "POST",
headers: {
Authorization: Basic ${BASIC_TOKEN},
"Content-Type": "application/json",
},
body: JSON.stringify({ amount, orderId, paymentKey, customerKey: orderId }),
});
const TOSS_DATA = await TOSS_RESPONSE.json();
console.log(TOSS_RESPONSE : ${JSON.stringify(TOSS_DATA)});

-----------
const {SUCCESS, TOSS_RESPONSE} = await fetch('/toss_check', {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ TOSS_NAME, amount, orderId, paymentKey, paymentType })
});
console.log("HOME", TOSS_RESPONSE)

: HOME undefined
?
Was this page helpful?