Toss payments 개발자 커뮤니티Tp개커Toss payments 개발자 커뮤니티
Powered by
제이킹제
Toss payments 개발자 커뮤니티•4y ago•
15 replies
제이킹

토스페이먼츠 결제 취소 웹훅 관련 문의드립니다.

안녕하세요, 결제 취소 Webhook 관련 문의드립니다.

먼저 테스트 환경은 다음과 같습니다.
1. 테스트 Webhook
2. 라이브 Webhook

저희가 사용하고 있는 토스페이먼츠 Webhook Event 는 다음과 같습니다.
-
PAYMENT_STATUS_CHANGED
PAYMENT_STATUS_CHANGED


토스페이먼츠 공식 문서에 따르면,
PAYMENT_STATUS_CHANGED
PAYMENT_STATUS_CHANGED
Event 의 응답 객체는 아래와 같습니다.
https://docs.tosspayments.com/reference#payment-%EA%B0%9D%EC%B2%B4

문제는 저희 측에서 "토스페이먼츠 - 상점 - 결제 내역 - 결제취소" 를 진행하였을 때 전송된 Webhook 을 처리하는 과정에서 다음과 같은 에러가 발생합니다.
org.springframework.web.server.ServerWebInputException: 400 BAD_REQUEST “Failed to read HTTP message”; nested exception is org.springframework.core.codec.DecodingException: JSON decoding error: Instantiation of [simple type, class ....] value failed for JSON property version due to missing (therefore NULL) value for creator parameter version which is a non-nullable type; nested exception is com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class ....] value failed for JSON property version due to missing (therefore NULL) value for creator parameter version which is a non-nullable type
org.springframework.web.server.ServerWebInputException: 400 BAD_REQUEST “Failed to read HTTP message”; nested exception is org.springframework.core.codec.DecodingException: JSON decoding error: Instantiation of [simple type, class ....] value failed for JSON property version due to missing (therefore NULL) value for creator parameter version which is a non-nullable type; nested exception is com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class ....] value failed for JSON property version due to missing (therefore NULL) value for creator parameter version which is a non-nullable type

at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 1624] (through reference chain: ....TossWebhookPayload[“data”]->....[“version”])
at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 1624] (through reference chain: ....TossWebhookPayload[“data”]->....[“version”])


즉, 결제취소 시
PAYMENT_STATUS_CHANGED
PAYMENT_STATUS_CHANGED
Event 를 통해 받은 토스페이먼츠 Json 에
version
version
field 정보가 없어 Deserialize 에러가 발생하는데, 공식 문서에는
version
version
field 가 Notnull 로 명시 되어있습니다.
{
"data": {
    "mId": "tosspayments",
    "version": "2022-11-16", // Not null
{
"data": {
    "mId": "tosspayments",
    "version": "2022-11-16", // Not null


테스트 환경에서의 Webhook 테스트 시에는
version
version
field 가 담겨 정상적으로 응답하지만,
라이브 환경에서의 Webhook 테스트 시에는
version
version
field 가 담겨오지 않아 Decode 에러가 발생합니다.

정리하자면,
Webhook 의
PAYMENT_STATUS_CHANGED
PAYMENT_STATUS_CHANGED
Event 를 통한 응답객체의 데이터 중
version
version
field 가 문서에는 Notnull 이지만 Null로 들어와 Decode 에러가 발생합니다.
또한 동일한 조건에서, 테스트 Webhook 환경과 라이브 Webhook 환경의 결과가 다릅니다.
version field 의 index 가 우선이므로 에러는 해당 필드에서 발생하였지만 다음 field 에서의 동일한 문제가 발생할 가능성이 있습니다.

라이브 Webhook 환경에서, 공식문서에 기반한 응답값 체크확인 부탁드립니다.
코어 API | 토스페이먼츠 개발자센터
토스페이먼츠 API 엔드포인트(Endpoint)와 객체 정보, 파라미터, 요청 및 응답 예제를 살펴보세요.
코어 API | 토스페이먼츠 개발자센터
Toss payments 개발자 커뮤니티 banner
Toss payments 개발자 커뮤니티Join
Toss payments 개발자 커뮤니티입니다. 결제 연동하며 겪는 기술 문의부터, 결제 시장에 대한 다양한 정보까지 얻어가세요~
15,588Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

토스페이먼츠 웹훅 관련 문의드립니다
Deleted UserDDeleted User / ❓┃연동개발-문의
3y ago
결제 취소 관련 문의드립니다.
priPpri / ❓┃연동개발-문의
2y ago
가상계좌 결제 취소 웹훅 관련 문의
재영재재영 / ❓┃연동개발-문의
2y ago
토스페이먼츠 결제 취소
조세흠조조세흠 / ❓┃연동개발-문의
9mo ago