### Example Redirect URL
Source: https://docs.duitku.com/api/id
This is an example of a GET request URL used for redirecting customers back to the merchant's site after a transaction. It includes parameters like merchantOrderId, resultCode, and reference.
```http
GET: http://www.merchantweb.com/redirect.php?merchantOrderId=abcde12345&resultCode=00&reference=DXXXXCX80TXXX5Q70QCI
```
--------------------------------
### PHP Transaction Request Example
Source: https://docs.duitku.com/api/id
This PHP script demonstrates how to construct and send an HTTP POST request to the Duitku API for transaction inquiry. It includes setting up merchant and payment details, customer information, item details, and generating the required HMAC SHA256 signature. Use the sandbox URL for testing and the production URL for live transactions.
```php
$firstName,
'lastName' => $lastName,
'address' => $alamat,
'city' => $city,
'postalCode' => $postalCode,
'phone' => $phoneNumber,
'countryCode' => $countryCode
);
$customerDetail = array(
'firstName' => $firstName,
'lastName' => $lastName,
'email' => $email,
'phoneNumber' => $phoneNumber,
'billingAddress' => $address,
'shippingAddress' => $address
);
$item1 = array(
'name' => 'Test Item 1',
'price' => 10000,
'quantity' => 1);
$item2 = array(
'name' => 'Test Item 2',
'price' => 30000,
'quantity' => 3);
$itemDetails = array(
$item1, $item2
);
/*Khusus untuk metode pembayaran OL dan SL
$accountLink = array (
'credentialCode' => '7cXXXXX-XXXX-XXXX-9XXX-944XXXXXXX8',
'ovo' => array (
'paymentDetails' => array (
0 => array (
'paymentType' => 'CASH',
'amount' => 40000,
),
),
),
'shopee' => array (
'useCoin' => false,
'promoId' => '',
),
);*/
/*Khusus untuk metode pembayaran Kartu Kredit
$creditCardDetail = array (
'acquirer' => '014',
'binWhitelist' => array (
'014',
'400000'
)
);*/
$params = array(
'merchantCode' => $merchantCode,
'paymentAmount' => $paymentAmount,
'paymentMethod' => $paymentMethod,
'merchantOrderId' => $merchantOrderId,
'productDetails' => $productDetails,
'additionalParam' => $additionalParam,
'merchantUserInfo' => $merchantUserInfo,
'customerVaName' => $customerVaName,
'email' => $email,
'phoneNumber' => $phoneNumber,
//'accountLink' => $accountLink,
//'creditCardDetail' => $creditCardDetail,
'itemDetails' => $itemDetails,
'customerDetail' => $customerDetail,
'callbackUrl' => $callbackUrl,
'returnUrl' => $returnUrl,
'signature' => $signature,
'expiryPeriod' => $expiryPeriod
);
$params_string = json_encode($params);
//echo $params_string;
$url = 'https://sandbox.duitku.com/webapi/api/merchant/v2/inquiry'; // Sandbox
// $url = 'https://passport.duitku.com/webapi/api/merchant/v2/inquiry'; // Production
$ch = curl_init();
```
--------------------------------
### Get Payment Method Request (PHP)
Source: https://docs.duitku.com/api/id
This PHP script demonstrates how to construct and send a request to the Get Payment Method API. It includes generating the HMAC SHA256 signature required for authentication and handling the JSON response.
```php
$merchantCode,
'amount' => $paymentAmount,
'datetime' => $datetime,
'signature' => $signature
);
$params_string = json_encode($params);
$url = 'https://sandbox.duitku.com/webapi/api/merchant/paymentmethod/getpaymentmethod';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($params_string))
);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//execute post
$request = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpCode == 200)
{
$results = json_decode($request, true);
print_r($results, false);
}
else{
$request = json_decode($request);
$error_message = "Server Error " . $httpCode ." ". $request->Message;
echo $error_message;
}
?>
```
--------------------------------
### Callback Parameters
Source: https://docs.duitku.com/api/id
This section outlines the parameters sent by Duitku via HTTP POST callback to notify merchants about transaction results. It includes details on each parameter's purpose, format, and example values.
```APIDOC
## Callback Parameters
### Description
This endpoint details the parameters received via callback from the Duitku API, used to confirm transaction status and details. The callback is sent using the HTTP POST method with `x-www-form-urlencoded` content type.
### Method
HTTP POST
### Endpoint
Callback URL (provided by merchant)
### Parameters
#### Form Parameters
- **merchantCode** (string) - Required - Kode merchant, dikirimkan oleh server Duitku untuk memberitahu kode proyek yang digunakan. Example: `DXXXX`
- **amount** (string) - Required - Jumlah nominal transaksi. Example: `150000`
- **merchantOrderId** (string) - Required - Nomor transaksi dari merchant. Example: `abcde12345`
- **productDetail** (string) - Optional - Keterangan detail produk. Example: `Pembayaran untuk Toko Contoh`
- **additionalParam** (string) - Optional - Parameter tambahan yang anda kirimkan pada saat awal request transaksi.
- **paymentCode** (string) - Required - Metode Pembayaran. Example: `VC`
- **resultCode** (string) - Required - Pemberitahuan callback hasil transaksi. `00` for Success, `01` for Failed. Example: `00`
- **merchantUserId** (string) - Optional - Username atau email pelanggan di situs Anda. Example: `test@example.com`
- **reference** (string) - Required - Nomor referensi transaksi dari Duitku. Mohon disimpan untuk keperluan pencatatan atau pelacakan transaksi. Example: `DXXXXCX80TXXX5Q70QCI`
- **signature** (string) - Required - Kode identifikasi transaksi. Berisikan parameter keamanan sebagai acuan bahwa request yang diterima berasal dari server Duitku. Signature dihasilkan menggunakan metode HMAC SHA256. Formula: `stringToSign = merchantcode + amount + merchantOrderId`, `signature = HMAC_SHA256(stringToSign, apiKey)`. Example: `d842db69f70501fe69487b3d957611c2d4e47335f390a5895b0a762a1bf1f1a0`
- **publisherOrderId** (string) - Required - Nomor unik pembayaran transaksi dari Duitku. Mohon disimpan untuk keperluan pencatatan atau pelacakan transaksi. Example: `MGUHWKJX3M1KMSQN5`
- **spUserHash** (string) - Optional - Di kirim melalui callback jika pembayaran menggunakan metode pembayaran ShopeePay (QRIS, App, dan Account Link). Jika berisi string dengan kombinasi angka dan huruf, maka menandakan pembayaran menggunakan Shopee itu sendiri.
- **settlementDate** (string) - Optional - Informasi waktu estimasi penyelesaian. Format: `YYYY-MM-DD`. Example: `2023-07-25`
- **issuerCode** (string) - Optional - Informasi kode issuer dari QRIS. Example: `93600523`
- **customerName** (string) - Optional - Pengidentifikasi akun issuer QRIS. Tergantung pada issuer-nya, nilainya dapat berupa nama akun atau nomor telepon. Nilai yang dikembalikan mungkin sebagian disembunyikan. Example: `Bam**** Maul***`
### Note
Metode `signature` sebelumnya yang menggunakan MD5 sudah usang (obsolete).
```
--------------------------------
### HTTP POST Get Payment Method
Source: https://docs.duitku.com/api/id
This endpoint retrieves a list of active payment methods available for your merchant account. It returns details such as the payment method name, associated fees, and a URL to the payment method's image.
```APIDOC
## POST /webapi/api/merchant/paymentmethod/getpaymentmethod
### Description
Retrieves a list of active payment methods available for your merchant account, including their names, fees, and image URLs.
### Method
POST
### Endpoint
`https://sandbox.duitku.com/webapi/api/merchant/paymentmethod/getpaymentmethod` (Development)
`https://passport.duitku.com/webapi/api/merchant/paymentmethod/getpaymentmethod` (Production)
### Parameters
#### Request Body
- **merchantcode** (string) - Required - Your merchant code from Duitku.
- **amount** (integer) - Required - The transaction amount. Should not contain decimal points or digits.
- **datetime** (date) - Required - The transaction date and time in `yyyy-MM-dd HH:mm:ss` format.
- **signature** (string) - Required - Generated using HMAC SHA256 with your API key. Formula: `HMAC_SHA256(merchantcode + amount + datetime, apiKey)`.
### Request Example
```json
{
"merchantcode": "DXXXX",
"amount": "10000",
"datetime": "2022-01-25 16:23:08",
"signature": "497fbf783f6d17d4b1e1ef468917bdc8"
}
```
### Response
#### Success Response (200)
- **paymentFee** (array) - Contains a list of payment methods.
- **paymentMethod** (string) - The identifier for the payment method.
- **paymentName** (string) - The display name of the payment method.
- **paymentImage** (string) - URL to the payment method's image.
- **totalFee** (string) - The total fee for the payment method.
- **responseCode** (string) - The response code indicating success or failure.
- **responseMessage** (string) - A message describing the response.
#### Response Example
```json
{
"paymentFee": [
{
"paymentMethod": "VA",
"paymentName": "MAYBANK VA",
"paymentImage": "https://images.duitku.com/hotlink-ok/VA.PNG",
"totalFee": "0"
},
{
"paymentMethod": "BT",
"paymentName": "PERMATA VA",
"paymentImage": "https://images.duitku.com/hotlink-ok/PERMATA.PNG",
"totalFee": "0"
}
],
"responseCode": "00",
"responseMessage": "SUCCESS"
}
```
```
--------------------------------
### Get Payment Method Response Structure
Source: https://docs.duitku.com/api/id
This JSON object represents the successful response from the Get Payment Method API. It contains an array of payment fees, each detailing the payment method, name, image URL, and total fee.
```json
{
"paymentFee": [
{
"paymentMethod": "VA",
"paymentName": "MAYBANK VA",
"paymentImage": "https://images.duitku.com/hotlink-ok/VA.PNG",
"totalFee": "0"
},
{
"paymentMethod": "BT",
"paymentName": "PERMATA VA",
"paymentImage": "https://images.duitku.com/hotlink-ok/PERMATA.PNG",
"totalFee": "0"
},
],
"responseCode": "00",
"responseMessage": "SUCCESS"
}
```
--------------------------------
### Get Payment Method Request (cURL)
Source: https://docs.duitku.com/api/id
Use this cURL command to send a POST request to the Get Payment Method API endpoint. Ensure you replace placeholder values with your actual merchant code, amount, and generated signature.
```curl
curl -X POST https://sandbox.duitku.com/webapi/api/merchant/paymentmethod/getpaymentmethod
-H "Content-Type: application/json"
-d "{
\"merchantcode\": \"DXXXX\",
\"amount\": \"10000\",
\"datetime\": \"2022-01-25 16:23:08\",
\"signature\": \"497fbf783f6d17d4b1e1ef468917bdc8\"
}"
```
--------------------------------
### Shopee Payment Details Object
Source: https://docs.duitku.com/api/id
Defines Shopee payment parameters, including promo IDs and whether to use Shopee coins. Use coins only for SL payment methods.
```json
"shopee": {
"promo_ids": "",
"useCoin": false
}
```
--------------------------------
### Account Link Object
Source: https://docs.duitku.com/api/id
Contains specific parameters for payment methods like OVO Account Link and Shopee Account Link. Includes credential code and method-specific details.
```json
"accountLink": {
"credentialCode": "A0F22572-4AF1-E111-812C-B01224449936",
"ovo": {
"paymentDetails": [{
"paymentType": "CASH",
"amount": "10000"
}]
},
"shopee": {
"useCoin": false,
"promoId": ""
}
}
```
--------------------------------
### Item Details Object
Source: https://docs.duitku.com/api/id
Defines the items included in a purchase. Ensure the total price of all items matches the payment amount.
```json
"itemDetails": [
{
"price": 50000,
"quantity": 2,
"name": "Apel"
}
]
```
--------------------------------
### Customer Detail Object
Source: https://docs.duitku.com/api/id
Provides information about the customer making the purchase, including contact and address details. Both billing and shipping addresses are optional.
```json
"customerDetail": {
"firstName": "John",
"lastName": "Doe",
"email": "pelanggan_anda@email.com",
"phoneNumber": "08123456789",
"billingAddress": {
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
},
"shippingAddress": {
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
}
}
```
--------------------------------
### Customer Detail
Source: https://docs.duitku.com/api/id
Contains information about the customer, including their name, contact details, and billing/shipping addresses.
```APIDOC
## Customer Detail
### Description
Contains information about the customer, including their name, contact details, and billing/shipping addresses.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **firstName** (string(255)) - Optional - Nama pertama pelanggan.
- **lastName** (string(255)) - Optional - Nama belakang pelanggan.
- **email** (string(255)) - Optional - Email pelanggan.
- **phoneNumber** (string(255)) - Optional - Nomor telepon pelanggan.
- **billingAddress** (Address) - Optional - Alamat tagihan pelanggan.
- **shippingAddress** (Address) - Optional - Alamat pengiriman pelanggan.
### Request Example
```json
{
"customerDetail": {
"firstName": "John",
"lastName": "Doe",
"email": "pelanggan_anda@email.com",
"phoneNumber": "08123456789",
"billingAddress": {
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
},
"shippingAddress": {
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
}
}
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### POST /webapi/api/merchant/v2/inquiry
Source: https://docs.duitku.com/api/id
Initiates a transaction inquiry with Duitku, allowing merchants to process payments.
```APIDOC
## POST /webapi/api/merchant/v2/inquiry
### Description
Initiates a transaction inquiry with Duitku, allowing merchants to process payments. This endpoint is used to create a new transaction and obtain payment details.
### Method
POST
### Endpoint
https://sandbox.duitku.com/webapi/api/merchant/v2/inquiry
### Parameters
#### Request Body
- **merchantCode** (string(50)) - Required - Kode _merchant_, adalah kode proyek untuk bertransaksi.
- **paymentAmount** (integer) - Required - Jumlah nominal transaksi.
- **merchantOrderId** (string(50)) - Required - Nomor transaksi dari _merchant_.
- **productDetails** (string(255)) - Required - Keterangan produk/jasa yang diperjual belikan.
- **email** (string(255)) - Required - Alamat _email_ pelanggan anda.
- **paymentMethod** (string(2)) - Required - Kode metode pembayaran yang digunakan.
- **customerVaName** (string(20)) - Required - Nama yang akan muncul pada halaman konfirmasi pembayaran bank.
- **returnUrl** (string(255)) - Required - Tautan untuk mengarahkan setelah transaksi selesai atau dibatalkan.
- **callbackUrl** (string(255)) - Required - Tautan untuk _callback_ transaksi.
- **signature** (string(255)) - Required - Kode identifikasi transaksi. Formula: `stringToSign = merchantCode + merchantOrderId + paymentAmount`, `signature = HMAC_SHA256(stringToSign, apiKey)`.
- **additionalParam** (string(255)) - Optional - Parameter tambahan (opsional).
- **merchantUserInfo** (string(255)) - Optional - _Username_ atau _email_ pelanggan di situs _merchant_ (opsional).
- **phoneNumber** (string(50)) - Optional - Nomor telepon pelanggan (opsional).
- **itemDetails** (ItemDetails) - Optional - Detail barang (opsional).
- **customerDetail** (CustomerDetail) - Optional - Detail pelanggan.
- **expiryPeriod** (int) - Optional - Masa berlaku transaksi sebelum kedaluwarsa. Berbentuk satuan angka dalam menit.
- **accountLink** (AccountLink) - Optional - Detail parameter untuk metode pembayaran accountlink (opsional).
- **creditCardDetail** (creditCardDetail) - Optional - Detail parameter untuk pembayaran kartu kredit (opsional).
### Request Example
```json
{
"merchantCode":"DXXXX",
"paymentAmount":40000,
"paymentMethod":"VC",
"merchantOrderId":"abcde12345",
"productDetails":"Pembayaran untuk Toko Contoh",
"additionalParam":"",
"merchantUserInfo":"",
"customerVaName":"John Doe",
"email":"test@test.com",
"phoneNumber":"08123456789",
"itemDetails":[
{
"name":"Test Item 1",
"price":10000,
"quantity":1
},
{
"name":"Test Item 2",
"price":30000,
"quantity":3
}
],
"customerDetail":{
"firstName":"John",
"lastName":"Doe",
"email":"test@test.com",
"phoneNumber":"08123456789",
"billingAddress":{
"firstName":"John",
"lastName":"Doe",
"address":"Jl. Kembangan Raya",
"city":"Jakarta",
"postalCode":"11530",
"phone":"08123456789",
"countryCode":"ID"
},
"shippingAddress":{
"firstName":"John",
"lastName":"Doe",
"address":"Jl. Kembangan Raya",
"city":"Jakarta",
"postalCode":"11530",
"phone":"08123456789",
"countryCode":"ID"
}
},
"callbackUrl":"http:\/\/example.com\/callback",
"returnUrl":"http:\/\/example.com\/return",
"signature":"d842db69f70501fe69487b3d957611c2d4e47335f390a5895b0a762a1bf1f1a0",
"expiryPeriod":10
}
```
### Response
#### Success Response (200)
- **field1** (type) - Description
#### Response Example
```json
{
"example": "response body"
}
```
```
--------------------------------
### Transaction Inquiry Request
Source: https://docs.duitku.com/api/id
Use this cURL command to send a POST request for transaction inquiry to the Duitku sandbox API. Ensure all parameters, including the signature, are correctly formatted.
```bash
curl --location --request POST 'https://sandbox.duitku.com/webapi/api/merchant/v2/inquiry' \
--header 'Content-Type: application/json' \
--data
'{
"merchantCode":"DXXXX",
"paymentAmount":40000,
"paymentMethod":"VC",
"merchantOrderId":"abcde12345",
"productDetails":"Pembayaran untuk Toko Contoh",
"additionalParam":"",
"merchantUserInfo":"",
"customerVaName":"John Doe",
"email":"test@test.com",
"phoneNumber":"08123456789",
"itemDetails":[
{
"name":"Test Item 1",
"price":10000,
"quantity":1
},
{
"name":"Test Item 2",
"price":30000,
"quantity":3
}
],
"customerDetail":{
"firstName":"John",
"lastName":"Doe",
"email":"test@test.com",
"phoneNumber":"08123456789",
"billingAddress":{
"firstName":"John",
"lastName":"Doe",
"address":"Jl. Kembangan Raya",
"city":"Jakarta",
"postalCode":"11530",
"phone":"08123456789",
"countryCode":"ID"
},
"shippingAddress":{
"firstName":"John",
"lastName":"Doe",
"address":"Jl. Kembangan Raya",
"city":"Jakarta",
"postalCode":"11530",
"phone":"08123456789",
"countryCode":"ID"
}
},
"callbackUrl":"http:\/\/example.com\/callback",
"returnUrl":"http:\/\/example.com\/return",
"signature":"d842db69f70501fe69487b3d957611c2d4e47335f390a5895b0a762a1bf1f1a0",
"expiryPeriod":10
}'
```
--------------------------------
### Credit Card Detail Object
Source: https://docs.duitku.com/api/id
Optional parameters for credit card transactions, allowing specification of acquirer and whitelisting of card BINs. Supports up to 25 BINs.
```json
"creditCardDetail": {
"acquirer":"014",
"binWhitelist":["014","022", "400000"]
}
```
--------------------------------
### Shopee Detail
Source: https://docs.duitku.com/api/id
Parameters for Shopee payment requests, including promo codes and coin usage.
```APIDOC
## Shopee Detail
### Description
Parameters for Shopee payment requests, including promo codes and coin usage.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **promo_ids** (string(50)) - Required - Kode voucher.
- **useCoin** (boolean) - Required - Jika pembayaran ingin menggunakan koin shopee dari akun shopee yang terhubung (Khusus payment method SL).
### Request Example
```json
{
"shopee": {
"promo_ids": "campaign111",
"useCoin": false
}
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### Ovo Detail
Source: https://docs.duitku.com/api/id
Parameters for OVO payment requests.
```APIDOC
## Ovo Detail
### Description
Parameters for OVO payment requests.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **paymentDetails** (array object) - Required - Parameter untuk request pembayaran OVO.
- **paymentType** (string(10)) - Required - Tipe pembayaran yang dilakukan.
- **amount** (int) - Required - Jumlah nominal transaksi.
### Request Example
```json
{
"ovo": {
"paymentDetails": [
{
"paymentType": "CASH",
"amount": "10000"
}
]
}
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### Item Details
Source: https://docs.duitku.com/api/id
Represents the details of items being purchased, including their name, quantity, and price. The sum of prices must match the total payment amount.
```APIDOC
## Item Details
### Description
Represents the details of items being purchased, including their name, quantity, and price. The sum of prices must match the total payment amount.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **name** (string(255)) - Required - Nama barang yang dibeli.
- **quantity** (integer) - Required - Jumlah barang dibeli.
- **price** (integer) - Required - Harga barang. Catatan: Jangan tambahkan desimal.
### Request Example
```json
{
"itemDetails": [
{
"price": 50000,
"quantity": 2,
"name": "Apel"
}
]
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### Credit Card Detail
Source: https://docs.duitku.com/api/id
Optional additional parameters for credit card transactions, allowing acquirer specification and BIN whitelisting.
```APIDOC
## Credit Card Detail
### Description
Optional additional parameters for credit card transactions, allowing acquirer specification and BIN whitelisting.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **acquirer** (string(3)) - Optional - Anda dapat menentukan acquirer bank yang akan digunakan pada transaksi yang akan dilakukan. • `014` untuk BCA. • `022` untuk CIMB.
- **binWhitelist** (array string(6)) - Optional - Parameter untuk membatasi kartu kredit yang diizinkan pada transaksi. Menggunakan kode bank(3 digit) atau nomor bin kartu kredit(6 digit). Maksimal 25 list bin.
### Request Example
```json
{
"creditCardDetail": {
"acquirer": "014",
"binWhitelist": ["014","022", "400000"]
}
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### OVO Payment Details Object
Source: https://docs.duitku.com/api/id
Specifies payment details for OVO transactions. Requires payment type and amount.
```json
"ovo": {
"paymentDetails": [
{
"paymentType": "CASH",
"amount": "10000"
}
]
}
```
--------------------------------
### Address Object
Source: https://docs.duitku.com/api/id
Represents a physical address, used for both billing and shipping. Ensure all required fields are populated.
```json
{
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
}
```
--------------------------------
### Account Link
Source: https://docs.duitku.com/api/id
Special parameters for payment methods using OVO Account Link and Shopee Account Link.
```APIDOC
## Account Link
### Description
Special parameters for payment methods using OVO Account Link and Shopee Account Link.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **credentialCode** (string(50)) - Required - Kode kredensial dari Duitku.
- **ovo** (OVO) - Required - Wajib untuk pembayaran melalui OVO.
- **shopee** (Shopee) - Required - Wajib untuk pembayaran melalui Shopee.
### Request Example
```json
{
"accountLink": {
"credentialCode": "A0F22572-4AF1-E111-812C-B01224449936",
"ovo": {
"paymentDetails": [
{
"paymentType": "CASH",
"amount": "10000"
}
]
},
"shopee": {
"useCoin": false,
"promoId": ""
}
}
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### PHP cURL Transaction Request
Source: https://docs.duitku.com/api/id
This snippet demonstrates how to set up and execute a POST request to the Duitku API using PHP's cURL library. It includes setting headers, request body, and handling the JSON response.
```php
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($params_string))
);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//execute post
$request = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpCode == 200)
{
$result = json_decode($request, true);
//header('location: '. $result['paymentUrl']);
echo "paymentUrl :". $result['paymentUrl'] . "
";
echo "merchantCode :". $result['merchantCode'] . "
";
echo "reference :". $result['reference'] . "
";
echo "vaNumber :". $result['vaNumber'] . "
";
echo "amount :". $result['amount'] . "
";
echo "statusCode :". $result['statusCode'] . "
";
echo "statusMessage :". $result['statusMessage'] . "
";
}
else
{
$request = json_decode($request);
$error_message = "Server Error " . $httpCode ." ". $request->Message;
echo $error_message;
}
?>
```
--------------------------------
### Transaction Inquiry Request
Source: https://docs.duitku.com/api/id
This endpoint allows you to create a payment transaction. You can specify payment methods, customer details, item details, and callback URLs. The API supports both sandbox and production environments.
```APIDOC
## POST /webapi/api/merchant/v2/inquiry
### Description
Initiates a transaction request to create a payment, supporting various methods like virtual accounts, QRIS, and e-wallets. This allows for the creation of a payment page for customers.
### Method
POST
### Endpoint
**Sandbox:** `https://sandbox.duitku.com/webapi/api/merchant/v2/inquiry`
**Production:** `https://passport.duitku.com/webapi/api/merchant/v2/inquiry`
### Parameters
#### Request Body
- **merchantCode** (string) - Required - Your Duitku merchant code.
- **paymentAmount** (float) - Required - The total amount of the payment.
- **paymentMethod** (string) - Required - The payment method code (e.g., 'VC' for Credit Card). If 'Get Payment Method' is skipped, this must be provided.
- **merchantOrderId** (string) - Required - A unique order ID from your merchant system.
- **productDetails** (string) - Required - A description of the products or services being paid for.
- **email** (string) - Required - The customer's email address.
- **customerVaName** (string) - Optional - The display name for the bank confirmation screen (for Virtual Accounts).
- **phoneNumber** (string) - Optional - The customer's phone number.
- **additionalParam** (string) - Optional - Additional parameters you wish to pass.
- **merchantUserInfo** (string) - Optional - User information from the merchant.
- **callbackUrl** (string) - Required - The URL Duitku will send payment notifications to.
- **returnUrl** (string) - Required - The URL the customer will be redirected to after payment.
- **expiryPeriod** (integer) - Optional - The expiration period for the payment in minutes. Defaults may apply.
- **itemDetails** (array) - Optional - An array of item objects, each with `name` (string), `price` (float), and `quantity` (integer).
- **customerDetail** (object) - Optional - An object containing customer details, including `firstName`, `lastName`, `email`, `phoneNumber`, `billingAddress`, and `shippingAddress`.
- **signature** (string) - Required - An HMAC SHA256 signature generated from specific request parameters.
### Request Example
```json
{
"merchantCode": "DXXXXX",
"paymentAmount": 40000,
"paymentMethod": "VC",
"merchantOrderId": "1678886400",
"productDetails": "Tes pembayaran menggunakan Duitku",
"email": "test@test.com",
"phoneNumber": "08123456789",
"customerVaName": "John Doe",
"callbackUrl": "http://example.com/callback",
"returnUrl": "http://example.com/return",
"expiryPeriod": 10,
"itemDetails": [
{
"name": "Test Item 1",
"price": 10000,
"quantity": 1
},
{
"name": "Test Item 2",
"price": 30000,
"quantity": 3
}
],
"customerDetail": {
"firstName": "John",
"lastName": "Doe",
"email": "test@test.com",
"phoneNumber": "08123456789",
"billingAddress": {
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
},
"shippingAddress": {
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
}
},
"signature": "generated_signature"
}
```
### Response
#### Success Response (200)
- **response** (object) - Contains details of the transaction inquiry response, including payment URLs, virtual account numbers, etc.
#### Response Example
```json
{
"response": {
"reference_id": "TRX123456789",
"payment_url": "https://duitku.com/payment/page/xyz",
"virtual_account": "1234567890",
"status_code": "200",
"status_message": "Success"
}
}
```
```
--------------------------------
### Transaction Response Parameters
Source: https://docs.duitku.com/api/id
Details the parameters returned by the Duitku API after a transaction request. These parameters are crucial for payment processing and customer information.
```APIDOC
## Transaction Response Parameters
### Description
This section details the parameters returned by the Duitku API after a transaction request. These parameters are crucial for payment processing and customer information.
### Parameters
#### Response Fields
- **merchantCode** (string(50)) - Your merchant code provided by Duitku, indicating the project used in the transaction.
- **reference** (string(255)) - A unique reference ID from Duitku that should be stored in your system for transaction tracking.
- **paymentUrl** (string(255)) - A URL to the Duitku payment page, which can be used to redirect customers for payment.
- **vaNumber** (string(20)) - The virtual account number for bank payments. This can be displayed to customers for direct payment.
- **amount** (integer) - The nominal amount of the payment.
- **qrString** (string(255)) - A string used to generate a QRIS payment code. This string needs to be converted into a QR code image for display.
- **appUrl** (string) - A URL that can be used to redirect users directly to an e-commerce application from your payment page.
- **statusCode** (string) - The status code of the transaction.
- **statusMessage** (string) - The status message corresponding to the status code.
### Response Example
```json
{
"merchantCode": "DXXXX",
"reference": "DXXXXCX80TZJ85Q70QCI",
"paymentUrl": "https://sandbox.duitku.com/topup/topupdirectv2.aspx?ref=BCA7WZ7EIDXXXXWEC",
"vaNumber": "7007014001444348",
"qrString": "00020101021226660014ID.DANA.WWW011893600911002151500102152006170915150010303UME51450015ID.OR.GPNQR.WWW02150000000000000000303UME520454995802ID5911Toko Jualan6013Jakarta Barat61051153062210117LQKI2LPMJQPKCIIS553033605405400006304502A",
"AppUrl": "https://tokopedia.app.link/?$ios_deeplink_path=tokopedia%3A%2F%2Fdigital%2Fcart%3Fcategory_id%3dXXXX%26operator_id%3d33334%26product_id%3d77778%26client_number%3d1070026818117867&$android_deeplink_path=tokopedia%3A%2F%2Fdigital%2Fcart%3Fcategory_id%3dXXXX%26operator_id%3d33334%26product_id%3d77778%26client_number%3d1070026818117867&$desktop_url=https%3A%2F%2Fpulsa.tokopedia.com%3Faction%3dinit_data%26category_id%3dXXXX%26operator_id%3d33334%26product_id%3d77778%26client_number%3d1070026818117867",
"amount": "40000",
"statusCode": "00",
"statusMessage": "SUCCESS"
}
```
```
--------------------------------
### Payment Fee Object
Source: https://docs.duitku.com/api/id
Details the transaction fee for a specific payment method. The total fee is provided as a string.
```json
{
"paymentMethod": "VA",
"paymentName": "MAYBANK VA",
"paymentImage": "https://images.duitku.com/hotlink-ok/VA.PNG",
"totalFee": "0"
}
```
--------------------------------
### Payment Fee
Source: https://docs.duitku.com/api/id
Details regarding payment fees, including method, name, image, and total fee.
```APIDOC
## Payment Fee
### Description
Details regarding payment fees, including method, name, image, and total fee.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **paymentMethod** (String(2)) - Kode metode pembayaran.
- **paymentName** (String(255)) - Nama metode pembayaran.
- **paymentImage** (String(255)) - URL gambar metode pembayaran.
- **totalFee** (String(255)) - Biaya transaksi.
### Request Example
```json
{
"paymentMethod": "VA",
"paymentName": "MAYBANK VA",
"paymentImage": "https://images.duitku.com/hotlink-ok/VA.PNG",
"totalFee": "0"
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```
--------------------------------
### Address
Source: https://docs.duitku.com/api/id
Represents a physical address, used for billing and shipping details.
```APIDOC
## Address
### Description
Represents a physical address, used for billing and shipping details.
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **firstName** (string(255)) - Optional - Nama pertama pelanggan.
- **lastName** (string(255)) - Optional - Nama belakang pelanggan.
- **address** (string(255)) - Optional - Alamat tagihan atau pengiriman pelanggan.
- **city** (string(255)) - Optional - Keterangan alamat kota.
- **postalCode** (string(255)) - Optional - Kode Pos alamat.
- **phone** (string(255)) - Optional - Nomor Telepon Tagihan atau Pengiriman Pelanggan.
- **countryCode** (string(255)) - Optional - ISO 3166-1 alpha-3.
### Request Example
```json
{
"firstName": "John",
"lastName": "Doe",
"address": "Jl. Kembangan Raya",
"city": "Jakarta",
"postalCode": "11530",
"phone": "08123456789",
"countryCode": "ID"
}
```
### Response
#### Success Response (200)
None explicitly defined in source.
#### Response Example
None explicitly defined in source.
```