단건 결제(일회성) 승인(confirm) 요청 시 “빌링키 거래 유효하지 않음” 발생 문의
현재 단건 결제(정기결제 아님) 연동 중인데, 결제 요청 -> 승인 흐름에서 계속 유효하지 않은 빌링키 오류가 발생합니다 프론트/백 코드는 다음과 같습니다.
1) 프론트
const successUrl =
const failUrl =
const customerKey =
!isAnonymous && name.trim().length > 0 ?
const payment = tossPayments.payment({ customerKey });
payment.requestPayment({
method: "CARD",
amount: { currency: "KRW", value: finalAmount },
orderId:
orderName: "후원",
successUrl,
failUrl,
customerEmail: undefined,
customerName: isAnonymous ? "익명" : name || "후원자",
});
2) 백엔드
result = await sendHttpRequest<TossPaymentConfirmResponse>(
'토스 단일 결제 승인',
'post',
'https://api.tosspayments.com/v1/payments/confirm',
{
Authorization:
'Content-Type': 'application/json',
},
JSON.stringify({ orderId, paymentKey, amount }),
);
해당 이슈가 발생하는 원인을 알 수 있을까요?
1) 프론트
const successUrl =
${process.env.NEXT_PUBLIC_BACK_URL}/payment/checkout/confirm;const failUrl =
${process.env.NEXT_PUBLIC_BACK_URL}/payment/fail;const customerKey =
!isAnonymous && name.trim().length > 0 ?
${name}-${Date.now()} : ANONYMOUS;const payment = tossPayments.payment({ customerKey });
payment.requestPayment({
method: "CARD",
amount: { currency: "KRW", value: finalAmount },
orderId:
oid_${Date.now()},orderName: "후원",
successUrl,
failUrl,
customerEmail: undefined,
customerName: isAnonymous ? "익명" : name || "후원자",
});
2) 백엔드
result = await sendHttpRequest<TossPaymentConfirmResponse>(
'토스 단일 결제 승인',
'post',
'https://api.tosspayments.com/v1/payments/confirm',
{
Authorization:
Basic ${this.configService.get('TOSSPAYMENTS_API_SECRET_KEY')},'Content-Type': 'application/json',
},
JSON.stringify({ orderId, paymentKey, amount }),
);
해당 이슈가 발생하는 원인을 알 수 있을까요?
