김태현
김태현3mo ago

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);
}
}
6 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
Kimoon Lee
Kimoon Lee3mo ago
페이팔은 promise 방식을 지원하지 않기 때문에 이렇게 사용하실수가 없습니다.
김태현
김태현OP3mo ago
아 그러면 무조건 리다이렉트를 사용해야하는건가요?
Kimoon Lee
Kimoon Lee3mo ago
네 맞습니다. 해보시면 아시겠지만 iframe 으로 페이팔 창이 뜨는게 아니라 전체 페이지가 페이팔로 리다이렉트 되어서 promise 로 드릴수가 없습니다.
김태현
김태현OP3mo ago
넵 알려주셔서 감사합니다!
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.

Did you find this page helpful?