Skip to main content

Payment Cancellation

This API performs full or partial cancellation of a completed transaction.

Note
  • This API is provided for PG payment services.
  • For Escrow transactions, please refer to the Escrow Status Change guide.

Request

Request URL
POST https://{API Domain}/easypay/payment/cancel.do
Content-type: application/json; charset=euc-kr
Note

Supports API Idempotency (See API Idempotency)

Critical: Timeout Handling
  • Since the final cancellation process takes time, you must set the timeout to 30 seconds.
  • If you do not receive a response due to a timeout or network error, you MUST check the status via the Query Transaction Status API using the pgCno and retry the cancellation if necessary.

Parameters

Field NameTypeLengthRequiredDescription
mallIdString8ByteMerchant ID assigned by KICC
shopTransactionIdString60ByteMerchant Transaction ID (API Idempotency Key)
shopOrderNoString40ByteMerchant Order No. used in the approval request
pgCnoString20ByteOriginal PG Transaction ID
cancelTxtypeString2ByteCancel Type
Full Cancel: “40”
Partial Cancel: “32”
amountNumberCancel Request Amount
remainAmountNumberRemaining Amount (For balance verification)
comTaxAmtNumberTaxable Amount (For complex tax partial cancel)
comFreeAmtNumberTax-free Amount (For complex tax partial cancel)
comVatAmtNumberVAT Amount (For complex tax partial cancel)
msgAuthValueString200ByteMessage Integrity Verification Value (See Message Authentication)
cancelReqDateString8ByteCancel Request Date (yyyyMMdd)
Request Example
{  
"mallId": "{Merchant ID}",
"shopTransactionId": "{API Idempotency Key}",
"pgCno": "{Original PG Transaction ID}",
"cancelTxtype": "40",
"cancelReqDate": "{Request Date}",
"msgAuthValue": "{Message Auth Value}"
}

Response

Parameters

Field NameTypeLengthRequiredDescription
resCdString4ByteResult Code (Success: “0000”)
resMsgString1000ByteResult Message
shopTransactionIdString60ByteReturns the value sent in the request
mallIdString8ByteMerchant ID assigned by KICC
oriPgCnoString20ByteOriginal PG Transaction ID
cancelPgCnoString20ByteNew Cancel PG Transaction ID
shopOrderNoString40ByteMerchant Order No.
cancelAmountNumberCanceled Amount
remainAmountNumberRemaining Balance after cancellation
transactionDateString14ByteTransaction Date (yyyyMMddHHmmss)
statusCodeString4ByteTransaction Status Code (See Status Code)
statusMessageString50ByteTransaction Status Message
paymentInfoArrayCancellation Details by Payment Method (See paymentInfo below)

paymentInfo (Cancellation Details)

Field NameTypeLengthRequiredDescription
payMethodTypeCodeString2BytePayment Method Code (See PayMethod Code)
cancelAmountNumberCanceled Amount
remainAmountNumberRemaining Balance (Returned if requested)
couponAmountNumberInstant Discount Cancel Amount
cashReceiptInfoObjectCash Receipt Cancel Info (See cashReceiptInfo below)

cashReceiptInfo (Cash Receipt Cancel Info)

Field NameTypeLengthRequiredDescription
resCdString4ByteResult Code
resMsgString1000ByteResult Message
approvalNoString50ByteCancel Approval Number
cancelDateString14ByteCancel Date (yyyyMMddHHmmss)
Response Example
{
"resCd": "0000",
"resMsg": "Cancel Success",
"mallId": "{Merchant ID}",
"shopTransactionId": "{API Idempotency Key}",
"oriPgCno": "{Original PG Transaction ID}",
"cancelPgCno": "{Cancel PG Transaction ID}",
"shopOrderNo": "{Merchant Order No}",
"cancelAmount": "51004",
"remainAmount": "0",
"transactionDate": "20210326090200",
"statusCode": "TS02",
"statusMessage": "Approval Cancelled",
"paymentInfo": [
{
"payMethodTypeCode": "11",
"cancelAmount": 5100
}
]
}

Message Authentication Value

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

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