Skip to main content

credit-card-api-capture-auth-cap

After you get the payment.authorize_id, then your backend must trigger the API Charge to DOKU:

API Request

TypeValue
HTTP MethodPOST
API endpoint (Sandbox)https://api-sandbox.doku.com/credit-card/capture
API endpoint (Production)https://api.doku.com/credit-card/capture

Here is the sample of request header to capture the transaction:

Client-Id: MCH-0001-10791114622547
Request-Id: 071a6a32-6785-4011-833d-d2c2049cf744
Request-Timestamp: 2021-08-24T08:46:42Z
Signature: HMACSHA256=9UPUFzOqJc47aJzD9ESOTcWg6TMsg3mqSP+DnUO8ENE=
Request Header Explanation
ParameterDescription
Client-IdClient ID retrieved from DOKU Back Office
Request-IdUnique random string (max 128 characters) generated from merchant side to protect duplicate request
Request-TimestampTimestamp request on UTC time in ISO8601 UTC+0 format. It means to proceed transaction on UTC+7 (WIB), merchant need to subtract time with 7. Ex: to proceed transaction on September 22th 2020 at 08:51:00 WIB, the timestamp should be 2020-09-22T01:51:00Z
SignatureSecurity parameter that needs to be generated on merchant Backend and placed to the header request to ensure that the request is coming from valid merchant. Please refer to this section to generate the signature

Here is the sample request body to capture the transaction:

{
"payment": {
"authorize_id": "12312391719112",
"capture_amount": 90000
}
}
Request Body Explanation
ParameterTypeMandatoryDescription
payment.authorize_idstringMandatoryAuthorize ID from the Charge API Response / HTTP Notification
payment.capture_amountstringOptionalThe value of transactions which will be paid by the customer. If undefined, capture full transaction.

API Response

After hitting the above API request, DOKU will give the response.

TypeValue
HTTP Status200
ResultSUCCESS

Here is the sample response header:

Client-Id: MCH-0001-10791114622547
Request-Id: b266c265-3d61-4708-9860-c0d5b9a98f8c
Response-Timestamp: 2020-08-11T08:45:42Z
Signature: HMACSHA256=1jap2tpgvWt83tG4J7IhEwUrwmMt71OaIk0oL0e6sPM=
Response Header Explanation
ParameterDescription
Client-IdSame as the request
Request-IdSame as the request
Response-TimestampTimestamp Response on UTC with format ISO8601 UTC+0 from DOKU
SignatureSignature generated by DOKU based on the response body

Here is the sample of response body:

{
"order": {
"invoice_number": "INV-20210118-0001",
"amount": 90000
},
"customer": {
"id": "CUST-0001"
},
"payment": {
"type": "CAPTURE",
"identifier": [
{
"name": "Acquirer",
"value": "Mandiri"
},
{
"name": "MID",
"value": "71003372992"
},
{
"name": "TID",
"value": "73120903"
}
],
"request_id": "20201026193843836",
"authorize_id": "12312391719112",
"response_code": "01",
"response_message": "sukses transaksi",
"eci": "",
"status": "SUCCESS",
"approval_code": "123123"
},
"three_dsecure": {
"authentication_id": "eb7e72313b491cd73ea10c6354bc96900f08b3e50e66cf3df2fe29580d6ff84e"
},
"card": {
"masked": "557338*******101",
"type": "CREDIT",
"issuer": "Bank Mandiri",
"brand": "MASTER",
"token": "243591d7e49f45109961581718c3ef82"
}
}
Response Body Explanation
ParameterTypeMandatoryDescription
`order.invoice_numberstringMandatorySame as the request
order.amountnumberMandatorySame as the request
customer.idstringOptionalSame as the request
payment.typestringMandatorySame as the request
payment.identifier.namestringMandatoryAdditional payment info name
payment.identifier.valuestringMandatoryAdditional payment info value
payment.request_idstringMandatoryRequest ID sent on merchant's request header
payment.authorize_idstringMandatoryAuthorize ID for authorize transaction. Mandatory if payment.type is AUTHORIZE
payment.response_codestringMandatoryReponse code generated by DOKU / Acquirer
payment.response_messagestringMandatoryResponse message generated by DOKU / Acquirer
payment.statusstringMandatoryPayment status
Possible value: SUCCESS, FAILED, PENDING
payment.ecistringMandatoryECI for this transaction
payment.approval_codestringOptionalApproval code for success transaction generated by acquirer
three_dsecure.authentication_idstringMandatorySame as the request
card.maskedstringOptionalCard masked number
card.typestringMandatoryCard type
Possible value: CREDIT, DEBIT
card.issuerstringMandatoryCard issuer
card.brandstringMandatoryPrincipal brand
VISA, MASTER, JCB, AMEX
card.tokenstringOptionalCard token generated by DOKU if card.save is true