Astronaut
Astronaut
tosspayments/payment-sdk 라이브러리 질문 드립니다 ㅜㅜ
...
if (paymentMethod === '토스페이') {
const ck = process.env.NEXT_PUBLIC_TOSS_CLIENT_KEY;
const sk = process.env.NEXT_PUBLIC_TOSS_SECRET_KEY;

if (!ck) throw Error('Invalid Client Key');
if (!sk) throw Error('Invalid Secret Key');

const tossPayments = await loadTossPayments(ck);
tossPayments.requestPayment('토스페이', {
amount: price,
orderId: Buffer.from(token + popupId + date + ':').toString('base64'),
orderName: 'POPPY 테스트',
customerName: userInfoData[0].userNickname,
successUrl: `http://localhost:3000/detail/${popupId}/book/completed`,
failUrl: `http://localhost:3000/detail/${popupId}`,
});
}
...
...
if (paymentMethod === '토스페이') {
const ck = process.env.NEXT_PUBLIC_TOSS_CLIENT_KEY;
const sk = process.env.NEXT_PUBLIC_TOSS_SECRET_KEY;

if (!ck) throw Error('Invalid Client Key');
if (!sk) throw Error('Invalid Secret Key');

const tossPayments = await loadTossPayments(ck);
tossPayments.requestPayment('토스페이', {
amount: price,
orderId: Buffer.from(token + popupId + date + ':').toString('base64'),
orderName: 'POPPY 테스트',
customerName: userInfoData[0].userNickname,
successUrl: `http://localhost:3000/detail/${popupId}/book/completed`,
failUrl: `http://localhost:3000/detail/${popupId}`,
});
}
...
토스 페이먼츠 개발자센터에서 테스트용 'API 개별 연동 키'를 받아와 .env.local 환경 변수로 설정하고 불러와서 사용하고 있습니다. 그런데 API 요청 시 401(Unathorized)와 함께 "Uncaught (in promise) p: 인증되지 않은 시크릿 키 혹은 클라이언트 키 입니다." 라는 오류가 콘솔에 출력되네요ㅜㅜ 혹시 API 키를 잘못 넣은 것일까요?
10 replies