2017 © Pedro Peláez
 

library gateway

Laravel gateway is payment gateway adapter.

image

teepluss/gateway

Laravel gateway is payment gateway adapter.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 2 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

Gateway for Laravel

For Laravel 4, please use the v1.x branch!

Gateway is payment gateway adapters that support Paypal, Paysbuy, Bangkok Bank, Kasikorn Bank, True Money., (*1)

Installation

To get the lastest version of Gateway simply require it in your composer.json file., (*2)

"teepluss/gateway": "dev-master"

You'll then need to run composer install to download it and have the autoloader updated., (*3)

Once Gateway is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key., (*4)

'providers' => [
    ...
    Teepluss\Gateway\GatewayServiceProvider::class,
)

Gateway also ships with a facade which provides the static syntax for creating collections. You can register the facade in the aliases key of your app/config/app.php file., (*5)

'aliases' => [
    ...
    'Gateway' => Teepluss\Gateway\Facades\Gateway::class,

]

Usage

Generate payment form., (*6)

$adapter = Gateway::driver('Paypal');

$adapter->setSandboxMode(true);

$adapter->setSuccessUrl('http://www.domain/foreground/success')
        ->setCancelUrl('http://www.domain/foreground/cancel')
        ->setBackendUrl('http://www.domain/background/invoice/00001');

$adapter->setMerchantAccount('demo@gmail.com');

$adapter->setLanguage('TH')
        ->setCurrency('THB');

$adapter->setInvoice(00001)
        ->setPurpose('Buy a beer.')
        ->setAmount(100);

$adapter->setRemark('Short note');

$generated = $adapter->render();

var_dump($generated);

You can use intialize also., (*7)

$adapter = Gateway::driver('Paypal')->initialize(array(
    'sandboxMode'     => true,
    'successUrl'      => 'http://www.domain/foreground/success',
    'cancelUrl'       => 'http://www.domain/foreground/cancel',
    'backendUrl'      => 'http://www.domain/background/invoice/00001',
    'merchantAccount' => 'seller@domain.to',
    'language'        => 'TH',
    'currency'        => 'THB',
    'invoice'         => uniqid(),
    'purpose'         => 'Buy a beer.',
    'amount'          => 100,
    'remark'          => 'Short note'
));

$generated = $adapter->render();

var_dump($generated);

How to set TrueMoneyApi and PaysbuyApi, (*8)

// True Money
$gateway = Gateway::driver('TrueMoneyApi');
$gateway->setMerchantAccount('appId:shopCode:secret:bearer');

// Paysbuy
$gateway = Gateway::driver('PaysbuyApi');
$gateway->setMerchantAccount('merchantId:username:secureCode');

// Paysbuy having non-apu version.
$gateway = Gateway::driver('Paysbuy');
$gateway->setMerchantAccount('email');

Checking foregound process., (*9)

$adapter = Gateway::driver('Paypal');

$adapter->setSandboxMode(true);

$adapter->setMerchantAccount('seller@domain.to');

$adapter->setInvoice(00001);

$result = $adapter->getFrontendResult();

var_dump($result);

Checking background process (IPN)., (*10)

$adapter = Gateway::driver('Paypal');

$adapter->setSandboxMode(true);

$adapter->setMerchantAccount('demo@gmail.com');

$adapter->setInvoice(00001);

$result = $adapter->getBackendResult();

var_dump($result);

Extending the core., (*11)


use Teepluss\Gateway\Drivers\DriverAbstract; use Teepluss\Gateway\Drivers\DriverInterface; class Strip extends DriverAbstract imlements DriverInterface { //.... } use Teepluss\Gateway\Repository; Gateway::extend('Stripe', function() { return new Repository(new Strip); });

TrueMoneyApi adapter need more addition required data to make it works!, (*12)

$gateway = Gateway::driver('TrueMoneyApi');

$gateway->setMerchantAccount('appId:shopCode:secret:bearer');

$gateway->setSandboxMode(true);
$gateway->setSuccessUrl(URL::to('demo/thankyou'))
        ->setCancelUrl(URL::to('demo/thankyou'))
        ->setBackendUrl(URL::to('demo/background'));

$gateway->setLanguage('TH')
        ->setCurrency('THB');

$gateway->setInvoice(uniqid())
        ->setPurpose('sale');

$gateway->payer(array(
    'installment'       => null,
    'fundingInstrument' => null,
    'payerInfo' => array(
        'email'     => 'tee@gmail.com',
        'firstName' => 'Tee',
        'lastName'  => 'Plus',
        'payerId'   => '11',
        'phone'     => '9999999'
    ),
    'paymentMethod' => 'creditcard'
));

$gateway->address(array(
    'cityDistrict'  => 'Patumwan',
    'companyName'   => 'eCommerce Solution',
    'companyTaxId'  => '3334567',
    'country'       => 'Thailand',
    'email'         => 'me@email.com',
    'forename'      => 'Tee',
    'line1'         => 'Ratchadapisak Rd.',
    'line2'         => 'OX',
    'phone'         => '0888773390',
    'postalCode'    => '10310',
    'stateProvince' => 'Bangkok',
    'surname'       => 'Pluss',
));

$gateway->payment(array(
    'ref1' => 1,
    'ref2' => 2,
    'ref3' => 3
));

$gateway->product()->add(array(
    'shopCode'  => null,
    'itemId'    => 1,
    'service'   => 'bill',
    'productId' => 'p1',
    'detail'    => 'd1',
    'price'     => 5000,
    'ref1'      => '1',
    'ref2'      => '2',
    'ref3'      => '3',
));

$gateway->product()->add(array(
    'shopCode'  => null,
    'itemId'    => 2,
    'service'   => 'bill',
    'productId' => 'p1',
    'detail'    => 'd1',
    'price'     => 300,
    'ref1'      => '1',
    'ref2'      => '2',
    'ref3'      => '3',
));

echo $gateway->includeSubmitButton()->render();

For old version of TrueMoney, we call TruePaymentApi instead., (*13)

$gateway = Gateway::driver('TruePaymentApi');



$gateway->setAppId('AppId')
        ->setShopId('ShopId')
        ->setPassword('Password')
        ->setPrivateKey('PrivateKey')
        ->setRC4Key('RC4Key');

// $gateway->setMerchantAccount('appId:ShopId:Password:PrivateKey:RC4Key');

$gateway->setSandboxMode(true);
$gateway->setSuccessUrl(URL::to('demo/thankyou'))
        ->setCancelUrl(URL::to('demo/thankyou'))
        ->setBackendUrl(URL::to('demo/background'));

$gateway->setLanguage('TH')
        ->setCurrency('THB');

$gateway->setRemark('Something');

$gateway->setInvoice(uniqid());

$gateway->payer(array(
    'ssoId'     => '4620762',
    'trueId'    => 'teepluss@gmail.com',
    'fullName'  => 'Test Dev2',
    'address'   => 'RS ห้วยขวาง ห้วยขวาง',
    'district'  => 'ห้วยขวาง',
    'province'  => 'กรุงเทพมหานคร',
    'zip'       => '11115',
    'country'   => 'Thailand',
    'mphone'    => '0890000001',
    'citizenId' => '4100799036048'
));

$gateway->billing(array(
    'fullname' => 'Teepluss',
    'address'  => '33/1 Pattanakarn',
    'district' => 'Pattanakarn',
    'province' => 'Bangkok',
    'zip'      => '10220',
    'country'  => 'Thailand'
));

$gateway->product()->add(array(
    'pid'         => 18051,
    'productId'   => 'ME161',
    'topic'       => 'Winnie Jewelry : ต่างหูสแควร์ไดมอนด์ (ME162)',
    'quantity'    => 1,
    'totalPrice'  => 10,
    'shopIdRef'   => 'inherit',
    'marginPrice' => 0
));

$gateway->product()->add(array(
    'pid'         => 18052,
    'productId'   => 'ME162',
    'topic'       => 'Winnie Jewelry : ต่างหูสแควร์ไดมอนด์ (ME162)',
    'quantity'    => 3,
    'totalPrice'  => 10,
    'shopIdRef'   => 'inherit',
    'marginPrice' => 0
));

echo $gateway->includeSubmitBtn()->render();

Support or Contact

If you have some problem, Contact teepluss@gmail.com, (*14)

Support via PayPal, (*15)

The Versions

05/05 2017

dev-master

9999999-dev https://github.com/teepluss/laravel-gateway

Laravel gateway is payment gateway adapter.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel gateway paypal

24/02 2017

2.0.2

2.0.2.0 https://github.com/teepluss/laravel-gateway

Laravel gateway is payment gateway adapter.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel gateway paypal

06/12 2016

2.0.1

2.0.1.0 https://github.com/teepluss/laravel-gateway

Laravel gateway is payment gateway adapter.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel gateway paypal

23/09 2015

2.0.0

2.0.0.0 https://github.com/teepluss/laravel-gateway

Laravel gateway is payment gateway adapter.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

laravel gateway paypal

08/10 2014

1.x-dev

1.9999999.9999999.9999999-dev https://github.com/teepluss/laravel4-gateway

Laravel gateway is payment gateway adapter.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel gateway laravel4 paypal

08/10 2014

1.0.0

1.0.0.0 https://github.com/teepluss/laravel4-gateway

Laravel gateway is payment gateway adapter.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

laravel gateway laravel4 paypal