김태현
김태현
PC환경에서 Promise 방식을 지원하지 않습니다. successUrl, failUrl을 사용해주세요. 에러 질문
안녕하세요 이번에 결제 위젯을 통한 페이팔을 구현중인데요 아래와 같이 코드를 작성하고 PC 환경에서 함수를 실행했을 때 Promise 방식을 지원하지 않습니다. successUrl, failUrl 라는 에러가 발생하는데 어떻게 해결할 수 있을까요?
async function requestPaypal() {
const tossPayments = await loadTossPayments(
'',
);

const widgets = tossPayments.widgets({ customerKey: hotelBookingId });

widgets.setAmount({
currency: 'USD',
value: tossAmount.value,
});

await Promise.all([
// ------ 결제 UI 렌더링 ------
widgets.renderPaymentMethods({
selector: "#payment-method",
variantKey: "PAYPAL",
}),

]);

try {
await widgets.requestPayment({
orderId: hotelBookingId,
orderName: "토스 티셔츠 외 2건",
customerEmail: "customer123@gmail.com",
customerName: "김토스",
});
} catch (error) {
console.error("결제 요청 중 오류 발생:", error);
}
}
async function requestPaypal() {
const tossPayments = await loadTossPayments(
'',
);

const widgets = tossPayments.widgets({ customerKey: hotelBookingId });

widgets.setAmount({
currency: 'USD',
value: tossAmount.value,
});

await Promise.all([
// ------ 결제 UI 렌더링 ------
widgets.renderPaymentMethods({
selector: "#payment-method",
variantKey: "PAYPAL",
}),

]);

try {
await widgets.requestPayment({
orderId: hotelBookingId,
orderName: "토스 티셔츠 외 2건",
customerEmail: "customer123@gmail.com",
customerName: "김토스",
});
} catch (error) {
console.error("결제 요청 중 오류 발생:", error);
}
}
7 replies
일시적인 오류가 발생했습니다.
안녕하세요 결제창(payment.requestPayment)을 띄우는 중에 일시적인 오류가 발생했습니다. loadTossPayments 이후 customerKey 키 값을 넘기는 것 까진 정상 작동을 확인했는데 requestPayment를 호출하는 과정에서 아래와 같이 서버 에러 500이 내려오는데 어떻게 해결 할 수 있을까요?
const tossPayments = await loadTossPayments(clientKey);
const payment = tossPayments.payment({
customerKey: value,
});


{
"result": "ERROR",
"data": null,
"error": {
"code": "COMMON_ERROR",
"message": "처리 중 오류가 발생했습니다",
"data": {
"failUrl": "https://pages.tosspayments.com/error/?code=COMMON_ERROR&message=%EC%B2%98%EB%A6%AC%20%EC%A4%91%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EB%B0%9C%EC%83%9D%ED%96%88%EC%8A%B5%EB%8B%88%EB%8B%A4&orderId=11eff4c1224f2e66a6700242ac110004"
}
}
}
const tossPayments = await loadTossPayments(clientKey);
const payment = tossPayments.payment({
customerKey: value,
});


{
"result": "ERROR",
"data": null,
"error": {
"code": "COMMON_ERROR",
"message": "처리 중 오류가 발생했습니다",
"data": {
"failUrl": "https://pages.tosspayments.com/error/?code=COMMON_ERROR&message=%EC%B2%98%EB%A6%AC%20%EC%A4%91%20%EC%98%A4%EB%A5%98%EA%B0%80%20%EB%B0%9C%EC%83%9D%ED%96%88%EC%8A%B5%EB%8B%88%EB%8B%A4&orderId=11eff4c1224f2e66a6700242ac110004"
}
}
}
24 replies