PAYCO Approval API (Deferred Capture)
A PAYCO digital wallet approval API that processes authentication and capture separately. When authentication completes on the PAYCO checkout (outStatCd = 0061), your server calls this API to request approval.
Test Key Information
Important Notes
Deferred Capture Method
You must use the merchant order number (mchtTrdNo) created during the authentication request, and authTrdNo must be the transaction number (trdNo) received upon successful authentication.
- Use this API only when the checkout was called with a deferred capture merchant ID (test:
nx_mid_hd). - If the checkout returns
outStatCd=0061(authentication success), the payment is not complete yet. Request approval with this API to complete the payment. - This is a Non-UI API called from your server, without the standard checkout.
Payment Flow
- Call the PAYCO checkout (deferred capture merchant ID)
- Customer completes authentication →
outStatCd=0061andtrdNoare delivered tonextUrl - Your server calls the PAYCO Approval API (
authTrdNo=trdNofrom step 2) - The payment is complete when the approval result is
outStatCd=0021
API Information
POST/spay/APITrdPayco.do
Content-Type
application/jsonSandbox
https://tbgw.settlebank.co.kr/spay/APITrdPayco.doProduction
https://gw.settlebank.co.kr/spay/APITrdPayco.doRequest Parameters
Type Notation
NNumericAAlphabeticHKoreanANAlphanumericAHNAlphanumeric + Koreane.g. AN(10) = alphanumeric, up to 10 bytes
params Object
└mchtIdAN(12)Alphanumeric, up to 12 bytes*Unique merchant ID issued by Hecto Financial
Unique merchant ID issued by Hecto Financial
└verAN(4)Alphanumeric, up to 4 bytes*Message version
Message version
*Fixed value
└methodA(2)Alphabetic, up to 2 bytes*Payment method
Payment method
*Fixed value
└bizTypeAN(2)Alphanumeric, up to 2 bytes*Business type code
Business type code
*Fixed value (for approval)
└encCdN(2)Numeric, up to 2 bytes*Encryption type code
Encryption type code
*Fixed value
└mchtTrdNoAN(100)Alphanumeric, up to 100 bytes*Merchant order number (must be the one created for the authentication request)
Merchant order number (must be the one created for the authentication request)
└trdDtN(8)Numeric, up to 8 bytes*Request date (YYYYMMDD)
Request date (YYYYMMDD)
└trdTmN(6)Numeric, up to 6 bytes*Request time (HHMMSS)
Request time (HHMMSS)
└mobileYnA(1)Alphabetic, up to 1 bytesMobile flag
Mobile flag
Y: Mobile web/app N: PC or other└osTypeA(1)Alphabetic, up to 1 bytesOS type
OS type
A: Android I: IOS W: Windows M: Mac E: Other Blank: Unknowndata Object
└pktHashAN(200)Alphanumeric, up to 200 bytes*
SHA-256Hash value generated using SHA256(auto-generated)Hash value generated using SHA256
NOTE
Hash combination
trdDt + trdTm + mchtId + mchtTrdNo + trdAmt (plaintext) + hashKey
└authTrdNoAN(40)Alphanumeric, up to 40 bytes*Authentication transaction number (trdNo received on successful authentication)
Authentication transaction number (trdNo received on successful authentication)
└trdAmtN(12)Numeric, up to 12 bytes*
AES-256AES-256/ECB/PKCS5Padding + Base64Transaction amountTransaction amount
Response Parameters
Type Notation
NNumericAAlphabeticHKoreanANAlphanumericAHNAlphanumeric + Koreane.g. AN(10) = alphanumeric, up to 10 bytes
params Object
└mchtIdAN(12)Alphanumeric, up to 12 bytes*Unique merchant ID issued by Hecto Financial
nx_mid_hdUnique merchant ID issued by Hecto Financial
└verAN(4)Alphanumeric, up to 4 bytesMessage version
0A19Message version
*Fixed value
└methodA(2)Alphabetic, up to 2 bytesPayment method
PZPayment method
*Fixed value
└bizTypeAN(2)Alphanumeric, up to 2 bytesBusiness type code
B2Business type code
*Fixed value
└encCdN(2)Numeric, up to 2 bytes*Encryption type code
23Encryption type code
*Fixed value
└mchtTrdNoAN(100)Alphanumeric, up to 100 bytes*Merchant order number
ORDER20230323100000Merchant order number
└trdNoAN(40)Alphanumeric, up to 40 bytes*Unique transaction number issued by Hecto Financial
STFP_PGPZnx_mid_hd0230315153232M1196602Unique transaction number issued by Hecto Financial
└trdDtN(8)Numeric, up to 8 bytes*Request date (YYYYMMDD)
20230323Request date (YYYYMMDD)
└trdTmN(6)Numeric, up to 6 bytes*Request time (HHMMSS)
100000Request time (HHMMSS)
└outStatCdAN(4)Alphanumeric, up to 4 bytes*Transaction status code
0021Transaction status code
0021: Success 0031: Failure└outRsltCdAN(4)Alphanumeric, up to 4 bytes*Result code. Detailed code returned when the status is '0031'
0000Result code. Detailed code returned when the status is '0031'
*See the rejection code table
└outRsltMsgAHN(200)Alphanumeric + Korean, up to 200 bytes*Result message (URL encoded, UTF-8)
Processed successfully.Result message (URL encoded, UTF-8)
data Object
└pktHashAN(64)Alphanumeric, up to 64 bytes*Returns the hash value sent in the request
Returns the hash value sent in the request
└authTrdNoAN(40)Alphanumeric, up to 40 bytesAuthentication transaction number (trdNo received on successful authentication)
STFP_PGPZnx_mid_hd0230315153232M1196602Authentication transaction number (trdNo received on successful authentication)
└trdAmtN(12)Numeric, up to 12 bytes*
AES-256AES-256/ECB/PKCS5PaddingTransaction amount1000Transaction amount
*Certain response fields are AES-256 encrypted. Decrypt them before use.
Webhook (Payment Result)
When approval completes, Hecto Financial sends a webhook to your server.
NOTE
Webhook reference
For PAYCO payment result webhook parameters and processing method, see the Webhook document.
Request Example
{
"params": {
"mchtId": "nx_mid_hd",
"ver": "0A19",
"method": "PZ",
"bizType": "B2",
"encCd": "23",
"mchtTrdNo": "ORDER20230323100000",
"trdDt": "20230323",
"trdTm": "100000",
"mobileYn": "N",
"osType": "W"
},
"data": {
"pktHash": "af8c82f79a5722fffcce52323dc1859844cafa577232b3ab94535b0f469077c9",
"authTrdNo": "STFP_PGPZnx_mid_hd0230315153232M1196602",
"trdAmt": "AES_ENCRYPTED_AMOUNT"
}
}
Response Example
Success Response
{
"params": {
"mchtId": "nx_mid_hd",
"ver": "0A19",
"method": "PZ",
"bizType": "B2",
"encCd": "23",
"mchtTrdNo": "ORDER20230323100000",
"trdNo": "STFP_PGPZnx_mid_hd0230315153232M1196602",
"trdDt": "20230323",
"trdTm": "100000",
"outStatCd": "0021",
"outRsltCd": "0000",
"outRsltMsg": "Processed successfully."
},
"data": {
"pktHash": "af8c82f79a5722fffcce52323dc1859844cafa577232b3ab94535b0f469077c9",
"authTrdNo": "STFP_PGPZnx_mid_hd0230315153232M1196602",
"trdAmt": "AES_ENCRYPTED_AMOUNT"
}
}
Failure Response
{
"params": {
"mchtId": "nx_mid_hd",
"ver": "0A19",
"method": "PZ",
"bizType": "B2",
"encCd": "23",
"mchtTrdNo": "ORDER20230323100000",
"trdNo": "",
"trdDt": "20230323",
"trdTm": "100000",
"outStatCd": "0031",
"outRsltCd": "1901",
"outRsltMsg": "Hash value mismatch"
},
"data": {
"pktHash": "af8c82f79a5722fffcce52323dc1859844cafa577232b3ab94535b0f469077c9"
}
}
For the full list of rejection codes, see PG Response Codes.
