sjk
sjk
모바일웹 환경 결제 연동 시 스킴 오류가 나는것 같아요
html head부분에 <script src="https://js.tosspayments.com/v2/standard"></script> sdk추가 했고 바디 안의 스크립트 부분에서 const tossPayments = TossPayments(clientKey); const payment = tossPayments.payment({customerKey: TossPayments.ANONYMOUS}) async function startPayment(method) { if (!validate()) return; const amt = Number(document.getElementById("payAmt").value); const prd = document.getElementById("payPrd").value; const name = document.getElementById("payName").value.trim(); const phone = document.getElementById("payPhone").value.trim(); const email = document.getElementById("payMail").value.trim(); const orderId = generateKey(); await payment.requestPayment({ method: method, amount: { currency: "KRW", value: amt, }, orderId: orderId, orderName: prd, customerName: name, customerMobilePhone: phone, customerEmail: email, successUrl: https://www.narma.co.kr/payment-success?pay=success&orderId=${orderId}&amount=${amt}&rc=test-site, failUrl: https://www.narma.co.kr/payment-success?pay=fail&rc=test-site }); } 이렇게 결제창을 열고 있습니다. 결제창을 연 후 토스간편결제 등에서 다음을 누르면 Failed to launch 'supertoss://pay?payToken=Vq3YsLQG22xUO8QXnek17f&appPayVersion=2.0' because the scheme does not have a registered handler 이렇게 콘솔에 찍히며 앱으로 알림이 오지 않습니다. 모바일 디바이스에서만 동작하나요?
14 replies
customerKey 가 반드시 필요한가요?
오프라인 qr에서 결제페이지로 연동 테스트를 해보고 있습니다. 회원결제가 존재하지 않는다면 const payment = tossPayments.payment({customerKey: TossPayments.ANONYMOUS}) 이런식으로 생성 후 밑 처럼 하면 문제 없나요? await payment.requestPayment({ method: "CARD", // 카드 결제 amount: { currency: "KRW", value: Number(price), }, orderId: generateKey(), orderName: $('#prdNm').text(), successUrl: window.location.href + '/success', // 결제 요청이 성공하면 리다이렉트되는 URL failUrl: window.location.href + '/fail', // 결제 요청이 실패하면 리다이렉트되는 URL customerEmail: null, customerName: null, customerMobilePhone: null, // 카드 결제에 필요한 정보 card: { useEscrow: false, flowMode: "DEFAULT", // 통합결제창 여는 옵션 useCardPoint: false, useAppCardOnly: false, }, });
8 replies