const { tossAutomaticPaymentsResponse: response } = await fetchProducePaymentRequest({
pgServiceCode: 'toss',
type: 'automatic',
}).unwrap();
tossPayments = await loadTossPayments(response.clientKey);
tossPayments
.requestBillingAuth('카드', {
customerKey: response.customerKey,
successUrl: `${env('APP_BASE_URL')}/test/paygate`,
failUrl: `${env('APP_BASE_URL')}api/paygate/close`,
})
.catch((err) => {
Object.keys(TossPaymentsErrorCode).forEach((errCode) => {
if (err.code === errCode) {
return notify.error(TossPaymentsErrorCode[errCode]);
} else {
return notify.error('잠시후 다시 시도해주세요');
}
});
});
const { tossAutomaticPaymentsResponse: response } = await fetchProducePaymentRequest({
pgServiceCode: 'toss',
type: 'automatic',
}).unwrap();
tossPayments = await loadTossPayments(response.clientKey);
tossPayments
.requestBillingAuth('카드', {
customerKey: response.customerKey,
successUrl: `${env('APP_BASE_URL')}/test/paygate`,
failUrl: `${env('APP_BASE_URL')}api/paygate/close`,
})
.catch((err) => {
Object.keys(TossPaymentsErrorCode).forEach((errCode) => {
if (err.code === errCode) {
return notify.error(TossPaymentsErrorCode[errCode]);
} else {
return notify.error('잠시후 다시 시도해주세요');
}
});
});