ngocnh/omnipay-baokim

There is no license information available for the latest version (1.4) of this package.

Baokim gateway for Omnipay payment processing library

Installs: 405

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 1

Type:ngocnh-library

1.4 2015-09-07 06:35 UTC

This package is auto-updated.

Last update: 2024-11-29 04:14:28 UTC


README

Installation

Omnipay Baokim is installed via Composer:

composer require ngocnh/omnipay-baokim:~1.0

Example

$baokim = Omnipay::create('BaoKim_Express');
$baokim->setBusiness('dev.baokim@bk.vn');
$baokim->setMerchant('647');
$baokim->setWebsitePassword('ae543c080ad91c23');
$baokim->setApiUsername('merchant');
$baokim->setApiPassword('1234');
$baokim->setApiSignature('private_key');

$baokim->setTestMode(true);

$params = [
	'cancelUrl'   => 'http://localhost/cancel',
	'returnUrl'   => 'http://localhost/success',
	'amount'      => '10.00',
	'order_id'    => '01001-rb',
	'description' => '#01001-rb',
	'currency'    => 'USD'
];

$response = $baokim->purchase($params)->send();

if ($response->isSuccessful()) {
	// payment was successful: update database
	print_r($response);
} elseif ($response->isRedirect()) {

	// redirect to offsite payment gateway
	$response->redirect();
} else {
	// payment failed: display message to customer
	echo $response->getMessage();
}