자동결제 에러 문의


{ 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
Was this page helpful?