JasperTran
JasperTran2y ago

Error {codeINVALID_REQUEST,message필수 파라미터가 누락되었습니다. (LGD_RESPCODE)}

Hello, I'm Khiem from Vietnam, I'm developer, I'm trying to build a service in Korean and need the payment. I have an issue while using:
button.addEventListener('click', function () {
tossPayments.requestPayment('카드', {
amount: 15000,
orderId: 'Noz4ablB94pV49KtDN7Un',
orderName: '토스 티셔츠 외 2건',
customerName: '박토스',
successUrl: 'http://localhost:8080/success',
failUrl: 'http://localhost:8080/fail',
})
})
button.addEventListener('click', function () {
tossPayments.requestPayment('카드', {
amount: 15000,
orderId: 'Noz4ablB94pV49KtDN7Un',
orderName: '토스 티셔츠 외 2건',
customerName: '박토스',
successUrl: 'http://localhost:8080/success',
failUrl: 'http://localhost:8080/fail',
})
})
I received the message at the end of payment progress. Could someone help me out? Thanks
35 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
이실장
이실장2y ago
Hi. What message did you get? You are using same orderId everytime. Orderid should be unique in every payment. So please use unique orderid that doesnt overlap with past orderid Also you can see our docs in English. You can use chrome translae function
Kimoon Lee
Kimoon Lee2y ago
Also could you share the paymentkey that you got the error? It seems you got the error when you called the approval API with the paymentkey
JasperTran
JasperTran2y ago
this is what I'm using
No description
이실장
이실장2y ago
orderId should not static string It has to be changed before you submit
JasperTran
JasperTran2y ago
yes this is just testing another question, should I use the real card?
이실장
이실장2y ago
You are using 2-factor authentic payments. In Korea we are using card app (ex samsung card app) to pay and it has to registate real card in card app. Do you have company or service in Vietnam? Or trying to lauch brand new service in Korea?
JasperTran
JasperTran2y ago
I'm a single developer in Viet Nam, work for Korean startup at the beginning I just want to make it simple, and the html above I think it works but maybe because I don't have any card, I will try with Korean card
이실장
이실장2y ago
Did you get this popup?
No description
JasperTran
JasperTran2y ago
yes I did
이실장
이실장2y ago
Then you need real card to test
JasperTran
JasperTran2y ago
ok I'm asking some colleagues from Korean could you show me which payment method can be test, because my colleague said they won't navigate to their card app
JasperTran
JasperTran2y ago
No description
JasperTran
JasperTran2y ago
we all received this screen they already use the real card and this error is the same as me
이실장
이실장2y ago
That is not our error code Can you check right before scene that you receive message? I think it happened becuase you didnt register appscheme in info.plist to open 3rd part app(card app) Is it developed by swift(native app) or hybrid app (such as flutter or RN)
Ayaan
Ayaan2y ago
@JasperTran First: Card problem: Do you have a VISA card? Or do you only have a NAPAS card? We do not support Napas cards. Only Korean domestic cards and overseas VISA, MasterCard, and UnionPay cards are supported. Second: Error in App things: Please do not use Webview with inline html Please make a web server using express.js or koa.js, and load it. The request is being made using an inline script and the callback URL is localhost:8080. This mean is localhost and port 8080 on the PHONE. But phone can not run web server, so you received this screen. Therefore, it is not recommended to use WebView with inline HTML attributes. Please create your own web server using the node.js web server module. Is it make sense? If you have more question, Please leave message here. Toss Team and I will response for you.
JasperTran
JasperTran2y ago
I think the problem is the second thing that you mentioned, I'm currently using webview with inline html and callback url is local host. But what if I use the real api for callback url, can I keep using webview?
이실장
이실장2y ago
Please tell the programming language that you used
JasperTran
JasperTran2y ago
I'm currently using React Native
이실장
이실장2y ago
plz give me the image of the screen. Right before you get the error mesage in above img
JasperTran
JasperTran2y ago
이실장
이실장2y ago
The reason of the error page is that your success/fail URL is not accessible. Please set your success/fail Url is accessible in your test environment. Also before the error scene 3rd party card app should open, but nothing happened in your app. plz tell your Korean colleague to contact us to hear the explaination about test environment.
JasperTran
JasperTran2y ago
I already try with real success/fail URL (not localhost anymore) and with real master credit card, it works with request success URL including orderId, paymentKey and amount. So I can use the webview with inline html?
이실장
이실장2y ago
yes
tripleable-yumin
같이 일하는 백엔드 개발자입니다. 혹시 어떤 게 필요한지 설명을 부탁드려도 될까요?
Kimoon Lee
Kimoon Lee2y ago
successURL 로 orderId, paymentKey and amount 이 정보를 넘겨드리는데요 백엔드에서 승인 API 를 호출해 주시면 됩니다.
Kimoon Lee
Kimoon Lee2y ago
코어 API | 토스페이먼츠 개발자센터
토스페이먼츠 API 엔드포인트(Endpoint)와 객체 정보, 파라미터, 요청 및 응답 예제를 살펴보세요.
이실장
이실장2y ago
@tripleable-yumin 현재 카드사 앱도 잘 호출되는지도 확인 한번 부탁드려요! 위에 영상으로는 카드사앱도 호출이 안되는 것 같아서요 ~
tripleable-yumin
혹시 successURL이 API url인걸까요? 그렇다면 request method는 어떻게 되나요?
Kimoon Lee
Kimoon Lee2y ago
SuccessURL 은 저희 결제창을 Javascript 에서 호출할때 가맹점에서 설정하시는 값으로 인증이 되고 나면 저희가 redirect해드리는 가맹점 URL 입니다.
Ayaan
Ayaan2y ago
yes u can but not recommend @tripleable-yumin 위쪽 답변에 첨언해드리자면, inline으로 호출해도 되나 추천드리진 않습니다. so you should input successURL and failURL is real URL. 그래서 이 URL들은 실제 접속이 가능한 주소여야 합니다. Could you check if the payment is successful when you run the URL defined in WebView directly in the mobile browser? WebView에 정의한 URL을 모바일 브라우저에서 직접 실행했을 때 정상 결제되는지 확인해 주시겠어요?
tripleable-yumin
혹시 successURL을 앱 서버 RestAPI url로 해도 상관없나요? Toss에서 인증되면 앱 서버로 바로 가고, 서버에서 처리를 한 뒤 바로 토스로 결제 승인 요청을 보내는 방법이 가능할까요?
Kimoon Lee
Kimoon Lee2y ago
SuccessURL 은 고객의 브라우저에서 이동하는 것이라서 앱 서버 RestAPI url 로 하시면 결제는 되겠지만 결제 결과를 고객에서 FE 에서 보여주실수 없을겁니다. 그래서 webURL 을 SuccessURL 로 해주시고, 그 web URL 내에서 server to server 로 저희 승인 API 를 호출해주신후 그 결과를 렌더링해서 고객에게 보여주셔야 합니다.
JasperTran
JasperTran2y ago
in mobile, I can catch the successURL and then navigate user to another screen for showing success message the Toss payment web view completely in the app, we don't use the browser
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.