// TossPayments SDK 초기화
const clientKey = "test_ck_4Gv6LjeKD8apABeXYbwrwYxAdXy1"; // 실제 클라이언트 키로 교체
const tossPayments = TossPayments(clientKey);
// 결제 금액 설정
const amount = Number(1000); // 결제 금액 (숫자로 변환)
// 고유한 주문 ID 생성
const orderId = `order-${new Date().getTime()}`;
// 결제 UI 렌더링
tossPayments.requestPayment('PayPal', {
amount: amount,
orderId: orderId,
orderName: "Default Order Name",
successUrl: window.location.origin + "/success",
failUrl: window.location.origin + "/fail",
customerEmail: "[email protected]", // 동적 값으로 교체
customerName: "John Doe", // 동적 값으로 교체
products: [
{
name: "Small Bag",
quantity: 1,
unitAmount: 1000,
currency: "USD",
description: "small_bag",
}
],
paymentMethodOptions: {
paypal: {
setTransactionContext: {
sender_account_id: "[email protected]",
sender_first_name: "John",
sender_last_name: "Doe",
sender_email: "[email protected]",
sender_phone: "123-456-7890",
sender_country_code: "US",
sender_create_date: "2024-01-09T19:14:55.277Z",
}
}
}
});