PHPackages                             susutawar/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. [API Development](/categories/api)
4. /
5. susutawar/laravel-duitku

ActiveLibrary[API Development](/categories/api)

susutawar/laravel-duitku
========================

DuitKu Api implementation for laravel

0.0.1(1y ago)120GPL-3.0-or-laterPHPPHP ^7.0|^8.0

Since May 15Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel DuitKu
==============

[](#laravel-duitku)

DuitKu API implementation in laravel. Initially made for personal use, so it’s a bit biased.

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

[](#installation)

```
composer install susutawar/duitku-laravel

php artisan vendor:publish --tag="duitku"
```

Configuring
-----------

[](#configuring)

add the following to your `.env` file.

```
DUITKU_MERCHANT_ID=
DUITKU_API_KEY=
DUITKU_SANDBOX_MODE=
DUITKU_RETURN_URL=
```

- Fill out `DUITKU_MERCHANT_ID`, `DUITKU_API_KEY` with credentials you obtain from [duitku](https://dashboard.duitku.com/).
- Set `DUITKU_SANDBOX_MODE` to `1` to use DuitKu in sandbox mode, or `0` to use it in production mode.
- Setup `DUITKU_RETURN_URL` to any route you have configured. this will be used by DuitKu ([see documentation](https://docs.duitku.com/api/id/#redirect)). The value can be a route name or a URL.

You can check `config/duitku.php` for more setting/information.

Usage
-----

[](#usage)

### Get Payments

[](#get-payments)

Get available payment methods from DuitKu. [see documentation](https://docs.duitku.com/api/id/#get-payment-method)

```
use SusuTawar\Facade\Duitku;

// ...

// the result is a Laravel Collection
$paymentMethods = Duitku::getPayments($paymentAmount);
```

### Make Transaction

[](#make-transaction)

Start a transaction using DuitKu. [see documentation](https://docs.duitku.com/api/id/#permintaan-transaksi)

```
use SusuTawar\Facade\Duitku;

// ...

$paymentMethods = Duitku::makeTransaction(/* params */);
```

The resulting object contains `trx`, `url`, `qr`, and `va`:

- `trx`: The transaction number generated by DuitKu. Save this to your system.
- `url`: A link to the transaction page on DuitKu.
- `qr`: A string representing QRIS. You must generate QR images from this string yourself.
- `va`: The virtual account number for payment methods that support it.

### Check Transaction

[](#check-transaction)

Check the status of a transaction using your transaction ID. [see documentation](https://docs.duitku.com/api/id/#cek-transaksi)

```
use SusuTawar\Facade\Duitku;

// ...

$checkResult = Duitku::check($yourTransactionId);
```

### Error Handling

[](#error-handling)

Instead of returning `false` or `null`, when something unexpected occurred we will throw an `Exception` instead. You can catch the exception by its specific type or catch all exceptions with Exception, then use the provided message.

- `DuitKuAuthException`: Occurs when the provided authentication credentials cannot be authenticated by DuitKu.
- `DuitKuBadRequestException`: Occurs when the provided parameters are not valid according to DuitKu.
- `DuitKuNotFoundException`: Occurs when the specified resource is not available in DuitKu.
- `DuitKuPaymentException`: Occurs when something goes wrong with the payment.

Callback Routing
----------------

[](#callback-routing)

We automatically register the [callback](https://docs.duitku.com/api/id/#callback) route. To handle the incoming callback, create a class implementing `SusuTawar\Interfaces\DuitKuCallbackInterface`, and register it in `config/duitku.php` under `routing.callback_handler`

```
"routing" => [
  // ...
  "callback_handler" => MyCallbackHandler::class,
]
```

If you prefer to manually set up the callback, disable this feature by updating the configuration:

```
"routing" => [
  "enabled" => false,
  // ...
]
```

When this feature is disabled, you need to set the `callback_url` or add `DUITKU_CALLBACK_URL`to your `.env` file. Otherwise, the `callback_url` will default to `home` or `/`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

728d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/212055d76b157190774b9371d9d15e8f41cd8e6425e2c6e03f461505693defd1?d=identicon)[susutawar](/maintainers/susutawar)

---

Top Contributors

[![SusuTawar](https://avatars.githubusercontent.com/u/37829208?v=4)](https://github.com/SusuTawar "SusuTawar (3 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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