Libraries and SDK
We provide various code libraries to make your integration process easier. Simply download and see our documentation on how to implement them on your project.
SNAP SDK
Our new library provides access to the DOKU APIs and ensures compliance with the new Bank Indonesia (BI) regulations. These regulations, known as SNAP BI, standardize the API between Payment Service Providers (PSPs) to ensure secure and consistent payment processing. Compliance with these regulations is important for maintaining secure operations and meeting industry standards.
The SDK is designed to streamline the process of integrating with DOKU APIs. It does this by managing abstraction, taking care of the low-level details so that you don’t have to. As a result, you can focus on using the high-level functions available within the SDK. This not only simplifies the process but also significantly reduces the amount of work you need to do.
The current version of our SDK supports a variety of features, as listed below.
Virtual Account
DGPC
{beta}
Virtual Account
MGPC
{beta}
Virtual Account
DIPC
{beta}
Direct Debit
Account Binding
{beta}
Direct Debit
Jump App
{beta}
e-Wallet
Account Binding
{beta}
e-Wallet
Jump App
{beta}
DOKU SDK officially supports a variety of popular server-side programming languages.
Get Started
Key Decisions
Before integrating to DOKU, you need to consider a few things
Which payment methods will you use? As stated previously, DOKU SDK currently only supports Virtual Account, you can still integrate directly with our APIs to use additional channel offered by DOKU.
Which Virtual Account feature would fit your needs (DGPC, MGPC, or DIPC)? Refer to this documentation for a thorough explanation on the feature. Each transaction can use only one feature at a time, but you can use multiple features across different transactions.
Are you an existing DOKU merchants planning to use our SDK? If you’re an existing users, the SDK provides an additional tools for you to reduce your integration effort, check the notes section in the Integration checklist
Integration Checklist
Typically, the total integration time with DOKU ranges from one week to one quarter, depending on your resources, the complexity of the flow, and approval from the acquirer and government. The basic integration steps for new merchants are as follows (existing merchants can review a dedicated guide at the end of this section):
Onboarding During this stage,
Begin by creating an account on our Sandbox (for testing purposes) and Production (for real payments)
(Production) Submit your business information as part of the Know Your Business (KYB) process. While waiting for the verification process, you can start to integrate using your Sandbox credential
You'll also need to finalize key decisions regarding your integration as stated in the previous section.
Integration and Testing Integration with DOKU SDK for SNAP reduces the amount of effort you need to make on your side. The mechanism of the integration looks like this:
These are the general steps to get you up and running:
Obtain our credentials (Client ID and Secret Key) from the Integration > API Keys menu
Generate a public/ private key pair using SHA256 with 2048 bit length. You can use online tools such as this one. Save your private key and put your public key in the Integration > API Keys menu so that DOKU can validate your request.
Set up at least two endpoint for webhook (three if you're using DIPC), it will be used as:
Token request: DOKU will send a token request before sending Payment Notification and Inquiry Request (DIPC). Put your endpoint in the Integration > API Keys menu
Payment Notification: DOKU will send the payment notification to this URL at the event of successful payment by your customers. Put your endpoint the the Settings > {Payment Channel} menu, for example, you can put the payment notification endpoint in the Settings > Virtual Account > Configure menu.
(DIPC ONLY) Inquiry Request: DOKU will send payment inquiry to you at the event of customer initiating payment using the paycode you generated.
Install the SDK using the language's package manager, refer to our Official Repository
Depends of the feature you used (DGPC/ MGPC/ DIPC), you need to map the data into the required DTO
Once your data has been mapped into the DTO, you can call the function used (createVa, checkStatus, etc)
After payment, you need to prepare to handle notification. DOKU will send a token request. You can use the SDK's function to validate the signature and generate token for DOKU. Then, DOKU will send the payment notification with the token you generated. The SDK is equipped with a function to validate this token and generate the acknowledgement responses referring to this document.
Reporting: After testing, you'll move on to the reporting stage. It is required by Asosiasi Sistem Pembayaran Indonesia (ASPI) for each integration to be reviewed on their platform. What you have to do in this stage:
Register your account in ASPI Dev Portal
Select 'Request Aplikasi Pengajuan', then notify your business consultant
Select the API > 'Aplikasi Pengajuan' menu, then run the test.
Extract the required request and response according to the feature you used.
Submit the test result to DOKU.
Go-live: Once everything is set up and tested, you can go live with your integration and start receiving real payments just by switching the environment in your SDK and insert your Production credentials. If you're using MGPC or DIPC feature, remember to check whether your BIN has been activated or not.
Notes for existing DOKU users:
v1 merchants If your client ID looks something like ‘OCO-xxxx,’ then you are using our v1 APIs. All of our v1 merchants using the DIPC feature need to re-integrate with SNAP. This means DOKU will make an inquiry to your side if your customers initiate payment using the paycode you generated. We provide a converter function for you to implement, which means that the SDK will handle the conversion (FYI, we are using JSON, not XML. But the library will handle it all for you).
As a users using our v1 APIs, here’s what you need and don’t need to do:
Need to do:
Setup new endpoint to receive the token request from DOKU.
Use the SDK’s
generateToken
function, to generate the response needed by DOKU.Use the SDK’s converter function to automatically map the v1 parameter to/ from SNAP parameter, the function will also handle the xml to/ from json for you.
Don’t need to do:
Onboarding and Setup on DOKU side — DOKU will handle all of the items related to the migration process, ensuring you can use your existing client ID and other identifier with this new integration.
Rework your business logic — the SDK will handle to xml-json converter and parameter mapping for you, so the adjustment you need to do is only calling the converter function.
v2 merchants If you’ve integrated with DOKU and your client id looks something like ‘BRN-’ and ‘MCH-’ you’re using our v2 APIs. For the SNAP migration, you can refer to the general checklist above with a few notes on the items you need and don’t need to do:
Need to do:
Setup new endpoint to receive the token request from DOKU
Use the SDK’s
generateToken
function, to generate the response needed by DOKURemap the parameters into following SNAP specification
Don’t need to do:
Onboarding and Setup on DOKU side — DOKU will handle all of the items related to the migration process, ensuring you can use your existing client ID and other identifier with this new integration.
Last updated