descom/redsys
Redsys
A PHP package to platform Redsys
Install
Via Composer
composer require descom/redsys
Usage
Generate Redirect From to payment
use Descom\Redsys\Redsys;
$redsys = Redsys::sandbox([
'code' => 999008881,
'terminal' => 1,
'signatureKey' => 'sq7HjrUOBfKmC576ILgskD5srU870gJ7',
]);
$orderId = '123456';
$amount = 12.05;
echo $redsys
->redirect()
->generateRedirectPayment($orderId, $amount, 'http://localhost:8000')
// ->description('description about the order products') optional DS_MERCHANT_PRODUCTDESCRIPTION
// ->merchantName('rename merchant name') optional DS_MERCHANT_MERCHANTNAME
// ->data('internal data, to read in response') optional DS_MERCHANT_MERCHANTDATA
// ->merchantPaymethods('z') // optional payment with Bizum
->redirect();
Capture payment notification
use Descom\Redsys\Redsys;
$redsys = Redsys::sandbox([
'code' => 999008881,
'terminal' => 1,
'signatureKey' => 'sq7HjrUOBfKmC576ILgskD5srU870gJ7',
]);
$response = $redsys->redirect()->capturePaymentNotification($_POST);
if (! $response->successful()) {
$orderId = $response->orderId;
$errorCode = $response->errorCode;
$responseCode = $response->responseCode;
// $responseData = $response->toArray();
throw new \Exception("Error processing payment [$orderId] [$errorCode]", $responseCode);
}
$orderId = $response->orderId;
$authorizationCode = $response->authorizationCode;
$amount = $response->amount;
//
Testing
composer test
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
648,266,899
9,701
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
429,221,767
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
403,217,078
4,664
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 1.9.0 | ^8.3 | MIT | |
| 1.8.8 | ^8.2 | MIT | |
| 1.8.5 | ^8.2 | MIT | |
| 1.8.4 | ^8.2 | MIT | |
| 1.8.3 | ^8.2 | MIT | |
| 1.8.2 | ^8.2 | MIT | |
| 1.8.1 | ^8.2 | MIT | |
| 1.7.6 | ^8.2 | MIT | |
| 1.7.5 | ^8.2 | MIT | |
| 1.7.4 | ^8.2 | MIT | |
| 1.7.3 | ^8.2 | MIT | |
| 1.7.2 | ^8.2 | MIT | |
| 1.7.1 | ^8.2 | MIT | |
| 1.7.0 | ^8.2 | MIT | |
| 1.6.0 | ^8.2 | MIT | |
| 1.5.1 | ^8.2 | MIT | |
| v1.4.0 | ^8.0 | MIT | |
| v1.3.0 | ^8.0 | MIT | |
| v1.2.0 | ^8.0 | MIT | |
| v1.1.0 | ^8.0 | MIT | |
| v1.0.1 | ^8.0 | MIT | |
| v1.0.0 | ^8.0 | MIT |