살라만카
TPToss payments 개발자 커뮤니티
•Created by 살라만카 on 2/20/2025 in #❓┃연동개발-문의
결제위젯 클라이언트 쪽 예제코드를 실행하면 에러가 납니다.
현재 심사를 위해 새로 street4zss MID 를 발급받고 개발 중입니다.
해당 위젯 키로 실행을 하면 콘솔에 아래와 같은 에러가 발생합니다.
아래는 문서를 보며 작성한 위젯 호출 코드 입니다.
저번에 문의한 bill_wsneapvjb mid로 했을 때 와 같은 에러입니다.
감사합니다.
TypeError: Cannot read properties of undefined (reading 'id')
at r.selectedPaymentMethod.isNormalMethodFirst (11-fe79a70f88345b5f.js:53:49477)
at ed.ofPaymentMethodMap (11-fe79a70f88345b5f.js:53:49534)
...
toss-test:30 Uncaught (in promise) r: 알 수 없는 에러가 발생했습니다.
at https://js.tosspayments.com/v2/standard:7:546228
at Object.otherwise (https://js.tosspayments.com/v2/standard:7:429238)
...
TypeError: Cannot read properties of undefined (reading 'id')
at r.selectedPaymentMethod.isNormalMethodFirst (11-fe79a70f88345b5f.js:53:49477)
at ed.ofPaymentMethodMap (11-fe79a70f88345b5f.js:53:49534)
...
toss-test:30 Uncaught (in promise) r: 알 수 없는 에러가 발생했습니다.
at https://js.tosspayments.com/v2/standard:7:546228
at Object.otherwise (https://js.tosspayments.com/v2/standard:7:429238)
...
<!DOCTYPE html>
<html lang="ko">
<head>
<head>
<!-- 스크립트 추가 -->
<script src="https://js.tosspayments.com/v2/standard"></script>
</head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>결제위젯 샘플</title>
</head>
<body>
<script>
// 스크립트 태그 연동방식
function generateRandomString() {
return window.btoa(Math.random().toString()).slice(0, 20);
}
async function main () {
const tossPayments = TossPayments("test_gck_QbgMGZzorzzKQwgdaNLLrl5E1em4"); // 결제위젯 연동 키
const widgets = tossPayments.widgets({ customerKey: generateRandomString() });
widgets.setAmount({
currency: 'KRW',
value: 1000,
});
const paymentMethodWidget = await widgets.renderPaymentMethods({
selector: "#payment-method",
variantKey: "DEFAULT",
});
}
main();
</script>
<div class="wrapper w-100">
<div class="max-w-540 w-100">
<div id="payment-method" class="w-100"></div>
<div id="agreement" class="w-100"></div>
<div class="btn-wrapper w-100">
<button id="payment-request-button" class="btn primary w-100">결제하기</button>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="ko">
<head>
<head>
<!-- 스크립트 추가 -->
<script src="https://js.tosspayments.com/v2/standard"></script>
</head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>결제위젯 샘플</title>
</head>
<body>
<script>
// 스크립트 태그 연동방식
function generateRandomString() {
return window.btoa(Math.random().toString()).slice(0, 20);
}
async function main () {
const tossPayments = TossPayments("test_gck_QbgMGZzorzzKQwgdaNLLrl5E1em4"); // 결제위젯 연동 키
const widgets = tossPayments.widgets({ customerKey: generateRandomString() });
widgets.setAmount({
currency: 'KRW',
value: 1000,
});
const paymentMethodWidget = await widgets.renderPaymentMethods({
selector: "#payment-method",
variantKey: "DEFAULT",
});
}
main();
</script>
<div class="wrapper w-100">
<div class="max-w-540 w-100">
<div id="payment-method" class="w-100"></div>
<div id="agreement" class="w-100"></div>
<div class="btn-wrapper w-100">
<button id="payment-request-button" class="btn primary w-100">결제하기</button>
</div>
</div>
</div>
</body>
</html>
10 replies
TPToss payments 개발자 커뮤니티
•Created by 살라만카 on 2/17/2025 in #❓┃연동개발-문의
결제UI 설정 관련 MID 질문 드립니다.
이번에 토스페이먼츠 연동을 진행 하고 있는데요
이전에 다른분이 인증받아 사용 중인 MID로 테스트 해보려고 하는데
결제UI 설정에서 사용중인 MID가 아닌 다른 MID 리스트가 뜹니다.
이것 때문인지 깃허브 예제 파일에서 react로 결제위젯 화면을 띄우면
이렇게 뜹니다. 어떻게 하면 될까요?
서버에서 해당 MID api key로 일반결제, 결제승인은 됩니다.
TypeError: Cannot read properties of undefined (reading 'id')
at r.selectedPaymentMethod.isNormalMethodFirst (11-fe79a70f88345b5f.js:53:49477)
at ed.ofPaymentMethodMap (11-fe79a70f88345b5f.js:53:49534)
at X.L.adminSetting (payment-widget.tosspayments.com/payment-widget/ce017550af266f245a2fc705f951c553138b6533/_next/static/chunks/pages/v2/entry/payment-methods-30c992ab5de51d90.js:1:9647)
at X (payment-widget.tosspayments.com/payment-widget/ce017550af266f245a2fc705f951c553138b6533/_next/static/chunks/pages/v2/entry/payment-methods-30c992ab5de51d90.js:1:10179)
at ab (framework-34d8deae39afc448.js:9:60870)
at i (framework-34d8deae39afc448.js:9:119410)
at oO (framework-34d8deae39afc448.js:9:99059)
at framework-34d8deae39afc448.js:9:98926
at oF (framework-34d8deae39afc448.js:9:98933)
at ox (framework-34d8deae39afc448.js:9:95685)
WidgetCheckout.jsx:76 Uncaught (in promise) r: 알 수 없는 에러가 발생했습니다.
at https://js.tosspayments.com/v2/standard:7:546228
at Object.otherwise (https://js.tosspayments.com/v2/standard:7:429238)
at Proxy.<anonymous> (https://js.tosspayments.com/v2/standard:7:546199)
at d (https://js.tosspayments.com/v2/standard:7:41822)
at Generator.<anonymous> (https://js.tosspayments.com/v2/standard:7:43137)
at Generator.throw (https://js.tosspayments.com/v2/standard:7:42232)
at n (https://js.tosspayments.com/v2/standard:7:871)
at u (https://js.tosspayments.com/v2/standard:7:1110)
TypeError: Cannot read properties of undefined (reading 'id')
at r.selectedPaymentMethod.isNormalMethodFirst (11-fe79a70f88345b5f.js:53:49477)
at ed.ofPaymentMethodMap (11-fe79a70f88345b5f.js:53:49534)
at X.L.adminSetting (payment-widget.tosspayments.com/payment-widget/ce017550af266f245a2fc705f951c553138b6533/_next/static/chunks/pages/v2/entry/payment-methods-30c992ab5de51d90.js:1:9647)
at X (payment-widget.tosspayments.com/payment-widget/ce017550af266f245a2fc705f951c553138b6533/_next/static/chunks/pages/v2/entry/payment-methods-30c992ab5de51d90.js:1:10179)
at ab (framework-34d8deae39afc448.js:9:60870)
at i (framework-34d8deae39afc448.js:9:119410)
at oO (framework-34d8deae39afc448.js:9:99059)
at framework-34d8deae39afc448.js:9:98926
at oF (framework-34d8deae39afc448.js:9:98933)
at ox (framework-34d8deae39afc448.js:9:95685)
WidgetCheckout.jsx:76 Uncaught (in promise) r: 알 수 없는 에러가 발생했습니다.
at https://js.tosspayments.com/v2/standard:7:546228
at Object.otherwise (https://js.tosspayments.com/v2/standard:7:429238)
at Proxy.<anonymous> (https://js.tosspayments.com/v2/standard:7:546199)
at d (https://js.tosspayments.com/v2/standard:7:41822)
at Generator.<anonymous> (https://js.tosspayments.com/v2/standard:7:43137)
at Generator.throw (https://js.tosspayments.com/v2/standard:7:42232)
at n (https://js.tosspayments.com/v2/standard:7:871)
at u (https://js.tosspayments.com/v2/standard:7:1110)
10 replies