Unofficial Integration Kit for LinkQu.id
- PHP v7.0.0+
- PHP JSON Extension
- Guzzle, PHP HTTP Client v7.0.0+
- Run command
composer require zerosdev/linkqu-php
- Run command
composer dump-autoload
- Then
php artisan vendor:publish --provider="ZerosDev\LinkQu\Laravel\ServiceProvider"
- Edit config/linkqu.php and put your API credentials
<?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 protected]')
->setBankCode('014');
});
if( LinkQu::hasError() ) {
print_r(LinkQu::errors());
} else {
print_r($result);
}
}
}
<?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')
->setUsername('LI307GXIN')
->setPin('2K2NPCBBNNTovgB');
});
$transaction = $linkqu->transaction();
$result = $transaction->createVa(function($va) {
$va->setAmount(10000)
->setExpired(60)
->setCustomerId(uniqid())
->setPartnerRef(time())
->setCustomerName('Nama Pelanggan')
->setCustomerPhone('08123456789')
->setCustomerEmail('[email protected]')
->setBankCode('014');
});
if( $linkqu->hasError() ) {
print_r($linkqu->errors());
} else {
print_r($result);
}