Skip to content

trijayadigital/linkqu-php

 
 

Repository files navigation

linkqu-php

Unofficial Integration Kit for LinkQu.id

Requirements

Installation

  1. Run command
composer require zerosdev/linkqu-php
  1. Run command
composer dump-autoload

The following steps only needed if you are using Laravel

  1. Then
php artisan vendor:publish --provider="ZerosDev\LinkQu\Laravel\ServiceProvider"
  1. 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 protected]')
                ->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')
        ->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);
}

About

Integration Library for LinkQu.id

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%