crabstudio / baokim
BaoKim payment gateway plugin for CakePHP 3.x
Installs: 50
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Type:cakephp-plugin
Requires
- php: >=5.4.16
- cakephp/cakephp: ~3.0
Requires (Dev)
Suggests
- cakephp/cakephp-codesniffer: Allows to check the code against the coding standards used in CakePHP.
- crabstudio/recaptcha: Simple google recaptcha for CakePHP 3.x
- crabstudio/search: Easy search solution for CakePHP 3.x. Datetime data type already supported
- crabstudio/sluggable: Auto create utf-8 slug. Best solution for Vietnamese slug CakePHP 3.x
This package is auto-updated.
Last update: 2024-10-29 03:53:27 UTC
README
CakePHP 3.x: BaoKim payment gateway plugin
[Donate] Buy me a cup of coffee
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require crabstudio/baokim
Or add the following lines to your application's composer.json:
"require": {
"crabstudio/baokim": "^1.0"
}
followed by the command:
composer update
Load plugin
Add this line to Your_project\config\bootstrap.php
Plugin::load('Crabstudio/BaoKim', ['bootstrap' => true]);
Or from command line:
bin/cake plugin load crabstudio/baokim
Configure
Write to your configure:
$baokim = [
'BaoKim' => [
'merchant_id' => 'your_merchant_id',
'secure_pass' => 'your_secret',
'business' => 'your_business_email@example.com'
]
];
Cake\Core\Configure::write($baokim);
Usage
Apply in your controller
public function checkout() {
$this->loadComponent('Crabstudio/BaoKim.BaoKim');
//your checkout logic here
//$url_success route to checkoutSuccessfull function
//$url_cancel route to checkoutCancel function
$redirect_url = $this->BaoKim->createRequestUrl($order_id, $total_amount, $shipping_fee, $tax_fee, $order_description, $url_success, $url_cancel, $url_detail);
return $this->redirect($redirect_url);
}
public function checkoutSuccessfull() {
$this->request->allowMethod('get');
$this->loadComponent('Crabstudio/BaoKim.BaoKim');
$isValid = $this->BaoKim->verifyResponseUrl($this->request);
if($isValid) {
//Valid logic here
}
//Invalid logic here
}
public function checkoutCancel() {
//Cancel logic here
}