자동결제 에러 문의
안녕하세요
자동결제창에서 { code: 'INVALID_REQUEST', message: '필수 파라미터가 누락되었습니다.' }
에러가 발생되어 문의 드립니다
const encryptedSecretKey =
export async function POST(req: Request) {
try {
const { customKey, authKey } = await req.json();
const response = await fetch(
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값입니다
자동결제창에서 { 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값입니다
