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);
}
}