PHPackages                             royryando/laravel-duitku - 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. royryando/laravel-duitku

ActiveLibrary[Payment Processing](/categories/payments)

royryando/laravel-duitku
========================

A simple Duitku payment gateway library for Laravel.

v1.0.6(4y ago)82.7k↑50%2[1 issues](https://github.com/royryando/laravel-duitku/issues)MITPHPPHP &gt;=5.5

Since May 23Pushed 4y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (3)Used By (0)

Laravel Duitku
==============

[](#laravel-duitku)

A simple Duitku payment gateway library for Laravel.

Requirments
-----------

[](#requirments)

- PHP ≥ 5.5
- Laravel ≥ 5.1

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

[](#installation)

- Install through composer

    ```
    composer require royryando/laravel-duitku

    ```
- Add the duitku service provider in config/app.php: (Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.)

    ```
    'providers' => [
      Royryando\Duitku\DuitkuServiceProvider::class
    ];
    ```

Configure
---------

[](#configure)

- Add required variable to `.env````
    DUITKU_MERCHANT_CODE=
    DUITKU_API_KEY=
    DUITKU_CALLBACL_URL=https://example.com/callback/payment
    DUITKU_RETURN_URL=https://example.com/callback/return
    DUITKU_ENV=dev/production
    ```

Usage
-----

[](#usage)

### Get All Available Payment Method

[](#get-all-available-payment-method)

Ref:

Call paymentMethods function from Duitku facade with the integer parameter is amount

`Duitku::paymentMethods(100000)`

The return is an array of array, example:

```
[
    ...
    [
        'code' => 'M1',
        'name' => 'Bank Mandiri',
        'image' => 'https://example.com/image.jpg',
        'fee' => 0
    ],
    ...
]
```

### Create Invoice

[](#create-invoice)

Ref:

Create invoice or inquiry by calling createInvoice from Duitku facade with these parameter:

Order Id, amount, payment method, product name, customer name, cutomer email, expiry in minute

`Duitku::createInvoice('ORDER_ID', 100000, 'M1', 'Product Name', 'John Doe', 'john@example.com', 120);`

The return if success:

```
[
  'success' => true,
  'reference' => 'D7999PJ38HNY7TSKHSGX',
  'payment_url' => 'https://url.to.payment.example.com/',
  'va_number' => '0000123123123',
  'amount' => 100000,
  'message' => 'SUCCESS' // message from Duitku
]
```

The return if not success:

```
[
  'success' => false,
  'message' => 'The selected payment channel not available' // message from Duitku
]
```

### Check Invoice Status

[](#check-invoice-status)

Ref:

Check invoice or inquiry status by calling

`Duitku::checkInvoiceStatus('order ID')`

The return is an array, example:

```
[
  'reference' => 'D7999PJ38HNY7TSKHSGX', // reference code from Duitku
  'amount' => 100000,
  'message' => 'SUCCESS',
  'code' => '00', // 00=>Success, 01=>Pending, 02=>Failed/Expired
]
```

### Handle Callback

[](#handle-callback)

Ref:

- Create a new controller and extend `Royryando\Duitku\Http\Controllers\DuitkuBaseController`

    ```
    use Royryando\Duitku\Http\Controllers\DuitkuBaseController;

    class DuitkuController extends DuitkuBaseController
    {
        //
    }
    ```

    This controller will handle all callback requests from Duitku and store the success/failed payment function
- Inside the controller, override `onPaymentSuccess` function. This function will triggered if receiving a successful transaction callback

    ```
    ...
        protected function onPaymentSuccess(
            string $orderId, string $productDetail, int $amount, string $paymentCode,
            string $shopeeUserHash, string $reference, string $additionalParam
        ): void
        {
            // Your code here
        }
    ...
    ```
- Inside the controller, override `onPaymentFailed` function. This function will triggered if receiving a failed status from callback

    ```
    ...
        protected function onPaymentFailed(
            string $orderId, string $productDetail, int $amount, string $paymentCode,
            string $shopeeUserHash, string $reference, string $additionalParam
        ): void
        {
            // Your code here
        }
    ...
    ```
- Add route in your application route web.php with the function of paymentCallback

    ```
    Route::post('callback/payment', [\App\Http\Controllers\DuitkuController::class, 'paymentCallback']);
    ```
- Exclude the callback route from CSRF verification

    Edit `App\Http\Middleware\VerifyCsrfToken.php`

    ```
    protected $except = [
        'callback/payment',
    ];
    ```

TODO
----

[](#todo)

- Add tests
- Add support for Return Callback
- Add support for Disbursement API

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~80 days

Total

2

Last Release

1734d ago

### Community

Maintainers

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

---

Top Contributors

[![royryando](https://avatars.githubusercontent.com/u/24392241?v=4)](https://github.com/royryando "royryando (8 commits)")

---

Tags

duitkularavellaravel-duitkupaymentpayment-gatewaylaravelduitku

### Embed Badge

![Health badge](/badges/royryando-laravel-duitku/health.svg)

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

###  Alternatives

[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4845.9k](/packages/sebdesign-laravel-viva-payments)[henryejemuta/laravel-monnify

A laravel package to seamlessly integrate monnify api within your laravel application

132.1k](/packages/henryejemuta-laravel-monnify)[tsaiyihua/laravel-linepay

linepay library for laravel

102.9k](/packages/tsaiyihua-laravel-linepay)

PHPackages © 2026

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