TraceboundAI
TraceboundAI4w ago

자동빌링 관련한 문제

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()}; 그리고 이 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를 제대로 참조하지 못하는 문제인지, 아니면 제 코드에서 변경을 해야하는것인지, 도와주시면 감사하겠습니다.
17 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
Kimoon Lee
Kimoon Lee4w ago
javascript SDK 사용중이신가요? 그리고 customerkey 에 ustomer${userId}${Date.now()} 이런식으로 일시가 들어가면 안됩니다. 저 값을 나중에 다시 사용하셔야 하는데 어떤값인지 아실수가 없을거에요. 아마 허용되지 않는 특수문자가 포함되는건 아닌지 확인해 보세요.
TraceboundAI
TraceboundAIOP4w ago
네, javascript SDK 사용중입니다. 그리고 const customerKey = customer${userId}; 이렇게 변경했습니다. 아직 문제가 해결되진 않았어요 ㅠㅠ
Kimoon Lee
Kimoon Lee4w ago
보내신 customerkey 를 공유해주세요.
TraceboundAI
TraceboundAIOP4w ago
🔍 Billing auth options (JSON): { "customerKey": "customer1", "successUrl": "https://tracebound-beta.onrender.com?billingSuccess=true&customerKey=customer1&authKey=PLACEHOLDER&planType=monthly&userId=1", "failUrl": "https://tracebound-beta.onrender.com?billingFail=true", "customerName": "jamesyhr", "customerEmail": "jamesyhr@gmail.com" } index-De3Mc_73.js:547 Billing auth processing failed: TypeError: Cannot read properties of undefined (reading 'customerKey') at Proxy.<anonymous> (v1:8:493552) at h (v1:1:37751) at Generator.<anonymous> (v1:1:39066) at Generator.next (v1:1:38161) at v1:8:1791 at new Promise (<anonymous>) at sx (v1:8:1571) at Proxy.value (v1:8:493394) at Object.apply (v1:8:17292) at v1:17:5091 customerkey는 customer1로 세팅되어있습니다.
Kimoon Lee
Kimoon Lee4w ago
혹시 사용하신 저희 JS 파일 경로좀 알수 있을까요?
TraceboundAI
TraceboundAIOP4w ago
"저희는 Toss Payments의 공식 JavaScript SDK인 @tosspayments/payment-sdk npm 패키지를 사용하고 있습니다. 이 SDK는 loadTossPayments 함수를 통해 동적으로 로드되며, 실제 JS 파일은 Toss Payments의 CDN에서 제공됩니다. 저희 package.json에 명시된 @tosspayments/payment-sdk 버전은 ^1.9.1입니다.
Kimoon Lee
Kimoon Lee4w ago
아 npm 패키지 사용중이시군요.
TraceboundAI
TraceboundAIOP4w ago
혹시 어떻게 해결해야할지 알려주실수 있을까요?
Kimoon Lee
Kimoon Lee4w ago
내부적으로 이슈가 있는지 확인중입니다. @TraceboundAI 님 관련된 코드를 전달해 주실수 있을까요?
토스페이먼츠 BOT
💡 정보 제출
민감 정보를 안전하게 제출해주세요
TraceboundAI
TraceboundAIOP4w ago
보내드렸어요-!
Kimoon Lee
Kimoon Lee4w ago
네 감사합니다.
TraceboundAI
TraceboundAIOP4w ago
방금 이미지도 하나 더 보내드렸습니다..혹시 보시면 해결되는데 도움이 될까봐서요-
Kimoon Lee
Kimoon Lee4w ago
await tossPayments.requestBillingAuth(billingAuthOptions); -> await tossPayments.requestBillingAuth('CARD', billingAuthOptions); 이렇게 변경하실수 잇을까요? 스펙대로 method 를 호출하지 않으신것 같아요.
TraceboundAI
TraceboundAIOP4w ago
고쳐보겠습니다! 감사합니다!
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.

Did you find this page helpful?