영웅
영웅9mo ago

LIVE 키 적용 후 결제가 안되고 있어요.

toss/index.html 에서 결제 위젯 적용 했구요. 결제 후 success.html 이동하고, 데이타 처리 다 됐는데 실제로 카드 결제는 이뤄지지 않았어요. 뭘 빼먹었는지 확인 부탁드려요.
7 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
Kimoon Lee
Kimoon Lee9mo ago
success.html 에서 승인 API 호출하셨는지 확인부탁드립니다.
영웅
영웅OP9mo ago
승인 API 호출요? 샘플 페이지에 있는 내용은 다 했다고 생각했는데요. PHP로 작성중입니다. 참고할 샘플 페이지 URL 부탁드려요 혹시 <script> // 쿼리 파라미터 값이 결제 요청할 때 보낸 데이터와 동일한지 반드시 확인하세요. // 클라이언트에서 결제 금액을 조작하는 행위를 방지할 수 있습니다. const urlParams = new URLSearchParams(window.location.search); // 서버로 결제 승인에 필요한 결제 정보를 보내세요. async function confirm() { const requestData = { paymentKey: urlParams.get("paymentKey"), orderId: urlParams.get("orderId"), amount: urlParams.get("amount"), }; const response = await fetch("/confirm", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(requestData), }); const json = await response.json(); if (!response.ok) { // TODO: 결제 실패 비즈니스 로직을 구현하세요. console.log(json); window.location.href = /fail?message=${json.message}&code=${json.code}; } // TODO: 결제 성공 비즈니스 로직을 구현하세요. console.log(json); } confirm(); const paymentKeyElement = document.getElementById("paymentKey"); const orderIdElement = document.getElementById("orderId"); const amountElement = document.getElementById("amount"); orderIdElement.textContent = "주문번호: " + urlParams.get("orderId"); amountElement.textContent = "결제 금액: " + urlParams.get("amount"); paymentKeyElement.textContent = "paymentKey: " + urlParams.get("paymentKey"); opener.parent.orderform_submit(urlParams.get("amount")); </script> 이 부분인가요?
Ayaan이안
Ayaan이안9mo ago
아니요 curl 보내는 부분입니다.
Kimoon Lee
Kimoon Lee9mo ago
const response = await fetch("/confirm", { 이부분에서 /confirm 을 호출하고 그 안에서 curl 로 승인 API 를 보내셔야 합니다. php 라면 이 샘플을 보세요.
Kimoon Lee
Kimoon Lee9mo ago
GitHub
payment-widget-sample/php at main · tosspayments/payment-widget-sam...
토스페이먼츠 결제위젯 샘플 프로젝트입니다. . Contribute to tosspayments/payment-widget-sample development by creating an account on GitHub.
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.

Did you find this page helpful?