1. Go to this page and download the library: Download pawelsome/laravel-dotpay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pawelsome / laravel-dotpay example snippets
Alzo\LaravelDotpay\ServiceProvider::class,
'Dotpay' => Alzo\LaravelDotpay\Facade::class
array(
//route name for success redirect
'success_url'=> 'dotpay.success',
//route name for URLC notification
'notification_url' => 'dotpay.notification',
//default test mode is enabled, available: dev, prod
'environment' => 'dev',
//array of allowed IP, verified during URLC request
'allowed_servers' => [
'195.150.9.37'
]
);
public function notification(Request $request)
{
$data = $request->all();
$ip = $request->getClientIp();
// additional callback when validation fails
Dotpay::failed(function ($data) {
Log::debug("DOTPAY FAILED");
Log::debug("DATA" . json_encode($data, JSON_PRETTY_PRINT));
// do some stuff when data verification fails (hash is invalid)
});
// additional callback when validation passes
Dotpay::success(function ($data) {
Log::debug("DOTPAY SUCCESS");
Log::debug("DATA" . json_encode($data, JSON_PRETTY_PRINT));
// do some stuff when data verification passes
// compare amount, control field etc.
});
// validate request IP and hash
if (Dotpay::validateIP($ip)) {
if (Dotpay::validate($data)) {
Log::debug("Request is valid");
} else {
Log::debug("Request is invalid");
}
} else {
Log::debug("Request IP is INVALID: {$ip}");
}
return "OK";
}
shell
php artisan vendor:publish
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.