PHPackages                             duitkupg/duitku-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. duitkupg/duitku-php

ActiveLibrary[Payment Processing](/categories/payments)

duitkupg/duitku-php
===================

Duitku PHP

3457.6k—4.4%10[1 issues](https://github.com/duitkupg/duitku-php/issues)2PHP

Since Jul 21Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/duitkupg/duitku-php)[ Packagist](https://packagist.org/packages/duitkupg/duitku-php)[ RSS](/packages/duitkupg-duitku-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (2)

Duitku PHP Library
==================

[](#duitku-php-library)

Welcome to Duitku PHP Example Project Implementation Page, Integrate this Duitku PHP to start transaction using Duitku in your Web or Application.

[![flow_duitku_payment](https://user-images.githubusercontent.com/13087322/138187049-1a28ed5b-e9e8-48c9-aada-fa6f978c6e64.gif)](https://user-images.githubusercontent.com/13087322/138187049-1a28ed5b-e9e8-48c9-aada-fa6f978c6e64.gif)

### Demo Project

[](#demo-project)

Go To [Demo Duitku-Pop](https://api-sandbox.duitku.com/demoduitku/)Go To [Demo Duitku-Api](https://sandbox.duitku.com/payment/demopage.aspx)

### Full Step Docs

[](#full-step-docs)

Go To [Duitku Docs Duitku-Pop](https://docs.duitku.com/pop/id)Go To [Duitku Docs Duitku-Api](https://docs.duitku.com/api/id)

Installation
------------

[](#installation)

Install duitku-php with composer by following command:

```
composer require duitkupg/duitku-php:dev-master
```

or add it manually in your `composer.json` file.

```
"duitkupg/duitku-php": "dev-master"
```

Configuration Settings
----------------------

[](#configuration-settings)

```
$duitkuConfig = new \Duitku\Config("YOUR_MERCHANT_KEY", "YOUR_MERCHANT_CODE");
// false for production mode
// true for sandbox mode
$duitkuConfig->setSandboxMode(false);
// set sanitizer (default : true)
$duitkuConfig->setSanitizedMode(false);
// set log parameter (default : true)
$duitkuConfig->setDuitkuLogs(false);
```

Duitku POP
----------

[](#duitku-pop)

### Create Invoice (Duitku-Pop)

[](#create-invoice-duitku-pop)

Parameter paymentMethod is optional,

You can put payment method('paymentMethod') on parameter createInvoice, as a step to set direct payment to specific payment. Customers will be directed to wanted payment without necessary to pick a payment.

```
// $paymentMethod      = ""; // PaymentMethod list => https://docs.duitku.com/pop/id/#payment-method
$paymentAmount      = 10000; // Amount
$email              = "customer@gmail.com"; // your customer email
$phoneNumber        = "081234567890"; // your customer phone number (optional)
$productDetails     = "Test Payment";
$merchantOrderId    = time(); // from merchant, unique
$additionalParam    = ''; // optional
$merchantUserInfo   = ''; // optional
$customerVaName     = 'John Doe'; // display name on bank confirmation display
$callbackUrl        = 'http://YOUR_SERVER/callback'; // url for callback
$returnUrl          = 'http://YOUR_SERVER/return'; // url for redirect
$expiryPeriod       = 60; // set the expired time in minutes

// Customer Detail
$firstName          = "John";
$lastName           = "Doe";

// Address
$alamat             = "Jl. Kembangan Raya";
$city               = "Jakarta";
$postalCode         = "11530";
$countryCode        = "ID";

$address = array(
    'firstName'     => $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
);

// Item Details
$item1 = array(
    'name'      => $productDetails,
    'price'     => $paymentAmount,
    'quantity'  => 1
);

$itemDetails = array(
    $item1
);

$params = array(
    'paymentAmount'     => $paymentAmount,
    'merchantOrderId'   => $merchantOrderId,
    'productDetails'    => $productDetails,
    'additionalParam'   => $additionalParam,
    'merchantUserInfo'  => $merchantUserInfo,
    'customerVaName'    => $customerVaName,
    'email'             => $email,
    'phoneNumber'       => $phoneNumber,
    'itemDetails'       => $itemDetails,
    'customerDetail'    => $customerDetail,
    'callbackUrl'       => $callbackUrl,
    'returnUrl'         => $returnUrl,
    'expiryPeriod'      => $expiryPeriod
);

try {
    // createInvoice Request
    $responseDuitkuPop = \Duitku\Pop::createInvoice($params, $duitkuConfig);

    header('Content-Type: application/json');
    echo $responseDuitkuPop;
} catch (Exception $e) {
    echo $e->getMessage();
}
```

### Check Transaction Status (Duitku-Pop)

[](#check-transaction-status-duitku-pop)

```
try {
    $merchantOrderId = "YOUR_MERCHANTORDERID";
    $transactionList = \Duitku\Pop::transactionStatus($merchantOrderId, $duitkuConfig);

    header('Content-Type: application/json');
    $transaction = json_decode($transactionList);

    // var_dump($transactionList);

    if ($transaction->statusCode == "00") {
        // Action Success
    } else if ($transaction->statusCode == "01") {
        // Action Pending
    } else {
        // Action Failed Or Expired
    }
} catch (Exception $e) {
	echo $e->getMessage();
}
```

### Callback (Duitku-Pop)

[](#callback-duitku-pop)

```
try {
    $callback = \Duitku\Pop::callback($duitkuConfig);

    header('Content-Type: application/json');
    $notif = json_decode($callback);

    // var_dump($callback);

    if ($notif->resultCode == "00") {
        // Action Success
    } else if ($notif->resultCode == "01") {
        // Action Failed
    }
} catch (Exception $e) {
    http_response_code(400);
    echo $e->getMessage();
}
```

### Get Payment Method (Duitku-Pop)

[](#get-payment-method-duitku-pop)

```
try {
    $paymentAmount = "10000"; //"YOUR_AMOUNT";
    $paymentMethodList = \Duitku\Pop::getPaymentMethod($paymentAmount, $duitkuConfig);

    header('Content-Type: application/json');
    echo $paymentMethodList;
} catch (Exception $e) {
    echo $e->getMessage();
}
```

### Frontend Integration (Duitku-Pop)

[](#frontend-integration-duitku-pop)

```
$.ajax({
    type: "POST",
    data:{
      // paymentMethod: '',
	  paymentAmount: amount,
	  productDetail: productDetail,
	  email: email,
	  phoneNumber: phoneNumber
    },
    url: 'http://domain.com/createInvoice.php',
    dataType: "json",
    cache: false,
    success: function (result) {
            console.log(result.reference);
            console.log(result);
            checkout.process(result.reference, {
                successEvent: function(result){
                // Add Your Action
                    console.log('success');
                    console.log(result);
                    alert('Payment Success');
                },
                pendingEvent: function(result){
                // Add Your Action
                    console.log('pending');
                    console.log(result);
                    alert('Payment Pending');
                },
                errorEvent: function(result){
                // Add Your Action
                    console.log('error');
                    console.log(result);
                    alert('Payment Error');
                },
                closeEvent: function(result){
                // Add Your Action
                    console.log('customer closed the popup without finishing the payment');
                    console.log(result);
                    alert('customer closed the popup without finishing the payment');
                }
            });
    }
});
```

Duitku API
----------

[](#duitku-api)

### Create Invoice (Duitku-Api)

[](#create-invoice-duitku-api)

```
$paymentAmount      = 10000; // Amount
$paymentMethod      = "BT"; // Permata Bank Virtual Account
$email              = "customer@gmail.com"; // your customer email
$phoneNumber        = "081234567890"; // your customer phone number (optional)
$productDetails     = "Test Payment";
$merchantOrderId    = time(); // from merchant, unique
$additionalParam    = ''; // optional
$merchantUserInfo   = ''; // optional
$customerVaName     = 'John Doe'; // display name on bank confirmation display
$callbackUrl        = 'http://YOUR_SERVER/callback'; // url for callback
$returnUrl          = 'http://YOUR_SERVER/return'; // url for redirect
$expiryPeriod       = 60; // set the expired time in minutes

// Customer Detail
$firstName          = "John";
$lastName           = "Doe";

// Address
$alamat             = "Jl. Kembangan Raya";
$city               = "Jakarta";
$postalCode         = "11530";
$countryCode        = "ID";

$address = array(
    'firstName'     => $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
);

// Item Details
$item1 = array(
    'name'      => $productDetails,
    'price'     => $paymentAmount,
    'quantity'  => 1
);

$itemDetails = array(
    $item1
);

$params = array(
    'paymentAmount'     => $paymentAmount,
    'paymentMethod'     => $paymentMethod,
    'merchantOrderId'   => $merchantOrderId,
    'productDetails'    => $productDetails,
    'additionalParam'   => $additionalParam,
    'merchantUserInfo'  => $merchantUserInfo,
    'customerVaName'    => $customerVaName,
    'email'             => $email,
    'phoneNumber'       => $phoneNumber,
    'itemDetails'       => $itemDetails,
    'customerDetail'    => $customerDetail,
    'callbackUrl'       => $callbackUrl,
    'returnUrl'         => $returnUrl,
    'expiryPeriod'      => $expiryPeriod
);

try {
    // createInvoice Request
    $responseDuitkuApi = \Duitku\Api::createInvoice($params, $duitkuConfig);

    header('Content-Type: application/json');
    echo $responseDuitkuApi;
} catch (Exception $e) {
    echo $e->getMessage();
}
```

### Check Transaction Status (Duitku-Api)

[](#check-transaction-status-duitku-api)

```
try {
    $merchantOrderId = "YOUR_MERCHANTORDERID";
    $transactionList = \Duitku\Api::transactionStatus($merchantOrderId, $duitkuConfig);

    header('Content-Type: application/json');
    $transaction = json_decode($transactionList);

    // var_dump($transactionList);

    if ($transaction->statusCode == "00") {
        // Action Success
    } else if ($transaction->statusCode == "01") {
        // Action Pending
    } else {
        // Action Failed Or Expired
    }
} catch (Exception $e) {
	echo $e->getMessage();
}
```

### Callback (Duitku-Api)

[](#callback-duitku-api)

```
try {
    $callback = \Duitku\Api::callback($duitkuConfig);

    header('Content-Type: application/json');
    $notif = json_decode($callback);

    // var_dump($callback);

    if ($notif->resultCode == "00") {
        // Action Success
    } else if ($notif->resultCode == "01") {
        // Action Failed
    }
} catch (Exception $e) {
    http_response_code(400);
    echo $e->getMessage();
}
```

### Get Payment Method (Duitku-Api)

[](#get-payment-method-duitku-api)

```
try {
    $paymentAmount = "10000"; //"YOUR_AMOUNT";
    $paymentMethodList = \Duitku\Api::getPaymentMethod($paymentAmount, $duitkuConfig);

    header('Content-Type: application/json');
    echo $paymentMethodList;
} catch (Exception $e) {
    echo $e->getMessage();
}
```

Tests
-----

[](#tests)

### Tests Duitku-Pop

[](#tests-duitku-pop)

#### Create Invoice Test

[](#create-invoice-test)

```
php vendor\bin\phpunit tests\CreateInvoiceTest.php
```

#### Transaction Status Test

[](#transaction-status-test)

```
php vendor\bin\phpunit tests\TransactionStatusTest.php
```

#### Callback Test

[](#callback-test)

```
php vendor\bin\phpunit tests\CallbackTest.php
```

### Tests Duitku-Api

[](#tests-duitku-api)

#### Create Invoice Api Test

[](#create-invoice-api-test)

```
php vendor\bin\phpunit tests\CreateInvoiceApiTest.php
```

#### Transaction Status Api Test

[](#transaction-status-api-test)

```
php vendor\bin\phpunit tests\TransactionStatusApiTest.php
```

#### Callback Api Test

[](#callback-api-test)

```
php vendor\bin\phpunit tests\CallbackApiTest.php
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 78.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e7c8c1e63b1136c243ed05552e94e19bf9a633443788b03742898a151aae4083?d=identicon)[Anggiyawan](/maintainers/Anggiyawan)

![](https://www.gravatar.com/avatar/257ea1fec9d1fb8aaee0b458dff269852b09f480415c080b1fb77212022bd963?d=identicon)[KangLeian](/maintainers/KangLeian)

![](https://www.gravatar.com/avatar/63a51fec47a0dd9255b4e8020722f61ebdda979b236f0dbbe5ee2d377f140049?d=identicon)[dhanisuhendra30](/maintainers/dhanisuhendra30)

![](https://www.gravatar.com/avatar/637646ade3e46c5977f671b5f587f5f7d7fe6ee43b839c3e9c528ad68a356df5?d=identicon)[AkhasaDyst](/maintainers/AkhasaDyst)

---

Top Contributors

[![bambangm88](https://avatars.githubusercontent.com/u/16401380?v=4)](https://github.com/bambangm88 "bambangm88 (11 commits)")[![AkhasaDyst](https://avatars.githubusercontent.com/u/111234514?v=4)](https://github.com/AkhasaDyst "AkhasaDyst (2 commits)")[![KangLeian](https://avatars.githubusercontent.com/u/62584211?v=4)](https://github.com/KangLeian "KangLeian (1 commits)")

### Embed Badge

![Health badge](/badges/duitkupg-duitku-php/health.svg)

```
[![Health](https://phpackages.com/badges/duitkupg-duitku-php/health.svg)](https://phpackages.com/packages/duitkupg-duitku-php)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
