Toss payments 개발자 커뮤니티Tp개커Toss payments 개발자 커뮤니티
Powered by
HarimH
Toss payments 개발자 커뮤니티•7mo ago•
24 replies
Harim

자동빌링 관련한 문제

TypeError: Cannot read properties of undefined (reading 'customerKey') 오류가 Toss Payments SDK 내부(v1:8:493552)에서 발생하고 있는데, 어떻게 디버깅해야할까요?

어떻게 해도, 고쳐지지가 않습니다. 일반 결제에서 자동결제(빌링)으로 코드를 바꾸는데, 일반결제는 테스트결제로도 넘어가는데, 지금은 아예 넘어가지질 않는 상태입니다.

저희 코드에서는 customerKey가 명확하게 정의되어 Toss Payments SDK로 전달되고 있습니다. src/components/SubscriptionModal.tsx 파일의 handlePayment 함수를 안에서, 다음과 같이 customerKey를 생성하고 있습니다:


const customerKey =
customer_${userId}_${Date.now()}
customer_${userId}_${Date.now()}
;
그리고 이 customerKey는 billingAuthOptions 객체에 포함되어 tossPayments.requestBillingAuth() 함수로 전달됩니다:


const billingAuthOptions = {
customerKey: customerKey,
successUrl: successUrl,
failUrl: failUrl,
customerName: customerName,
customerEmail: userEmail
};

await tossPayments.requestBillingAuth(billingAuthOptions);
또한, 제공해주신 콘솔 로그에서도 customerKey가 올바르게 생성되어 billingAuthOptions 객체에 포함된 것을 확인할 수 있습니다:

🔍 Customer info prepared: {customerKey: 'customer_1_1753760036255', customerEmail: '이메일, customerName: '아이디', userId: 1}
🔍 Billing auth options: Object (이 객체 안에 customerKey가 포함되어 있습니다.)
따라서, 저희 코드에서 customerKey는 분명히 정의되어 올바르게 전달되고 있습니다. TypeError: Cannot read properties of undefined (reading 'customerKey') 오류가 발생하는 것은 Toss Payments SDK 내부에서 billingAuthOptions 객체를 처리하는 과정에서 customerKey를 제대로 참조하지 못하는 문제인지, 아니면 제 코드에서 변경을 해야하는것인지, 도와주시면 감사하겠습니다.
Toss payments 개발자 커뮤니티 banner
Toss payments 개발자 커뮤니티Join
Toss payments 개발자 커뮤니티입니다. 결제 연동하며 겪는 기술 문의부터, 결제 시장에 대한 다양한 정보까지 얻어가세요~
15,588Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

자동빌링 환불 문의
강이서강강이서 / ❓┃연동개발-문의
16mo ago
버블 자동빌링 문의드립니다
jangjinJjangjin / ❓┃연동개발-문의
2y ago
소수점 관련한 문의
kangwoocKkangwooc / ❓┃연동개발-문의
13mo ago
자동빌링 결제 연동관련 문의
daoDdao / ❓┃연동개발-문의
7mo ago