smooth
TPToss payments 개발자 커뮤니티
•Created by smooth on 3/27/2024 in #❓┃연동개발-문의
'결제하기' 혹은 'Registration' 클릭시 콘솔 로그에 결제수단이 아직 선택되지 않았다는 오류가 나옵니다.
비슷한것 같은데
메뉴얼에 있던 아래 부분 코드가 없습니다.
// ------ 결제 UI 렌더링 ------
// ------ 이용약관 UI 렌더링 ------
// ------ 결제 금액 업데이트 ------
말씀해주신대로 render 한 widget 과 requestpayment를 실행하는 widget 의 코드가 분리되어 그런것 같습니다.
한번 확인해보겠습니다!
16 replies
TPToss payments 개발자 커뮤니티
•Created by smooth on 3/27/2024 in #❓┃연동개발-문의
'결제하기' 혹은 'Registration' 클릭시 콘솔 로그에 결제수단이 아직 선택되지 않았다는 오류가 나옵니다.
버튼 클릭시 이렇게 호출하고 있습니다.
// TOSS Setting START
const amount = "<%=amount%>";
const widgetClientKey = "<%=widgetClientKey %>";
const customerKey = generateRandomString();
const variantKey = "<%=variantKey%>";
const orderName = "<%=orderName%>";
const successUrl = "<%=successUrl%>";
const failUrl = "<%=failUrl%>";
const customerEmail = "<%=customerEmail%>";
const customerName = "<%=customerName%>";
const customerMobilePhone = "<%=customerMobilePhone%>";
const paymentWidget = PaymentWidget(widgetClientKey, customerKey); // 회원 결제
// const paymentWidget = PaymentWidget(widgetClientKey, PaymentWidget.ANONYMOUS); // 비회원 결제
// ------ 결제 UI 렌더링 ------
paymentMethodWidget = paymentWidget.renderPaymentMethods(
"#payment-method",
{ value: amount },
// 렌더링하고 싶은 결제 UI의 variantKey
// 결제 수단 및 스타일이 다른 멀티 UI를 직접 만들고 싶다면 계약이 필요해요.
// @docs https://docs.tosspayments.com/guides/payment-widget/admin#멀티-결제-ui
{ variantKey: variantKey }
);
// ------ 이용약관 UI 렌더링 ------
paymentWidget.renderAgreement("#agreement", { variantKey: variantKey });
/*
// ------ 결제 금액 업데이트 ------
coupon.addEventListener("change", function () {
if(coupon.checked)
{
paymentMethodWidget.updateAmount(amount - 5000);
}
else
{
paymentMethodWidget.updateAmount(amount);
}
});
*/
// ------ '결제하기' 버튼 누르면 결제창 띄우기 ------
paymentWidget.requestPayment({
orderId: customerKey,
orderName: orderName,
successUrl: successUrl,
failUrl: failUrl,
customerEmail: customerEmail,
customerName: customerName,
customerMobilePhone: customerMobilePhone
});
16 replies
TPToss payments 개발자 커뮤니티
•Created by smooth on 3/27/2024 in #❓┃연동개발-문의
'결제하기' 혹은 'Registration' 클릭시 콘솔 로그에 결제수단이 아직 선택되지 않았다는 오류가 나옵니다.
토스페이먼츠 BOT이 제안한 '정보 제출'을 통하여 사이트 및 계정 정보 공유드렸습니다.
16 replies