wzw
wzw4w ago

在支付时发生了错误

选择好付款方式后,点击付款没有任何反应,并且开发者工具中一直报错误。这个要怎么办呢
No description
40 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
wzw
wzwOP4w ago
help me
Kimoon Lee
Kimoon Lee4w ago
Do you rendering the agreements?
유부장
유부장4w ago
what is the server dev language that you are using? we will provide sample for your ref
wzw
wzwOP4w ago
php,wordpress I'm very sorry, I don't understand what you mean. I'm testing the payment, but there is no feedback or jump when I click the button.
Ayaan
Ayaan4w ago
You can translate the error message with Google Translate It says: Cannot find the element that has the selector given. Check selector again
wzw
wzwOP4w ago
I consulted the official staff of tosspayments and they told me to come here for help because they don't understand technical development. Please help me. Yes, I did this, and it reported an error saying that the selector element was not found, but I clearly found the element, and I don't understand why. And this problem doesn't seem to be the main reason why it can't make payments. I use other payment gateway platforms, they all have technical support, but this platform doesn't seem to have it. I am not proficient in technology, thank you!!
Ayaan
Ayaan4w ago
we also provide the technical support, but we actually having difficulty with supporting you. Can you check, which selector did you passed on renderPaymentMethod function? After that, share it here, and also check if there is the paymentwidget element that has the selector you passed
wzw
wzwOP4w ago
Is this the problem? I checked again and found that there is no such class name in the HTML, but I don't know what this class represents? What content does it get? And how can I adjust it to the correct one?
wzw
wzwOP4w ago
No description
wzw
wzwOP4w ago
Sorry, it was my first day using this app and I was very unskilled and didn’t reply to your comment.
Ayaan
Ayaan4w ago
You have to pass the CSS Selector into renderPaymentMethods, it seems like that is the problem. Thanks
wzw
wzwOP4w ago
It specifies this ID
Ayaan
Ayaan4w ago
Please search Google and some public resources to how to handle HTML DOM elements on Javascript with QuerySelector. This will help you to solve it. Simply, you just create <div> tag with id or class attribute. For example, <div id="payment-methods"></div> And, pass the CSS selector of that div, #payment-methods into renderPaymentMethods() function like this: .... = paymentWidget.renderPaymentMethods("#payment-methods") Then refresh the page. Then, it should surprisingly loads payment widget into the div tag that you provided.
wzw
wzwOP4w ago
No description
wzw
wzwOP4w ago
No description
Ayaan
Ayaan4w ago
please ensure you don't call renderPaymentMethods more than once in the page. because it seems like you have 2 renderPaymentMethods function calls in the page. If you already rendered the page like this, You don't need to call it again, just use it
wzw
wzwOP4w ago
You know like a god what is wrong with me right now, because it still reports the error, and it seems to be what you said.
wzw
wzwOP4w ago
No description
wzw
wzwOP4w ago
No description
Ayaan
Ayaan4w ago
Yup, It seems like you calling renderPaymentMethods twice, in different js file or js function. It should not be happened. Please ensure you don't call renderPaymentMethods twice, and share the paymentMethodWidget instance with other functions. So,
wzw
wzwOP4w ago
This is the second position, it seems to just call the defined method.
Ayaan
Ayaan4w ago
Nope underneath let price = ...., you are calling renderPaymentMethods again! This where the error comes from. Remove const paymentMethodsWidget = paymentWidget.renderPaymentMethods(); on that function. And try again. It should refer this paymentMethodsWidget instance, and it is expected to be work.
wzw
wzwOP4w ago
You are awesome! That error has gone away, only this one remains. I saw you mentioned this method function.
wzw
wzwOP4w ago
No description
Ayaan
Ayaan4w ago
When this error comes? Does it happen after you click the button, right?
wzw
wzwOP4w ago
Now it is. The previous bug is gone and I am so excited. Yes!
Ayaan
Ayaan4w ago
Please put this function after This script tag I really suggest you to search some Google and MDN website because it is too basic error. If you want to access a specific object inside a function, the function must be declared after the object is declared. Now that I look at it, it looks like the function is declared before the execution of renderPaymentMethods. That won't work.
wzw
wzwOP4w ago
This payment.php file was sent to my colleague by tosspayments. It can run normally just by replacing the Key. These errors occurred when no content was modified, only the website was moved and the theme was changed.
Ayaan
Ayaan4w ago
Those two function is declared on the same file?
wzw
wzwOP4w ago
No description
wzw
wzwOP4w ago
Yes
Ayaan
Ayaan4w ago
Can you just follow this? I think this will solve the issue
Ayaan
Ayaan4w ago
Integrate Payment Widgets | 토스페이먼츠 개발자센터
The Toss Payments Widget is a low code solution that only needs to be integrated once for all payment types and customization features.
Ayaan
Ayaan4w ago
This is also the document that you can refer it
wzw
wzwOP4w ago
After the error occurred, I re-downloaded the original payment.php file to overwrite it, replaced the company's Key, and the error still existed.
Ayaan
Ayaan4w ago
I think the payment.php file has the error
wzw
wzwOP4w ago
I will try it immediately!
Ayaan
Ayaan4w ago
. .
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.