리버스 개발자
리버스 개발자
TPToss payments 개발자 커뮤니티
Created by 리버스 개발자 on 5/22/2024 in #❓┃연동개발-문의
빌링키 발급 시 카드정보 문의드립니다
빌링키 발급 시 response에 해당 카드번호에 대한 카드사 및 코드도 같이 전달 받는데요, 혹시 어떤 카드인지 ex) 신한 더모아 카드 이런식으로 종류까지 식별 가능한 방법이 있을까요?
5 replies
TPToss payments 개발자 커뮤니티
Created by 리버스 개발자 on 4/16/2024 in #❓┃연동개발-문의
자동결제
자동결제(빌링) 서비스 연동 문의 드립니다. 안녕하세요. 현재 서비스에서 자동결제(빌링) 연동중에 있고 연동은 하였으나 궁금한점이 있어 글 남깁니다. 자동결제(빌링)서비스는 promise 형태는 지원을 안하고 있어서 아래 코드 처럼 작성 및 연동 확인을 하였는데요.
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('잠시후 다시 시도해주세요');
}
});
});
successUrl 이나 failUrl로 이동시 현재는 location.href 처럼 이동하기에 사용성이 좀 떨어지는감이 없지않아있어서 router.push 처럼 이동하거나 (promise 방식 미지원이라 안될것이라 예상되긴합니다) ifame 내부에서 이동하는 방식으로는 구현을 할 수 없을지 문의 드립니다.
11 replies