Skip to main content

Cancel Payment

This API is used to fully or partially cancel a completed transaction.

Note

For cancelling Escrow approval transactions, please refer to Escrow Status Change.

Request

Request URL
POST https://{API Domain}/api/trades/revise
Content-type: application/json; charset=utf-8
Note

Supports API Idempotency (See API Idempotency)

Caution

Since final cancellation takes time, you must set the timeout to 30 seconds.

Parameters

Field NameTypeLengthRequiredDescription
mallIdString8ByteMerchant ID assigned by KICC
shopTransactionIdString60ByteMerchant Transaction ID (API Idempotency Key)
pgCnoString20ByteOriginal PG Transaction ID
reviseTypeCodeString2ByteChange Type Code
amountNumberCancellation Amount. Required for Partial Cancellation.
remainAmountNumberRemaining Amount. Used for validation during Partial Cancellation.
clientIpString20ByteRequestor IP
clientIdString32ByteRequestor ID (Merchant Admin Login ID)
cancelReqDateString8ByteCancellation Request Date (yyyyMMdd). Must use the current date.
msgAuthValueString200ByteMessage Integrity Verification Value (See Message Authentication)
Contact sales for the Secret Key.
reviseMessageString100ByteReason for Cancellation
refundQueryFlagString1ByteRefund Result Query Flag ('Y': Query).
Required in case of timeout. Retry if response is "VTIM" or "VT00".
taxInfoObjectComplex Tax Info (Required if using Complex Tax)
See taxInfo below
basketUsedString1ByteSplit Settlement Basket Used (Y/N)
basketInfoObjectBasket Info (Required if using Split Settlement)
See basketInfo below

taxInfo (Complex Tax Info)

Field NameTypeLengthRequiredDescription
taxationAmountNumberCancelled Taxable Amount
taxFreeAmountNumberCancelled Tax-free Amount
vatAmountNumberCancelled VAT Amount

basketInfo (Basket Info for Split Settlement)

Field NameTypeLengthRequiredDescription
productPgCnoString20ByteIndividual Product PG Transaction ID
sellerIdString50ByteSeller ID
Request Example
{  
"mallId": "{Merchant ID}",
"shopTransactionId": "{API Idempotency Key}",
"pgCno": "{Original PG Transaction ID}",
"reviseTypeCode": "40",
"cancelReqDate": "{Current Date}",
"msgAuthValue": "{Message Auth Value}",
"reviseMessage": "Customer Changed Mind"
}

Response

Parameters

Field NameTypeLengthRequiredDescription
resCdString4ByteResponse Code (Success: “0000”)
resMsgString1000ByteResponse Message
shopTransactionIdString60ByteReturns the value sent in the request
mallIdString8ByteMerchant ID assigned by KICC
oriPgCnoString20ByteOriginal Payment PG Transaction ID
cancelPgCnoString20ByteCancellation PG Transaction ID
cancelAmountNumberCanceled Amount
remainAmountNumberRemaining Balance (Returned if requested)
transactionDateString14ByteTransaction Date/Time (yyyyMMddHHmmss)
statusCodeString4ByteTransaction Status Code (See Status Codes)
statusMessageString50ByteTransaction Status Message
escrowUsedString1ByteEscrow Usage (Y/N)
multiCardAmountString12BytePayco Card Cancellation Amount
multiPntAmountString12BytePayco Point Cancellation Amount
multiCponAmountString12BytePayco Coupon Cancellation Amount
reviseInfoObjectCancellation Response Info
See reviseInfo below

reviseInfo (Cancellation Response Info)

Field NameTypeLengthRequiredDescription
payMethodTypeCodeString2BytePayment Method Code (See Codes)
approvalNoString50ByteApproval Number
approvalDateString14ByteCancellation Date/Time (yyyyMMddHHmmss)
cardInfoObjectCredit Card Cancellation Details
See cardInfo below
cashReceiptInfoObjectCash Receipt Cancellation Details
See cashReceiptInfo below

reviseInfo > cardInfo (Credit Card Cancel Details)

Field NameTypeLengthRequiredDescription
couponAmountNumberCancelled Instant Discount Amount

reviseInfo > cashReceiptInfo (Cash Receipt Cancel Details)

Field NameTypeLengthRequiredDescription
resCdString4ByteResponse Code
resMsgString1000ByteResponse Message
approvalNoString50ByteCancellation Approval Number
cancelDateString14ByteCancellation Date/Time (yyyyMMddHHmmss)
Response Example
{
"resCd": "0000",
"resMsg": "Cancellation Successful",
"mallId": "{Requested Merchant ID}",
"shopTransactionId": "{Requested API Idempotency Key}",
"oriPgCno": "{Original PG Transaction ID}",
"cancelPgCno": "{Cancellation PG Transaction ID}",
"shopOrderNo": "{Merchant Order No}",
"cancelAmount": "51004",
"remainAmount": "0",
"transactionDate": "20210326090200",
"statusCode": "TS02",
"statusMessage": "Approval Cancelled",
"reviseInfo": {
"payMethodTypeCode": "11",
"approvalNo": "00017177",
"approvalDate": "20210326090200",
"cardInfo": {
"couponAmount": 0
}
}
}

Change Type Codes (reviseTypeCode)

CodeService NameDescription
20CaptureManual Capture processing for authorized transactions
32Partial CancelPartial cancellation for Credit Card (including Simple Pay)
33Partial CancelPartial cancellation for Bank Transfer, Mobile Payment
40Full CancelFull cancellation of approved transactions (including Virtual Account issuance cancellation)
51Cash Receipt CancelCancellation of standalone Cash Receipt transaction
52Cash Receipt PartialPartial cancellation of standalone Cash Receipt transaction

Message Authentication Value

The Message Authentication Value is constructed by combining the fields below and hashing the result using HmacSHA256. (See Message Authentication)

pgCno(PG Transaction ID) + “|” + shopTransactionId(Merchant Transaction ID)