bagoespantera/doku-laravel-library

DOKU PHP Library for Laravel

Maintainers

Package info

github.com/BagoesPantera/doku-laravel-library

pkg:composer/bagoespantera/doku-laravel-library

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-02-26 05:36 UTC

This package is auto-updated.

Last update: 2026-04-27 01:57:49 UTC


README

A Laravel wrapper for the DOKU Payment Gateway API. This library simplifies the integration of DOKU payment services into your Laravel application.

Requirements

  • PHP >= 7.4
  • Laravel >= 8.0
  • ext-curl
  • ext-json

Installation

You can install the package via composer:

composer require bagoespantera/doku-laravel-library

Configuration

You can use the library directly by instantiating the client or using the provided classes.

Usage

1. Initialize the Client

First, you need to initialize the DOKU\Client with your Client ID and Shared Key. You can obtain these from the DOKU Dashboard.

use DOKU\Client;

$client = new Client;

// Set your credentials
$client->setClientID('YOUR_CLIENT_ID');
$client->setSharedKey('YOUR_SHARED_KEY');

// Set environment (true for production, false for sandbox)
$client->isProduction(false);

2. Generate Payment Code (Virtual Account)

Here is an example of how to generate a Mandiri Virtual Account:

$params = [
    'customerEmail' => 'johndoe@example.com',
    'customerName' => 'John Doe',
    'amount' => 10000,
    'invoiceNumber' => 'INV-' . time(),
    'expiryTime' => 60, // in minutes
    'reusableStatus' => false, // false for one-time use
    'info1' => 'Payment Info 1',
    'info2' => 'Payment Info 2',
    'info3' => 'Payment Info 3',
];

try {
    $response = $client->generateMandiriVa($params);

    // Process the response
    if (isset($response['virtual_account_info'])) {
        $vaNumber = $response['virtual_account_info']['virtual_account_number'];
        return response()->json([
            'status' => 'success',
            'va_number' => $vaNumber,
            'data' => $response
        ]);
    } else {
        return response()->json([
            'status' => 'error',
            'message' => 'Failed to generate VA'
        ], 400);
    }
} catch (\Exception $e) {
    return response()->json([
        'status' => 'error',
        'message' => $e->getMessage()
    ], 500);
}

Available Services

The library supports various payment methods including:

  • Virtual Accounts:

    • generateMandiriVa($params)
    • generateBcaVa($params)
    • generateBriVa($params)
    • generateBsiVa($params)
    • generateDokuVa($params)
  • E-Wallets:

    • generateOvo($params)
    • generateShopeePay($params)
    • generateDokuWallet($params)
  • Credit Card:

    • generateCreditCard($params)

License

The MIT License (MIT). Please see License File for more information.