lilinyoung
lilinyoung8mo ago

Unexpected token '<', "<!DOCTYPE "... is not valid JSON

에러메시지 Unexpected token '<', "<!DOCTYPE "... is not valid JSON 에러코드 undefined 제공해주신 샘플코드만 돌려도 이런 메시지가 나오는데. 이건 어떤 상황인가요?
21 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
김차장
김차장8mo ago
돌려보신 샘플코드가 있는 url 전달주세요
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.
Kimoon Lee
Kimoon Lee2w ago
샘플코드는 어디에서 참고하셨나요?
Kimoon Lee
Kimoon Lee2w ago
No description
Kimoon Lee
Kimoon Lee2w ago
잘 표시 되는것 같은데요. 결제시에 문제가 생기시는 건가요?
lilinyoung
lilinyoungOP2w ago
아 저는 지금 해외결제 paypal 을 테스트하고 있습니다. 저희 사이트내에서 현재 일반결제는 잘 사용하고 있습니다.
Kimoon Lee
Kimoon Lee2w ago
페이팔도 결제창은 뜨는것 같은데 결제진행이 안되시는 건가요?
lilinyoung
lilinyoungOP2w ago
토스에서 제공하신 계정으로 페이팔 들어가서 제일 위에 카드 선택하면 결제는 되는데요, 결제가 완료되었습니다 페이지에서 1초만에 fail.html 로 리다이렉트 되면서 저 문구가 뜹니다.
Kimoon Lee
Kimoon Lee2w ago
그러면 결제자체는 이상이 없는 겁니다. fail.html 코드좀 공유해주실수 있을까요? 지금 테스트 계정이 막혀서 테스트 결제가 안되고 있어요.
lilinyoung
lilinyoungOP2w ago
<!DOCTYPE html> <html lang="kr"> <head> <meta charset="utf-8" /> <link rel="icon" href="https://static.toss.im/icons/png/4x/icon-toss-logo.png" /> <link rel="stylesheet" type="text/css" href="style.css" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>토스페이먼츠 샘플 프로젝트</title> </head> <body> <div id="info" class="box_section" style="width: 600px"> <img width="100px" src="https://static.toss.im/lotties/error-spot-no-loop-space-apng.png" /> <h2>결제를 실패했어요</h2> <div class="p-grid typography--p" style="margin-top: 50px"> <div class="p-grid-col text--left"><b>에러메시지</b></div> <div class="p-grid-col text--right" id="message"></div> </div> <div class="p-grid typography--p" style="margin-top: 10px"> <div class="p-grid-col text--left"><b>에러코드</b></div> <div class="p-grid-col text--right" id="code"></div> </div> <div class="p-grid"> <button class="button p-grid-col5" onclick="location.href='https://docs.tosspayments.com/guides/v2/payment-widget/integration';">연동 문서</button> <button class="button p-grid-col5" onclick="location.href='https://discord.gg/A4fRFXQhRu';" style="background-color: #e8f3ff; color: #1b64da">실시간 문의</button> </div> </div> <script> const urlParams = new URLSearchParams(window.location.search); const codeElement = document.getElementById("code"); const messageElement = document.getElementById("message"); codeElement.textContent = urlParams.get("code"); messageElement.textContent = urlParams.get("message"); </script> </body> </html>
Discord - Group Chat That’s All Fun & Games
Discord is great for playing games and chilling with friends, or even building a worldwide community. Customize your own space to talk, play, and hang out.
lilinyoung
lilinyoungOP2w ago
제가 지금 사용하는 소스코드는 전부 수정없이 토스에서 제공해주신것을 사용하고 있습니다. 일단 화면이 어떻게 돌게 되는지 보고싶었거든요. 샘플 소스가 오류가 나서 연락을 드렸습니다. 샘플코드에 저희 테스트 API 클라이언트 key 를 넣었고, 웹훅도 등록해놓았는데, API 로그에도 나오지 않습니다. 에러메시지 Unexpected token '<', "<!DOCTYPE "... is not valid JSON 에러코드 undefined
Kimoon Lee
Kimoon Lee2w ago
받으신 코드 github 도 공유 부탁드립니다. Unexpected token '<', "<!DOCTYPE "... is not valid JSON 이에러가 나는 것으로 보아 ajax 가 실패하는 것 같아요.
lilinyoung
lilinyoungOP2w ago
저 혹시 php 사용중인데, 결제위젯으로 해외결제 붙일 수 있는건가요?
lilinyoung
lilinyoungOP2w ago
GitHub
tosspayments-sample/php-javascript/public/payment/checkout.html at ...
토스페이먼츠 결제연동 샘플 프로젝트입니다. Contribute to tosspayments/tosspayments-sample development by creating an account on GitHub.
lilinyoung
lilinyoungOP2w ago
저 그리고 success.html 페이지에서 const response = await fetch("/confirm/payment", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(requestData), });
Kimoon Lee
Kimoon Lee2w ago
index.php 에서 function confirmPayment 가 호출되는지 확인해 보세요. index.php 에서 /confirm/payment 호출되었을때 json 이 응답되지 않는것 같네요.
lilinyoung
lilinyoungOP2w ago
저 죄송한데 function confirmPayment 을 호출하는 구문이 있나요? 전 샘플코드에서 못찾고 있는것 같은데요.
Kimoon Lee
Kimoon Lee2w ago
index.php 보시면 "/confirm/payment" 로 호출되었을때 호출합니다.
Kimoon Lee
Kimoon Lee2w ago
No description

Did you find this page helpful?