Merchant Hosted Scheduler
Merchant Hosted Scheduler gives merchants full control over billing execution. The merchant manages customer payment tokens internally and triggers charges on demand by uploading a batch billing file to DOKU via SFTP. DOKU executes the charges and returns a consolidated result report.
Unlike DOKU Hosted Scheduler where DOKU manages the full schedule automatically, in this model the merchant owns the schedule — DOKU only executes the charge when the merchant submits a file.
Features & Benefits
🎛️ Full Scheduling Control
Merchants define exactly when charges are executed. Billing is triggered by file upload — not managed automatically by DOKU.
🗄️ Merchant-Managed Tokens
Customer payment tokens are obtained and stored by the merchant from a prior first payment. Tokens are reusable across billing cycles as long as the underlying payment method remains valid.
📁 Bulk Billing via SFTP
Process large volumes of charges simultaneously by uploading a structured .TXT billing file to the DOKU SFTP server. Each file is processed as a batch — one file can cover thousands of customers in a single operation.
📊 Consolidated Reporting
After each batch is processed, DOKU generates a result report with per-record outcomes — success, failure, and failure reason — placed in the SFTP outbound directory for merchant download and reconciliation.
Prerequisites
Before using Merchant Hosted Scheduler, the following must be in place:
How It Works
Step-by-Step Guide
First Payment: Obtain Customer Token
Before a customer can be included in any batch billing file, a token must be obtained for their payment method. A token is a secure reference to the customer's payment credential — it never exposes the raw card or bank account number.
How to get a token:
The customer completes a First Payment through one of the supported payment methods:
Credit Card / Debit Card → Direct API - Cards
Direct Debit (BRI, MANDIRI) → Direct API - Direct Debit
After the First Payment completes, call the Get Token List API to retrieve the token bound to that customer: → Get Token List API
Store the token in your system alongside the customer record. The token is bound to both the payment credential and the
customer_idused during the First Payment.
Token lifecycle:
Payment method is active
✅ Valid — reuse across billing cycles
No action
Card expired
❌ Invalid — token no longer usable
Initiate new First Payment with customer to obtain a new token
Card cancelled or blocked
❌ Invalid
Initiate new First Payment with customer
Charge failed due to insufficient funds
✅ Still valid
Retry with the same token in the next billing cycle
Prepare the Batch Billing File
Create the billing file in .TXT format. Each line in the file represents one charge record.
File Naming Convention
The filename must include the prefix TKN_. Files without this prefix will not be recognized and processed by DOKU.
Column Definition
BILLING REF / BILLING NUMBER
Alphanumeric
✅
128
Merchant's unique ID for this billing service record
DESCRIPTION
Alphanumeric
Optional
256
Billing description
INVOICE NUMBER
Alphanumeric
✅
64
Unique invoice number for this charge
CURRENCY
Alpha
✅
3
IDR only
AMOUNT
Number
✅
10,2
Charge amount. No decimal: 10000. With decimal: 10000.00
TOKEN
Number
✅
32
Customer payment token obtained from Get Token List API
CARD HOLDER NAME
Alphanumeric
Optional
128
Customer name
CARD HOLDER EMAIL
Alphanumeric
Optional
128
Customer email
CARD HOLDER PHONE
Number
Optional
32
Customer phone number
CARD HOLDER CITY
Alphanumeric
Optional
128
Customer city
CARD HOLDER REGION
Alphanumeric
Optional
128
Customer region/province
CARD HOLDER COUNTRY
Alpha
Optional
2
ISO country code — e.g., ID
CARD HOLDER ADDRESS
Alphanumeric
Optional
128
Customer street address
CARD HOLDER POSTAL CODE
Alphanumeric
Optional
16
Customer postal code
CARD HOLDER BIRTHDATE
Number
Optional
8
Customer birthdate in yyyyMMdd format
EXECUTE DATE
Number
Optional
8
Specific date to execute this charge in YYYYMMDD format. If omitted, DOKU executes the record immediately when the file is processed. Must not be a past date.
Trigger DOKU Processing (Optional)
After uploading the file, optionally call the Trigger Batch API to initiate processing immediately. Without this call, DOKU's internal scheduler will automatically pick up and process the file at its next polling interval.
Endpoint:
Method
POST
POST
URL
https://api-sandbox.doku.com/batch-upload/v1/notify
https://api.doku.com/batch-upload/v1/notify
Request Headers:
Client-Id
Client ID from DOKU Back Office
Request-Id
Unique random string, max 128 characters
Request-Timestamp
ISO 8601 UTC+0 format. For WIB (UTC+7), subtract 7 hours — e.g., 08:51 WIB = 2020-09-22T01:51:00Z
Signature
HMAC-SHA256 signature generated on merchant backend
Request Body:
file_name
String
✅
Exact filename as uploaded to the SFTP /download folder, including the TKN_ prefix and .TXT extension
Response Scenarios:
HTTP 201 — File accepted for processing.
DOKU has received the trigger and is processing the file. Monitor the SFTP /upload folder for the result report and wait for the DOKU notification callback.
HTTP 400 — Signature validation failed.
Resolution: Regenerate the Signature header using the correct HMAC-SHA256 algorithm and your Client-Secret. Verify Request-Timestamp is in ISO 8601 UTC+0 and within acceptable clock skew.
HTTP 400 — file_name is missing or empty.
Resolution: Include the file_name field in the request body with the exact filename of the uploaded file.
HTTP 400 — file_name has already been submitted.
Resolution: This filename has already been triggered for processing. Do not resubmit — the file is either already processing or has completed. Check the SFTP /upload folder for the result report. If you need to submit a new billing batch, use a different filename.
Receive DOKU Processing Notification
When DOKU finishes processing the batch file, it sends a notification to your configured merchant endpoint. This is the signal that the result report is ready to download.
DOKU sends a POST request to your notification URL with:
service.id
Always BATCH_UPLOAD for batch processing notifications
batch_file.name
The filename that was processed
batch_file.status
DONE — processing is complete. The result report is ready in the SFTP /upload folder
batch_file.date
Timestamp when processing completed, ISO 8601 UTC+0
Download and Reconcile the Report
After receiving the DOKU notification, download the result report from the SFTP /upload folder.
For the full report file structure, field definitions, and BANK CODE lookup table → Connectivity & File Security — Report File
Reconciliation triage — how to handle FAILED records:
Insufficient funds
FAILED + bank declined response code
Token is still valid — retry the customer in the next billing cycle file
Expired or invalid token
FAILED + token-related response code
Token is no longer usable — initiate a new First Payment with the customer to obtain a new token, then use the new token in the next cycle
Card blocked / stolen
FAILED + bank restriction response code
Contact customer for a new payment method — initiate new First Payment once resolved
Invalid execute date
FAILED + INVALID EXECUTE DATE
Correct the EXECUTE DATE in your next file — must not be a past date
Already paid
ALREADY_PAID
Send One Bill/Month is active and the customer was already charged this month — no action needed
Decryption failure
File in /upload/failed, no per-record report
Re-encrypt with the correct DOKU public key and re-upload with a new filename
Use Cases
Description
An insurance company collects quarterly premium payments from thousands of policyholders on the same date. Their policy management system manages all customer data and tokens internally.
Solution
On each quarterly billing date, the policy system generates a .TXT batch file with all active policyholder tokens and uploads to DOKU SFTP. DOKU processes all charges in one operation.
How It Works
System generates billing file → encrypt → upload to SFTP /download → Trigger API (optional) → DOKU processes charges → report in /upload → merchant downloads and reconciles
Features Used
Merchant Hosted Scheduler, SFTP Batch Processing, Consolidated Report
Description
A utility company bills customers on the 5th of each month with amounts that vary based on metered usage.
Solution
Each month, the billing system calculates per-customer usage, builds a .TXT file with dynamic AMOUNT per customer and EXECUTE DATE: 5th, and uploads via SFTP.
How It Works
Billing system calculates usage → builds file with per-record amounts → encrypt → upload → DOKU charges each customer at their calculated amount → report returned
Features Used
Merchant Hosted Scheduler, Dynamic Amount per Record, EXECUTE DATE
Merchant & Customer Experience
Merchant View
Manage customer tokens internally — obtain via First Payment, store per customer record
Prepare and upload batch
.TXTbilling file to SFTP/downloadfolder on each billing cycleOptionally call Trigger API to initiate immediate processing
Receive DOKU notification when report is ready
Download result report from SFTP
/uploadfolderTriage failed records: retry with same token (insufficient funds), or initiate new First Payment (expired/invalid token)
Customer View
Completes a First Payment once during onboarding to authorize recurring charges
Receives a payment success or failure notification after each charge attempt
If card expires: goes through checkout again for a new card — merchant handles the rest
Terms & Conditions
Merchants are responsible for securely storing and managing customer tokens
Batch files must use
TKN_prefix in filename and.TXTextension — files not matching this convention will not be processedEXECUTE DATEmust not be a past date — past dates generate per-record failures placed in/upload/failedSFTP access requires IP whitelisting — Connectivity & File Security
Raw card numbers must never appear in batch files — use DOKU-issued tokens only
FAQ
Last updated
Was this helpful?
