본문 바로가기

개발이야기

Idempotency (멱등성)

반응형

한국의 일반적인 경우는 동일한 결제 요청이 두번 들어오면  이중 결제가 발생 하거나 
혹은 기 결제 건으로 실패 응답을 주는 경우가 많은데요. 

알리페이나 구글 같은 외국 회사들은 유일한 requestId  값을 이용해서 이미 처리된 건의 재요청은  
이전과 동일한 응답을 주도록 하고 있네요.

구글의 standard-payments api 문서 중 

https://developers.google.com/standard-payments/

 

Introduction  |  Standard Payments API  |  Google Developers

This service describes the Google Standard Payments API.

developers.google.com

Idempotency

All method calls within this API must have idempotent behavior. Simply put, integrators should not attempt to reprocess any request already successfully processed; the response for the successful processing should be reported instead. All methods have a common RequestHeader which contains a requestId. This requestId is the idempotency key for all calls.

For any non terminal answer (a non HTTP 200), it must not be idempotently processed. So a request that previously got a 400, when called a second time must not idempotently return 400, it must be re-evalutated. At re-evaluation, it could return a 400 or be processed successfully.

반응형

'개발이야기' 카테고리의 다른 글

PGP sign and encrypt  (0) 2019.05.16
Web-Safe Base64-Encoding  (0) 2019.05.15
구글 io 요약  (0) 2019.05.08
assertThat 이 편해 assertEquals 가 편해 ?  (0) 2019.04.24
hibernate.dialect auto dectection  (0) 2019.03.29