### JSON Response Examples for BIFAST/LLG/RTGS and H2H Source: https://docs.duitku.com/disbursement/en These JSON examples illustrate the structure of response parameters for different transaction types. The first example is for BIFAST/LLG/RTGS, showing success parameters. The second example is for H2H, indicating a 'Waiting for Callback' status. These structures are essential for understanding the outcome of Duitku transactions. ```json { "email": "test@chakratechnology.com", "bankCode": "014", "bankAccount": "8760673466", "amountTransfer": 500000000.0, "accountName": "Test Account", "custRefNumber": "000000001278", "type": "RTGS", "responseCode": "00", "responseDesc": "Success" } ``` ```json { "email": "test@chakratechnology.com", "bankCode": "014", "bankAccount": "8760673466", "amountTransfer": 10000.0, "accountName": "Test Account", "custRefNumber": "000000626435", "type": "H2H", "responseCode": "80", "responseDesc": "Waiting for Callback" } ``` -------------------------------- ### Start Payment Function Source: https://docs.duitku.com/mobile/ios/en Initiates the Duitku payment process after all necessary data has been configured. ```APIDOC ## POST /startPayment ### Description This function is called to begin the payment process using the Duitku SDK. It should be called after all transaction details have been set. ### Method POST ### Endpoint startPayment() ### Parameters None ### Request Example ```swift startPayment(self) ``` ### Response #### Success Response (200) This function typically triggers the SDK's UI or redirects the user to the payment gateway. No direct JSON response is usually returned to the caller. #### Response Example N/A ``` -------------------------------- ### Initiate Payment Process - Swift Source: https://docs.duitku.com/mobile/ios/en Starts the Duitku payment process after all transaction details have been configured. This function is essential for proceeding with the payment flow. ```swift startPayment(self); ``` -------------------------------- ### Start Payment Process (Java) Source: https://docs.duitku.com/mobile/android/en This function initiates the Duitku payment process. It should be called after all transaction details have been configured. The function requires the current activity context as a parameter. ```java startPayment(MainActivity.this); ``` -------------------------------- ### Duitku Transaction Redirect Example Source: https://docs.duitku.com/api/en Example of a GET request URL used for redirecting customers back to the merchant's site after a Duitku transaction. It includes order ID, result code, and reference number. ```HTTP GET: http://www.merchantweb.com/redirect.php?merchantOrderId=abcde12345&resultCode=00&reference=DXXXXCX80TXXX5Q70QCI ``` -------------------------------- ### Initiate Payment in Swift Source: https://docs.duitku.com/mobile/ios/en This code snippet shows how to initiate the Duitku payment process within the `viewWillAppear` method of your view controller. It ensures the payment flow starts when the view appears and optionally sets the navigation bar title. ```swift override func viewWillAppear(_ animated: Bool) { runPayment(self) self.navigationController?.isNavigationBarHidden = false self.navigationItem.title = "Order" //optional } ``` -------------------------------- ### Import Duitku SDK Class in Swift Source: https://docs.duitku.com/mobile/ios/en This code demonstrates how to import the Duitku SDK classes into your Swift project after installation. This is a prerequisite for using Duitku functionalities. ```swift import duitku ``` -------------------------------- ### Duitku API Response Parameters Example (JSON) Source: https://docs.duitku.com/disbursement/en This JSON object represents the typical response parameters received from the Duitku API. It includes details about the transaction such as email, bank code, account information, transfer amount, customer reference number, and the response code and description. ```json { "email": "test@chakratechnology.com", "bankCode": "014", "bankAccount": "8760673566", "amountTransfer": 50000.0, "accountName": "Test Account", "custRefNumber": "000000001278", "responseCode": "00", "responseDesc": "Success" } ``` -------------------------------- ### Duitku Invoice Creation with PHP Source: https://docs.duitku.com/pop/id This PHP script demonstrates how to construct the necessary parameters and generate a signature for creating a Duitku payment invoice. It includes setting up merchant credentials, transaction details, customer information, and item details before encoding them into a JSON payload for the API request. ```php $firstName, 'lastName' => $lastName, 'address' => $alamat, 'city' => $city, 'postalCode' => $postalCode, 'phone' => $phoneNumber, 'countryCode' => $countryCode ); $customerDetail = array( 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, 'phoneNumber' => $phoneNumber, //'merchantCustomerId' => $merchantCustomerId, '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 Kartu Kredit $creditCardDetail = array ( 'saveCardToken' => $saveCardToken, 'acquirer' => '014', 'binWhitelist' => array ( '014', '400000' ) );*/ $params = array( 'paymentAmount' => $paymentAmount, 'merchantOrderId' => $merchantOrderId, 'productDetails' => $productDetails, 'additionalParam' => $additionalParam, 'merchantUserInfo' => $merchantUserInfo, 'customerVaName' => $customerVaName, 'email' => $email, 'phoneNumber' => $phoneNumber, 'itemDetails' => $itemDetails, 'customerDetail' => $customerDetail, //'creditCardDetail' => $creditCardDetail, 'callbackUrl' => $callbackUrl, 'returnUrl' => $returnUrl, 'expiryPeriod' => $expiryPeriod //'paymentMethod' => $paymentMethod ); $params_string = json_encode($params); //echo $params_string; $url = 'https://api-sandbox.duitku.com/api/merchant/createinvoice'; // Sandbox // $url = 'https://api-prod.duitku.com/api/merchant/createinvoice'; // Production //log transaksi untuk debug ?> ``` -------------------------------- ### Duitku API Response Parameters Example Source: https://docs.duitku.com/disbursement/en This JSON object illustrates the structure of a successful response from the Duitku API, specifically for listing banks. It includes a response code and description, along with an array of bank objects, each containing a bank code, name, and maximum transfer amount. This data is crucial for displaying available banking options to users. ```json { "responseCode": "00", "responseDesc": "Success", "Banks": [ { "bankCode": "014", "bankName": "BANK CENTRAL ASIA", "maxAmountTransfer": "50000000" }, { "bankCode": "002", "bankName": "BANK BRI", "maxAmountTransfer": "100000000" }, { "bankCode": "1010", "bankName": "OVO", "maxAmountTransfer": "25000000" } { "bankCode": "119", "bankName": "BANK RIAU KEPRI", "maxAmountTransfer": "100000000" }, { "bankCode": "118", "bankName": "BANK NAGARI", "maxAmountTransfer": "100000000" } ] } ``` -------------------------------- ### PHP Duitku Payment Inquiry Request Setup Source: https://docs.duitku.com/api/en This snippet shows how to prepare parameters for a Duitku payment inquiry. It defines merchant details, payment amounts, customer information, item details, and generates a signature for API authentication. The parameters are then encoded into a JSON string for the API request. ```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 ); /*For payment method OL and SL $accountLink = array ( 'credentialCode' => '7cXXXXX-XXXX-XXXX-9XXX-944XXXXXXX8', 'ovo' => array ( 'paymentDetails' => array ( 0 => array ( 'paymentType' => 'CASH', 'amount' => 40000,), ), ), 'shopee' => array ( 'useCoin' => false, 'promoId' => '',), );*/ /*Optional for payment Credit Card $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(); 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); //header('location: '. $result['paymentUrl']); print_r($results, false); // echo "paymentUrl :". $result['paymentUrl'] . "
"; // echo "merchantCode :". $result['merchantCode'] . "
"; // echo "reference :". $result['reference'] . "
"; // echo "vaNumber :". $result['vaNumber'] . "
"; // echo "amount :". $result['amount'] . "
"; } ?> ``` -------------------------------- ### Import Duitku SDK via Cocoapods Source: https://docs.duitku.com/mobile/ios/en This snippet shows how to add the Duitku SDK to your iOS project using Cocoapods. Ensure you have Cocoapods installed and configured for your project. ```ruby pod 'duitku', '~> 1.0' ``` -------------------------------- ### Clearing Transfer Request Example (JSON) Source: https://docs.duitku.com/disbursement/en This JSON object represents a sample request payload for the Duitku Clearing Transfer API. It includes all necessary parameters for initiating a transfer, such as merchant details, bank information, amount, and transaction type. Ensure all fields are correctly populated according to the API specifications. ```json { "email": "test@chakratechnology.com", "bankCode": "014", "bankAccount": "8760673466", "amountTransfer": 500000000.0, "accountName": "Test Account", "custRefNumber": "000000001278", "disburseId": 125324342, "type": "RTGS", "responseCode": "00", "responseDesc": "Success" } ``` -------------------------------- ### Create Invoice API Source: https://docs.duitku.com/pop/id This endpoint allows merchants to create a new payment invoice. It includes details about the payment amount, product information, customer details, and callback URLs. ```APIDOC ## POST /api/merchant/createinvoice ### Description Creates a new payment invoice for a transaction. This endpoint is used to initiate a payment process with Duitku, specifying all necessary details for the transaction. ### Method POST ### Endpoint https://api-sandbox.duitku.com/api/merchant/createinvoice (Sandbox) https://api-prod.duitku.com/api/merchant/createinvoice (Production) ### Parameters #### Query Parameters None #### Request Body - **paymentAmount** (number) - Required - The total amount to be paid. - **merchantOrderId** (string) - Required - A unique identifier for the order from the merchant's system. - **productDetails** (string) - Required - A description of the product or service being paid for. - **additionalParam** (string) - Optional - Additional parameters that can be passed. - **merchantUserInfo** (string) - Optional - Information about the user from the merchant's perspective. - **paymentMethod** (string) - Optional - Specifies the desired payment method (e.g., 'VC' for Virtual Account). - **customerVaName** (string) - Required - The name to be displayed on the virtual account. - **email** (string) - Required - The email address of the customer. - **phoneNumber** (string) - Optional - The phone number of the customer. - **itemDetails** (array) - Required - An array of item objects, each containing 'name', 'price', and 'quantity'. - **name** (string) - Required - Name of the item. - **price** (number) - Required - Price of the item. - **quantity** (number) - Required - Quantity of the item. - **customerDetail** (object) - Required - An object containing detailed customer information. - **firstName** (string) - Required - Customer's first name. - **lastName** (string) - Required - Customer's last name. - **email** (string) - Required - Customer's email. - **phoneNumber** (string) - Required - Customer's phone number. - **merchantCustomerId** (string) - Optional - Merchant's customer ID. - **billingAddress** (object) - Required - Billing address details. - **firstName** (string) - Required - First name. - **lastName** (string) - Required - Last name. - **address** (string) - Required - Street address. - **city** (string) - Required - City. - **postalCode** (string) - Required - Postal code. - **phone** (string) - Required - Phone number. - **countryCode** (string) - Required - Country code (e.g., 'ID'). - **shippingAddress** (object) - Required - Shipping address details (same structure as billingAddress). - **creditCardDetail** (object) - Optional - Details for credit card payments. - **saveCardToken** (integer) - Optional - Flag to save the card token (0 or 1). - **callbackUrl** (string) - Required - The URL where Duitku will send payment notifications. - **returnUrl** (string) - Required - The URL to redirect the customer to after payment. - **expiryPeriod** (integer) - Required - The expiration period for the invoice in minutes. ### Request Example ```json { "paymentAmount": 40000, "merchantOrderId": "1648542419", "productDetails": "Test Pay with duitku", "additionalParam": "", "merchantUserInfo": "", "paymentMethod": "", "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", "merchantCustomerId": "", "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" } }, "creditCardDetail": { "saveCardToken": 0 }, "callbackUrl": "https://example.com/api-pop/backend/callback.php", "returnUrl": "https://example.com/api-pop/backend/redirect.php", "expiryPeriod": 10 } ``` ### Response #### Success Response (200) - **duitkuOrderId** (string) - The unique Duitku order ID. - **orderId** (string) - The merchant's order ID. - **paymentUrl** (string) - The URL where the customer can complete the payment. - **message** (string) - A success message. - **status_code** (string) - The status code of the response. #### Response Example ```json { "duitkuOrderId": "DO123456789", "orderId": "1648542419", "paymentUrl": "https://payment.duitku.com/checkout/DO123456789", "message": "Success create invoice", "status_code": "200" } ``` #### Error Response (e.g., 400) - **message** (string) - An error message describing the issue. - **status_code** (string) - The error status code. #### Error Response Example ```json { "message": "Invalid payment amount", "status_code": "400" } ``` ``` -------------------------------- ### Get Payment Method API Source: https://docs.duitku.com/api/en This process is used to get an active payment method from the merchant's project. This API contains the name of the payment method, the fee, and the URL to the image of the payment method. You can use it as a payment channel list on your project and you will get a `paymentMethod` that will be used for processing transaction request. ```APIDOC ## POST /webapi/api/merchant/paymentmethod/getpaymentmethod ### Description Retrieves a list of active payment methods available for a merchant's project, including details like name, fee, and image URL. ### 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 - Merchant code obtained from the Duitku merchant page. - **amount** (integer) - Required - Transaction amount. No decimal code (.) and no decimal digit. - **datetime** (datetime) - Required - Format: `yyyy-MM-dd HH:mm:ss` - **signature** (string) - Required - Signature generated using `Sha256(merchantcode + paymentAmount + datetime + apiKey)`. ### Request Example ```json { "merchantcode": "DXXXX", "amount": "10000", "datetime": "2022-01-25 16:23:08", "signature": "497fbf783f6d17d4b1e1ef468917bdc8" } ``` ### Response #### Success Response (200) - **paymentMethod** (array) - List of available payment methods. - **name** (string) - Name of the payment method. - **fee** (float) - Transaction fee for the payment method. - **iconUrl** (string) - URL to the icon image of the payment method. - **paymentUrl** (string) - URL for processing the payment. #### Response Example ```json { "paymentMethod": [ { "name": "Bank Transfer", "fee": 0.005, "iconUrl": "https://example.com/icon.png", "paymentUrl": "https://example.com/pay" } ] } ``` ``` -------------------------------- ### Set Java Compatibility Options (Gradle) Source: https://docs.duitku.com/mobile/android/en To resolve 'Exception from call site #1 bootstrap' errors, configure the Java compatibility settings in your app's `build.gradle` file. This ensures the project uses Java 8 for source and target compatibility, which is often a requirement for certain SDK features. ```gradle compileOptions { targetCompatibility = "8" sourceCompatibility = "8" } ``` -------------------------------- ### Initialize DuitkuClient in Swift Source: https://docs.duitku.com/mobile/ios/en This snippet shows how to initialize the DuitkuClient class in your Swift code. This class is the main entry point for interacting with the Duitku SDK. ```swift class yourclass : DuitkuClient ``` -------------------------------- ### Merchant Server Configuration Source: https://docs.duitku.com/mobile/ios/en Details on setting up the merchant's server-side modules for transaction processing, checking transaction status, and listing payment methods. ```APIDOC ## Merchant Server Modules ### Description Merchants need to implement specific modules on their server to handle Duitku transactions effectively. These modules facilitate the request, checking, and listing of payment methods. ### Modules - **Request Transaction Module**: Handles incoming transaction requests from the Duitku SDK. - **Check Transaction Module**: Allows Duitku to check the status of a transaction on the merchant's server. - **Payment List Module**: Provides a list of available payment methods to the Duitku SDK. ### Endpoints (relative to `baseUrlPayment`) - **Request Transaction**: `requestTransaksi.php` - **Check Transaction**: `checktransaksi.php` - **Payment List**: `listPayment.php` ### Merchant Server Base URL Example: `https://www.merchantsite.com` ### Request Example (Conceptual) ```json // Request Transaction Endpoint (POST /requestTransaksi.php) { "transactionId": "TRX123456789", "status": "SUCCESS", "amount": "100000" } // Check Transaction Endpoint (POST /checktransaksi.php) { "transactionId": "TRX123456789" } // Payment List Endpoint (GET /listPayment.php) [ {"code": "001", "name": "Bank Transfer"}, {"code": "002", "name": "Credit Card"} ] ``` ``` -------------------------------- ### Initialize SDK Task on Resume (Java) Source: https://docs.duitku.com/mobile/android/en Call the `run()` method with the Activity's context in `onResume()` to ensure the Duitku SDK is properly initialized and ready to handle transactions when the Activity becomes active. ```java protected void onResume() { super.onResume(); run(MainActivity.this); //context } ``` -------------------------------- ### Get Payment Methods using cURL Source: https://docs.duitku.com/api/en This snippet demonstrates how to retrieve active payment methods from Duitku using a cURL request. It requires your merchant code, transaction amount, current datetime, and a generated signature for authentication. ```bash 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\"}" ``` -------------------------------- ### Handle Transaction Callbacks (Java) Source: https://docs.duitku.com/mobile/android/en Implement these methods to respond to different transaction statuses (success, pending, cancel). Each callback receives transaction details and requires `clearSdkTask()` to be called. Displaying status via Toast is shown as an example. ```java public void onSuccessTransaction(String status, String reference, String amount, String Code) { Toast.makeText(MainActivity.this,"Transaction"+status,Toast.LENGTH_LONG).show(); clearSdkTask(); //REQUIRED super.onSuccessTransaction(status, reference, amount, Code); } @Override public void onPendingTransaction(String status, String reference, String amount, String Code) { Toast.makeText(MainActivity.this,"Transaction"+status,Toast.LENGTH_LONG).show(); clearSdkTask(); //REQUIRED super.onPendingTransaction(status, reference, amount, Code); } @Override public void onCancelTransaction(String status, String reference, String amount, String Code) { Toast.makeText(MainActivity.this,"Transaction :"+status,Toast.LENGTH_LONG).show(); clearSdkTask(); //REQUIRED super.onCancelTransaction(status, reference, amount, Code); } ``` -------------------------------- ### Add AppCompat Dependency (Gradle) Source: https://docs.duitku.com/mobile/android/en If you encounter errors related to WebView components, you may need to add the AppCompat library dependency to your app's `build.gradle` file. This dependency provides backward compatibility for UI elements and is crucial for proper functioning of WebView-based features. ```gradle implementation 'androidx.appcompat:appcompat:1.0.2' ``` -------------------------------- ### Get Payment Methods using PHP Source: https://docs.duitku.com/api/en This PHP script shows how to fetch available payment methods from Duitku. It constructs a JSON payload with merchant details, amount, datetime, and a SHA256 signature, then sends it via a POST request to the Duitku API. ```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; } ?> ``` -------------------------------- ### Import Duitku SDK Library (Gradle) Source: https://docs.duitku.com/mobile/android/en This snippet shows how to add the Duitku SDK library to your Android project's build.gradle file. Ensure you are using Gradle version 3.4 or higher. ```gradle implementation 'com.duitku:duitku-android-sdk:1.0.14' ``` -------------------------------- ### Check Duitku Balance with PHP Source: https://docs.duitku.com/disbursement/en This snippet demonstrates how to check the balance of a Duitku account using PHP. It constructs the necessary request parameters, including a SHA256 signature, and sends a POST request to the Duitku API. The response is then parsed to display balance information. Dependencies include the cURL extension for making HTTP requests. ```php $userId, 'email' => $email, 'timestamp' => $timestamp, 'signature' => $signature ); $params_string = json_encode($params); $url = 'https://sandbox.duitku.com/webapi/api/disbursement/checkbalance'; // Sandbox // $url = 'https://passport.duitku.com/webapi/api/disbursement/checkbalance'; // Production $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) { $result = json_decode($request, true); echo "userId :". $result['userId'] . "
"; echo "email :". $result['email'] . "
"; echo "balance :". $result['balance'] . "
"; echo "effectiveBalance :". $result['effectiveBalance'] . "
"; echo "responseCode :". $result['responseCode'] . "
"; echo "responseDesc :". $result['responseDesc'] . "
"; } else echo $httpCode; ?> ``` -------------------------------- ### Duitku Invoice Creation Request Parameters (JSON) Source: https://docs.duitku.com/pop/id This JSON object outlines the mandatory and optional parameters for creating a Duitku payment invoice. It includes details such as payment amount, order ID, product information, customer details, and callback URLs. Ensure all required fields are accurately populated. ```json { "paymentAmount": 40000, "merchantOrderId": "1648542419", "productDetails": "Test Pay with duitku", "additionalParam": "", "merchantUserInfo": "", "paymentMethod":"", "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", "merchantCustomerId": "", "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" } }, "creditCardDetail": { "saveCardToken": 0 }, "callbackUrl": "https:\/\/example.com\/api-pop\/backend\/callback.php", "returnUrl": "https:\/\/example.com\/api-pop\/backend\/redirect.php", "expiryPeriod": 10 } ``` -------------------------------- ### PHP Implementation for Duitku Disbursement Inquiry Source: https://docs.duitku.com/disbursement/en This PHP script demonstrates how to construct and send a disbursement inquiry request to the Duitku API using cURL. It includes generating the signature, setting up POST parameters, and handling the API response. ```php $userId, 'amountTransfer' => $amountTransfer, 'bankAccount' => $bankAccount, 'bankCode' => $bankCode, 'email' => $email, 'purpose' => $purpose, 'timestamp' => $timestamp, 'senderId' => $senderId, 'senderName' => $senderName, 'signature' => $signature ); $params_string = json_encode($params); $url = 'https://sandbox.duitku.com/webapi/api/disbursement/inquirysandbox'; // Sandbox // $url = 'https://passport.duitku.com/webapi/api/disbursement/inquiry'; // Production $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) { $result = json_decode($request, true); header('location: '. $result['paymentUrl']); echo "email :". $result['email'] . "
"; echo "bankCode :". $result['bankCode'] . "
"; echo "bankAccount :". $result['bankAccount'] . "
"; echo "amountTransfer :". $result['amountTransfer'] . "
"; echo "accountName :". $result['accountName'] . "
"; echo "custRefNumber :". $result['custRefNumber'] . "
"; echo "disburseId :". $result['disburseId'] . "
"; echo "responseCode :". $result['responseCode'] . "
"; echo "responseDesc :". $result['responseDesc'] . "
"; } else echo $httpCode; ?> ``` -------------------------------- ### Generate Request Signature and Parameters for Duitku API (PHP) Source: https://docs.duitku.com/disbursement/en This snippet demonstrates how to generate the necessary request parameters, including a SHA256 signature, for interacting with the Duitku API. It uses PHP to construct the payload and set up a cURL request to a specified endpoint. Dependencies include the PHP cURL extension. ```php $userId, 'email' => $email, 'timestamp' => $timestamp, 'signature' => $signature ); $params_string = json_encode($params); $url = 'https://sandbox.duitku.com/webapi/api/disbursement/listBank'; // Sandbox // $url = 'https://passport.duitku.com/webapi/api/disbursement/listBank'; // Production $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) { header('Content-Type: application/json'); $return = json_encode(json_decode($request), JSON_PRETTY_PRINT); echo $return; } else echo $httpCode; ?> ``` -------------------------------- ### Transaction Inquiry Parameters Source: https://docs.duitku.com/disbursement/en Parameters used for initiating transaction inquiries, including details about the purpose, callback URL, and signature. ```APIDOC ## POST /websites/duitku/inquiry ### Description This endpoint allows merchants to initiate transaction inquiries. It requires details about the transaction purpose, a callback URL for receiving results, and a signature for authentication. ### Method POST ### Endpoint /websites/duitku/inquiry ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **purpose** (string(255)) - Required - Description of the inquiry purpose. - **callbackUrl** (string(255)) - Required - URL for transaction callback notifications. - **signature** (string(255)) - Required - Formula: SHA256(email + timestamp + amountTransfer + purpose + secretKey). ### Request Example ```json { "purpose": "Payment for Order #12345", "callbackUrl": "https://your-merchant.com/duitku/callback", "signature": "a1b2c3d4e5f6..." } ``` ### Response #### Success Response (200 OK) Returns transaction details upon successful inquiry. #### Response Example ```json { "disburseId" : 23042, "amountTransfer": 50000, "custRefNumber" : "000000001278", "accountName" : "Test Account", "email" : "test@chakratechnology.com", "phoneNumber" : "082211789110", "token" : 230426073103, "pin" : "902607", "responseCode" : "00", "responseDesc" : "Success" } ``` ### Parameter Details - **disburseId** (int) - Disbursement ID from Duitku. - **amountTransfer** (int) - Transfer amount (e.g., 50000 for 50,000). - Indomaret: Min 50,000, Max 1,000,000, multiple of 50,000. - Pos Indonesia: Min 50,000, Max 2,000,000. - **custRefNumber** (string) - Customer reference number. - **accountName** (string) - Destination account holder name. - **email** (string) - Merchant's registered email with Duitku. - **phoneNumber** (string) - Customer's phone number. - **token** (double) - Token generated by Duitku. - **pin** (string) - Required only for Channel Pos Indonesia. - **responseCode** (string) - Status code ('00' for success). - **responseDesc** (string) - Status message. ```