API Reference (NEW)
ID - Indonesia
  • ID - Indonesia
  • GL - Global
DashboardProduct Docs
Resources
  • Github
  • Demo Site
  • Simulator
DashboardProduct Docs
Resources
  • Github
  • Demo Site
  • Simulator
ID - Indonesia
  • ID - Indonesia
  • GL - Global
  1. Webhooks
  • Introduction
  • Getting Started
    • Create Account
    • Authentication & API Keys
    • Make your first API call
  • Checkout API
    • Build a Checkout Page
      • Checkout Display Type
      • Initiate Payment
    • Checkout Full Request
      • DOKU Checkout Full Request
  • Direct API
    • Cards
      • Payment Form
        • Generate Payment Page
        • Authorize Capture
        • Online Refund
      • Host-to-host Payment
        • Get Token List
        • Check 3D Secure
        • Charge
    • Bank Transfer
      • BCA Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • BNI Virtual Account
        • DOKU Generated Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generated Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • BRI Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • BNC Virtual Account
        • Merchant Generated Payment Code
          • DOKU Generate Payment Code
        • DOKU Generated Payment Code
          • Step 1 - Get Token
          • Step 2 - Create VA (DGPC)
        • Direct Inquiry
          • Step 1 - Get Token
          • Step 2 - Create VA (DGPC)
      • BSI Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Delete Payment Code
          • Update Payment Code
      • DANAMON Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • MANDIRI Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token Copy
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • MAYBANK Virtual Account
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • PERMATA Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • DOKU Generate Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Merchant Generate Payment
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • SINARMAS Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • DOKU Generate Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Merchant Generate Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • BJB Virtual Account
      • BPD Virtual Account
      • CIMB SNAP Virtual Account
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • BSS Virtual Account
        • Doku Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token Copy
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • BTN Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
      • DOKU Virtual Account
        • DOKU Generate Payment Code
          • Get Token
          • Create Payment Code
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code
        • Merchant Generate Payment Code
          • Get Token
          • Create Payment Code
          • Update Payment Code
          • Payment Notification
          • Delete Payment Code
        • Direct Inquiry
          • Direct Inquiry
          • Payment Notification
          • Update Payment Code
          • Delete Payment Code Copy
    • Convenience Store
      • Alfa Group
        • Alfa - Generate Payment Code
      • Indomaret
        • Indomaret - Generate Payment Code
    • e-Wallet
      • OVO
        • One Time Payment
          • OVO - Payment
          • OVO - Void
        • Account Binding
          • Account Binding
          • Balance Inquiry
          • Payment
          • Refund
          • Account Unbinding
      • ShopeePay
        • Payment
        • Refund
    • Direct Debit
      • CIMB Direct Debit
        • Account Binding
        • Payment
        • OTP Verification
        • Refund
        • Account Unbinding
      • ALLO BANK Direct Debit
        • Account Binding
        • Balance Inquiry
        • Payment
        • Refund
        • Account Unbinding
      • Mandiri Direct Debit
        • Card Binding
        • OTP Verification
        • Payment
        • Refund
        • Card Unbinding
      • BRI Direct Debit
        • Card Binding
        • OTP Verification
        • Payment
        • Refund
        • Card Unbinding
    • PayLater
      • Generate Order
      • Cancellation
      • Refund
    • Kartu Kredit Indonesia
      • Get Token B2B
      • Binding Only
      • Payment AFP with Binding
      • Payment AFP
      • Payment with token
      • Payment without AFP
      • Refund
      • Unbinding
    • Online Refund
      POST
  • Check Status API
    • Payment
      GET
  • Partner API
  • Biller API
  • Wallet Service API
  • Payout API
    • Sub Account API
      • Money In
        • Accept Payment
      • Money Out
      • Balance
  • Use Case Guides
  • Error Handling
    • Error Codes Glossary
  • FAQ / Troubleshooting
  • Change Log
    • ID - Indonesia Version
  • Archive
    • Get Token B2B
    • Get Token B2B2C
    • Step 1 - Account Binding
    • Step 2 - Balance Inquiry
    • Step 3 - Payment
    • Additional - Refund
    • Additional - Account Unbinding
    • Get Token B2B
    • Get Token B2B2C
    • Account Binding
    • Balance Inquiry
    • Payment
    • Refund
    • Account Unbinding
  • Delete Payment Code
    • Delete Payment Code
  • Technical Reference
    • Signature
    • Handling Idempotency
    • Postman Collection
  • Webhooks
    • Setup Notification URL
    • HTTP Notification Sample - SNAP
    • HTTP Notification Sample - non SNAP
    • Best Practice
    • Retry Notification
    • Override Notification URL
  1. Webhooks

Best Practice

Best Practice#

Handling HTTP Notification is crucial in order to make sure that your integration's business logic works as expected. Here are some best practices that you need to implement :

Handling Notification Implementation#

Acknowledge HTTP Notification immediately#

If your HTTP Notification endpoint performs complex logic, or makes network calls, it's possible that the endpoint would time out before DOKU sees its complete execution. Ideally, your HTTP Notification handler code (acknowledging receipt of an event by returning a 2xx status code) is separate of any other logic you do for that notification.

Verify HTTP Notification authenticity#

You must verify the HTTP Notification to make sure that it is coming from DOKU. To do that, you need to check the Signature on the Request Header that sent to you.
Before generating Signature, merchant need to prepare all the component required.
1. Set Client-Id, Request-Id, Request-Timestamp
Use the Client-Id, Request-Id, Request-Timestamp that is placed on the Request Header.
2. Set Request-Target
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.
3. Generate Digest
Digest is the hashed of the request body. To generate the Digest:
Calculate SHA256 base64 hash from the JSON Body
4. Generating Signature
After all the Signature component has been set, merchant can now generate it:
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 :
Calculate HMAC-SHA256 base64 from all the components above using the Secret Key from DOKU Back Office
Put encoded value and prepend HMACSHA256= to the Signature. Sample:

Update the transaction status based on the transaction.status#

All of the notifications that we send always have transaction.status parameter. The possible value is SUCCESS or FAILED. Update the transaction status on your side based on this value.
CHECKOUT IMPLEMENTATION
Checkout User Experience is designed to increase your payment success rate, meaning that it allows your customers to change payment method if one is failed. Therefore, if you are integrating with Checkout, you must ignore the transaction.status FAILED.

Handle duplicate events#

HTTP Notification endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events you've processed, and then not processing already-logged events.

Parse HTTP Notification in non-strict format​#

DOKU sends the notification body as JSON, please parse the JSON with a JSON parser. Always expect new fields will be added to the notification body, so parse it in a non strict format. This prevents the parser from throwing an exception for new fields. It should gracefully ignore the new fields. This allows us to extend our notification system for newer use cases without breaking old clients.
Modified at 2025-08-15 08:49:44
Previous
HTTP Notification Sample - non SNAP
Next
Retry Notification
Built with