zerosdev/nobubank-php

Nobu Bank API Integration Library for PHP

v1.2.2 2023-07-10 01:19 UTC

This package is auto-updated.

Last update: 2024-11-10 04:22:37 UTC


README

release language license size downloads pulls

About

This library give you an easy way to call Nobu Bank API in elegant code style. Example :

NobuBank::qris()
    ->setTransactionNo('ABCDEFGHIJKLMN')
    ->setReferenceNo('1234567890')
    ->setAmount(1000)
    ->setValidTime(3600)
    ->setStoreName('Nama Merchant')
    ->setCityName('Ponorogo')
    ->createDynamic();

Installation

  1. Run command
composer require zerosdev/nobubank-php

The following steps only needed if you are using Laravel

  1. Then
php artisan vendor:publish --provider="ZerosDev\NobuBank\Laravel\ServiceProvider"
  1. Edit config/nobu_bank.php and put your API credentials

Usage

Laravel

<?php

namespace App\Http\Controllers;

use NobuBank;

class YourController extends Controller
{
    public function index()
    {
        $dynamicQris = NobuBank::qris()
            ->setTransactionNo('ABCDEFGHIJKLMN')
            ->setReferenceNo('1234567890')
            ->setAmount(1000)
            ->setValidTime(3600)
            ->setStoreName('Nama Merchant')
            ->setCityName('Ponorogo')
            ->createDynamic();
            
        dd($dynamicQris);
    }
}

Non-Laravel

<?php

require 'path/to/your/vendor/autoload.php';

use ZerosDev\NobuBank\Client as NobuClient;

$mode = 'development';
$config = [
    'login'         => '',
    'password'      => '',
    'merchant_id'   => '',
    'store_id'      => '',
    'pos_id'        => '',
    'secret_key'    => '',
];

$nobu = new NobuClient($mode, $config);

$dynamicQris = $nobu->qris()
    ->setTransactionNo('ABCDEFGHIJKLMN')
    ->setReferenceNo('1234567890')
    ->setAmount(1000)
    ->setValidTime(3600)
    ->setStoreName('Nama Merchant')
    ->setCityName('Ponorogo')
    ->createDynamic();
    
print_r($dynamicQris);