Toss Payment API confirm always response error result
After i make payment successfully, i was redirected to successful url attached in request. Then i call confirm api it always returned response error:
1. The 400 status code error
{
"code": "ALREADY_PROCESSED_PAYMENT",
"message": "이미 처리된 결제 입니다."
}
2. The 500
{
"code": "FAILED_PAYMENT_INTERNAL_SYSTEM_PROCESSING",
"message": "[S021] 이미 사용된 주문번호입니다. 새로운 주문번호로 결제를 시도해 주십시요."
}
35 Replies
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) :
- 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요.
* 주말/공휴일에는 답변이 늦을 수 있어요.
This error occurs when an payment request is made again for an order that has already been approved.
So please check it was already completed
i dont see any orders approved
The flow is that i create payment through toss api with secret key -> The api response checkout url -> then i make payment on that checkout url -> redirected to url success -> confirm -> error
Could you check what was the value of confirmationMethod when you create the payment?
you mean method? i passed it 'CARD'
whats wrong here
no I mean "confirmationMethod"
here r what i passed
i just pass fields mentioned on docs
Could you check the payment key when you call confirm API?
yes i have already checked it
{
"code": "ALREADY_PROCESSED_PAYMENT",
"message": "이미 처리된 결제 입니다."
}
i dont know why the payment proccessed while i never authorized it
Please let us know paymentKey of request that you have faced error
so wait for me a minute
tviva20240821112846DcZt9
Oh you are using the publically shared key from docs, is it?
no i have individual account
what is the MID that provided from Tosspayments? (Contract Merchant ID)
i just use this and pass sk in header from server's request
like this code
I recommend you as below
* Please use more complex orderId value for your test. Your orderId seems too simple.
* There are several key type,
and you are using api key pair that provided when you just register your accout at tosspayments.com.
this key is sharing the resource with other public test env resource.
* You may have dedicated merchant ID (MID) when you completed contract with Tosspayments. We recommend you to use MID's api key pair.
hmmm
currently, i just test toss api for server
so dont have MID apikey pair now
ok, then please change orderId value (not simple one) and try again
for the testing purpose,
I am utilizing the orderId generate logic as below
var orderId = new Date().getTime();
so the reason for this error is about orderId ?
lemme check
card method amount need to be more than 100 KRW
: D
okay
Now its forbiddened
when i made payment by vise, it redirected me to successful url, but i cant confirm that payment
visa
"mId": "tvivarepublica",
"lastTransactionKey": "6A42E59A88C4B044B2D9568CE4576460",
"paymentKey": "tviva20240821121215vzcX3",
"orderId": "order-12312432sfdjdfh",
"orderName": "hello world 166",
"taxExemptionAmount": 0,
"status": "IN_PROGRESS",
"requestedAt": "2024-08-21T12:12:15+09:00",
Look at this, the status is in "IN_PROGRESS" but i cant confirm through api
I have already tested this on toss web
i guess the test key not support visa oversea? right. I cant found this information from anywhere in doc
I have checked logs,
You have tried confirmation API parameter as below
{"orderId":"order-order-12312432sfdjdfh","paymentKey":"tviva20240821121215vzcX3","amount":1000}
your payment request orderId should be
"orderId":"order-12312432sfdjdfh"
orderId of request payment and confirmaion is different.
that is the reason why you received error
Oh that is my mistake, sorry. Thanks all guys
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.