DOKU Malaysia API Reference
Home
Products
Products
  • Checkout
  • Payment
  • Cards Payment
DOKU Docs
Home
Products
Products
  • Checkout
  • Payment
  • Cards Payment
DOKU Docs
  1. Signature - Cards Payment API
  • Introduction
  • Getting Started
    • Authentication & API Keys
    • Make your first API call
    • Create Account
  • Checkout
    • Overview
    • Create Checkout
    • Retrieve Checkout Status
  • Payment
    • Overview
    • Create Payment
    • Get Bank List - FPX
    • Retrieve Payment Status
  • Cards Payment
    • Overview
    • Payment Form
      • Request Payment
    • Host-to-Host Payment
      • Check Three D Secure
      • Charge Payment
      • Capture Authorized Payment
    • Request Refund
    • Unbind Token
    • Check Status
  • Notification
    • Overview
    • Setup Notification URL
    • Retry Notification
    • Sample Notification - Global
    • Sample Notification - Cards
  • Technical Reference
    • Authentication & Integrity
    • Idempotency
    • Data Type
    • Order & Transaction Status
    • Postman Collection
    • Response Code
      • Error Code
      • Credit Card Acquirer Response Code
    • API Version
      • Create Checkout
      • Create Payment
      • Get Bank List - FPX
      • Retrieve Checkout
      • Retrieve Payment
    • Signature
      • Signature - Global
        • Prepare Signature Component
        • Generating Signature
        • Validating Signature
        • Sample Code
      • Signature - Cards Payment API
        • Signature Component from Response Header
        • Signature from API Get Method
        • Sample Code
        • Signature Component from Request Header
  1. Signature - Cards Payment API

Signature Component from Request Header

Signature for Cards Payment
This type of signature is only for API under the Cards Payment, for other APIs please refer to the Signature - Global
To generate a Signature in request header, merchant need to prepare these components:

Component Explanation#

NoComponent NameDescription
1Client-idRetrieved from the Request Header
2Request-idRetrieved from the Request Header
3Request-TimestampRetrieved from the Request Header
4Request-TargetThe path of the endpoint that will be hitted e.g: /credit-card/v1/payment-page. NOTE: For the HTTP Notification from DOKU to merchant server, this will be the path of merchant Notification URL. As for the Inquiry Request, this will be the path of merchant Inquiry URL
5DigestEncoded (base64) value of hashed (SHA-256) JSON body. This component only applied for POST Method.

Preparation#

Before generating Signature, merchant need to prepare all the component required.
Set Client-Id, Request-Id, Request-Timestamp.
Use the Client-Id, Request-Id, Request-Timestamp that is placed on the Request Header.
Set Request-Target
The Request-Target is depending on who is sending the request:
1.
When merchant hits DOKU endpoints: The Request-Target is the path of the DOKU API that merchant hits.
For instance, if merchant wants to hit DOKU Cards API: https://api.doku.com//credit-card/v1/payment-page. Therefore, the Request-Target value is /credit-card/v1/payment-page.
2.
When DOKU hits merchant endpoints (HTTP Notification / Inquiry Request): The Request-Target is the path of merchant Notification URL or the Inquiry URL.
For instance, if merchant set the Notification URL: https://yourdomain.com/payments/notifications. Therefore, the Request-Target value is /payments/notifications.
Generate Digest
Digest is the hashed of the request body. To generate the Digest:
1.
Calculate SHA256 base64 hash from the JSON Body

Generating Signature#

After all the Signature component has been set, merchant can now generate it:
1.
Arrange the signature components to one component and its value per line by adding escape character. Don't add at the end of the string. Sample of the raw format:
This is how merchant see it:
2.
Calculate HMAC-SHA256 base64 from all the components above using the Secret Key from DOKU Back Office
3.
Put encoded value and prepend HMACSHA256= to the Signature. Sample:
Modified at 2026-08-31 09:26:51
Previous
Sample Code
Built with