js express로 결제승인 코드를 구성했는데 빈값이 넘어옵니다
router.post('/config', async (req, res) => {
const { amount, orderId, paymentKey } = req.body;
const BASIC_TOKEN = Buffer.from(
시크릿키:
, "utf-8").toString('base64')
const test = await fetch("https://api.tosspayments.com/v1/payments/confirm", {
method: "POST",
headers: {
Authorization: Basic ${BASIC_TOKEN}
,
"Content-Type": "application/json",
},
body: JSON.stringify({ amount, orderId, paymentKey, customerKey: orderId }),
});
console.log("\n\n\n" + JSON.stringify(test))
});3 Replies
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) :
- 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요.
* 주말/공휴일에는 답변이 늦을 수 있어요.
node-fetch 사용법을 잘못알고계신 것 같습니다.
fetch를 promise로 사용시, <fetch>.json()으로 응답을 받아올 수 있습니다.
e.g.)
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.