requestPayment의 metadata 파라미터 사용방법 문의
async function requestPayment() {
// 공통 결제 데이터 객체를 생성합니다.
const paymentData = {
method: method, // 'CARD', 'VIRTUAL_ACCOUNT', 'TRANSFER' 중 하나
amount: {
currency: "KRW",
value: amount,
},
orderId: orderId,
orderName: orderName,
successUrl: window.location.origin + successUrl,
failUrl: window.location.origin + failUrl,
customerEmail: customerEmail,
customerName: customerName,
customerMobilePhone: customerMobilePhone,
metadata: {
product_type: product_type,
lecture_code: lecture_code,
},
};
// 결제 수단에 따라 추가 옵션을 설정합니다.
if (method === 'VIRTUAL_ACCOUNT') {
paymentData.virtualAccount = {
cashReceipt: {
type: "미발행",
},
validHours: 168,
};
} else if (method === 'TRANSFER') {
paymentData.transfer = {
cashReceipt: {
type: "미발행",
},
};
}
// 결제 요청을 수행합니다.
await payment.requestPayment(paymentData);
}
requestPayment().catch((r) => {
const btn_arr = []
btn_arr["confirm"] = {func: `location.href='${failUrl}';`};
custom_alert(r.message, "", btn_arr);
}); async function requestPayment() {
// 공통 결제 데이터 객체를 생성합니다.
const paymentData = {
method: method, // 'CARD', 'VIRTUAL_ACCOUNT', 'TRANSFER' 중 하나
amount: {
currency: "KRW",
value: amount,
},
orderId: orderId,
orderName: orderName,
successUrl: window.location.origin + successUrl,
failUrl: window.location.origin + failUrl,
customerEmail: customerEmail,
customerName: customerName,
customerMobilePhone: customerMobilePhone,
metadata: {
product_type: product_type,
lecture_code: lecture_code,
},
};
// 결제 수단에 따라 추가 옵션을 설정합니다.
if (method === 'VIRTUAL_ACCOUNT') {
paymentData.virtualAccount = {
cashReceipt: {
type: "미발행",
},
validHours: 168,
};
} else if (method === 'TRANSFER') {
paymentData.transfer = {
cashReceipt: {
type: "미발행",
},
};
}
// 결제 요청을 수행합니다.
await payment.requestPayment(paymentData);
}
requestPayment().catch((r) => {
const btn_arr = []
btn_arr["confirm"] = {func: `location.href='${failUrl}';`};
custom_alert(r.message, "", btn_arr);
});metadata에 2개 추가해서 결제요청 성공하면 successUrl쪽에 파라미터로 보내주는거 아닌가요?
일단 추가해도 successUrl이동해도 파라미터로 안올길래 질문드립니다
어떻게 사용하는건가요? 예시를 알고싶습니다
