zerosdev / linkqu-php
Unofficial Integration Kit for LinkQu.id
v1.2.1
2023-06-27 02:18 UTC
Requires
- php: >=7.0.0
- ext-json: *
- guzzlehttp/guzzle: ^6.5|^7.0
README
Unofficial Integration Kit for LinkQu.id
Requirements
- PHP v7.0.0+
- PHP JSON Extension
- Guzzle, PHP HTTP Client v6.5+
Installation
- Run command
composer require zerosdev/linkqu-php
- Run command
composer dump-autoload
The following steps only needed if you are using Laravel
- Then
php artisan vendor:publish --provider="ZerosDev\LinkQu\Laravel\ServiceProvider"
- Edit config/linkqu.php and put your API credentials
Basic Usage
Laravel Usage
<?php namespace App\Http\Controllers; use LinkQu; class YourController extends Controller { public function index() { $result = LinkQu::transaction()->createVa(function($va) { $va->setAmount(10000) ->setExpired(60) ->setCustomerId(uniqid()) ->setPartnerRef(time()) ->setCustomerName('Nama Pelanggan') ->setCustomerPhone('08123456789') ->setCustomerEmail('email@customer.com') ->setBankCode('014'); }); if( LinkQu::hasError() ) { print_r(LinkQu::errors()); } else { print_r($result); } } }
Non-Laravel Usage
<?php require 'path/to/your/vendor/autoload.php'; use ZerosDev\LinkQu\Client; use ZerosDev\LinkQu\Constant; $linkqu = new Client(function($client) { $client->setMode(Constant::DEVELOPMENT) ->setClientId('testing') ->setClientSecret('123') ->setServerKey('LinkQu@2020') ->setUsername('LI307GXIN') ->setPin('2K2NPCBBNNTovgB'); }); $result = $linkqu->transaction()->createVa(function($va) { $va->setAmount(10000) ->setExpired(60) ->setCustomerId(uniqid()) ->setPartnerRef(time()) ->setCustomerName('Nama Pelanggan') ->setCustomerPhone('08123456789') ->setCustomerEmail('email@customer.com') ->setBankCode('014'); }); if( $linkqu->hasError() ) { print_r($linkqu->errors()); } else { print_r($result); }