이동준
이동준2mo ago

자동결제 에러 문의

안녕하세요 자동결제창에서 { code: 'INVALID_REQUEST', message: '필수 파라미터가 누락되었습니다.' } 에러가 발생되어 문의 드립니다 const encryptedSecretKey = Basic ${btoa('내api개별연동키에서시크릿키:')}; export async function POST(req: Request) { try { const { customKey, authKey } = await req.json(); const response = await fetch( https://api.tosspayments.com/v1/billing/authorizations/issue, { method: "POST", headers: { Authorization: encryptedSecretKey, "Content-Type": "application/json", }, body: JSON.stringify({ authKey, // 인증 키 customKey, // 고객 키 }) } ); const result = await response.json(); if (response.ok) { return NextResponse.json(result, { status: 200 }); } else { return NextResponse.json(result, { status: response.status }); } } catch (error) { console.error("Error:", error); return NextResponse.json({ message: "Internal Server Error" }, { status: 500 }); } } customKey는 db에서 생성한 고객 id값 authKey는 redirect페이지 이동시 params에 나오는 authkey값입니다
11 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
이실장
이실장2mo ago
사용한 customerKey알려주세요
이동준
이동준OP2mo ago
clv3nnb6x000081s13l9gi911 입니다 로컬에서 테스트중이고 개발 연동 체험 상점내의 API 개별 연동키에서 클라이언트키,시크릿키값 복사해서 사용했습니다!
Kimoon Lee
Kimoon Lee2mo ago
{"customKey":"clv3nnb6x000081s13l9gi911" customerkey 로 보내주세요.
customKey, // 고객 키
파라미터 명을 잘못 보내고 계시네요.
이동준
이동준OP2mo ago
감사합니다!! const response = await fetch( https://api.tosspayments.com/v1/billing/authorizations/issue, { method: "POST", headers: { Authorization: encryptedSecretKey, "Content-Type": "application/json", }, body: JSON.stringify({ authKey: authKey, customerKey : customerkey }) } ); 이렇게 바꿔서 보냈는데 { code: 'NOT_FOUND', message: '존재하지 않는 정보 입니다.' }는 테스트 환경이여서 그런걸까요?
Kimoon Lee
Kimoon Lee2mo ago
authKey 를 새로 받아서 하셔야 합니다.
이동준
이동준OP2mo ago
감사합니다!! 혹시 ( https://api.tosspayments.com/v1/billing/authorizations/issue, 주소로 api를 호출하는 과정자체가 billing key를 발급함과 동시에 최초결제까지 같이 이루어지는게 맞을까요?!
이실장
이실장2mo ago
아니요 발급받은 빌링키로
이실장
이실장2mo ago
코어 API | 토스페이먼츠 개발자센터
토스페이먼츠 API 엔드포인트(Endpoint)와 객체 정보, 파라미터, 요청 및 응답 예제를 살펴보세요.
이실장
이실장2mo ago
이걸 호출해주셔야 결제가 일어납니다.
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.

Did you find this page helpful?