- Notifications
You must be signed in to change notification settings - Fork4
Simple php class with redsys soap
License
buuum/Redsys
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
You need PHP >= 5.5.0 to use Buuum\Redsys but the latest stable version of PHP is recommended.
Buuum\redsys is available on Packagist and can be installed using Composer:
composer require buuum/redsys
You may use your own autoloader as long as it follows PSR-0 or PSR-4 standards. Just put src directory contents in your vendor directory.
https://canales.redsys.es/canales/ayuda/documentacion/Manual%20integracion%20para%20conexion%20por%20Redireccion.pdfhttps://canales.redsys.es/canales/ayuda/documentacion/Manual%20integracion%20para%20conexion%20por%20Web%20Service.pdf
$redsys =new \Buuum\Redsys($redsys_key);try {$redsys->setMerchantcode($redsys_merchant_code);$redsys->setAmount($amount);$redsys->setOrder($order);$redsys->setTerminal($redsys_merchant_terminal);$redsys->setCurrency(978);$redsys->setTransactiontype('0');$redsys->setMethod('C');$redsys->setNotification('http://localhost/notification.php');//Url de notificacion$redsys->setUrlOk('http://localhost/payment_ok.php');$redsys->setUrlKo('http://localhost/payment_ko.php');$redsys->setTradeName('Store S.L');$redsys->setTitular('John Doe');$redsys->setProductDescription('Product description');$form =$redsys->createForm();}catch (Exception$e) {echo$e->getMessage(); die;}echo$form;
$redsys =new \Buuum\Redsys($redsys_key);try {$redsys->setMerchantcode($redsys_merchant_code);$redsys->setAmount($amount);$redsys->setOrder($order);$redsys->setTerminal($redsys_merchant_terminal);$redsys->setCurrency(978);$redsys->setPan($visa_number);$redsys->setExpiryDate($visa_expiry);$redsys->setCVV($visa_cvv);$redsys->setMerchantDirectPayment(true);$redsys->setTransactiontype('0');$redsys->setMethod('C');$redsys->setNotification('http://localhost/notification.php');//Url de notificacion$redsys->setUrlOk('http://localhost/payment_ok.php');$redsys->setUrlKo('http://localhost/payment_ko.php');$redsys->setTradeName('Store S.L');$redsys->setTitular('John Doe');$redsys->setProductDescription('Product description');$form =$redsys->createForm();}catch (Exception$e) {echo$e->getMessage(); die;}echo$form;
$redsys =new \Buuum\Redsys($redsys_key);try{$result =$redsys->checkPaymentResponse($_POST);catch (Exception$e) {echo$e->getMessage(); die;}var_dump($result);
#### notification result output
array ('error' =>true,'code' =>'SIS041','Ds_Date' =>'05/03/2017','Ds_Hour' =>'08:40','Ds_SecurePayment' =>'1','Ds_Card_Country' =>'724','Ds_Amount' =>'1000','Ds_Currency' =>'978','Ds_Order' =>'99699629','Ds_MerchantCode' =>'xxxxxx','Ds_Terminal' =>'001','Ds_Response' =>'0000','Ds_MerchantData' =>'','Ds_TransactionType' =>'0','Ds_ConsumerLanguage' =>'1','Ds_AuthorisationCode' =>'875284',)
array ('error' =>false,'code' =>0,'Ds_Date' =>'05/03/2017','Ds_Hour' =>'08:40','Ds_SecurePayment' =>'1','Ds_Card_Country' =>'724','Ds_Amount' =>'1000','Ds_Currency' =>'978','Ds_Order' =>'99699629','Ds_MerchantCode' =>'xxxxxxx','Ds_Terminal' =>'001','Ds_Response' =>'0000','Ds_MerchantData' =>'','Ds_TransactionType' =>'0','Ds_ConsumerLanguage' =>'1','Ds_AuthorisationCode' =>'875284',)
$redsys =new \Buuum\Redsys($redsys_key);try {$redsys->setMerchantcode($redsys_merchant_code);$redsys->setAmount($amount);$redsys->setOrder($order);$redsys->setTerminal($redsys_merchant_terminal);$redsys->setCurrency(978);$redsys->setPan($visa_number);$redsys->setExpiryDate($visa_expiry);$redsys->setCVV($visa_cvv);$redsys->setTransactiontype('A');$redsys->setIdentifier('REQUIRED');$result =$redsys->firePayment();}catch (Exception$e) {echo$e->getMessage(); die;}var_dump($result);
$redsys =new \Buuum\Redsys($redsys_key);try {$redsys->setMerchantcode($redsys_merchant_code);$redsys->setAmount($amount);$redsys->setOrder($order);$redsys->setTerminal($redsys_merchant_terminal);$redsys->setCurrency(978);$redsys->setTransactiontype('A');$redsys->setIdentifier($client_identifier);$result =$redsys->firePayment();}catch (Exception$e) {echo$e->getMessage(); die;}
$redsys =new \Buuum\Redsys($redsys_key);try {$redsys->setMerchantcode($redsys_merchant_code);$redsys->setAmount($amount);$redsys->setOrder($order);$redsys->setTerminal($redsys_merchant_terminal);$redsys->setCurrency(978);$redsys->setTransactiontype(3);$result =$redsys->firePayment(); }catch (Exception$e) {echo$e->getMessage(); die;}
#### result output
array ('error' =>true,'code' =>'SIS0051','DS_MERCHANT_MERCHANTCODE' =>'xxxxx','DS_MERCHANT_AMOUNT' =>'1000','DS_MERCHANT_ORDER' =>'9932453','DS_MERCHANT_TERMINAL' =>'001','DS_MERCHANT_CURRENCY' =>'978','DS_MERCHANT_PAN' =>'4548812049400004','DS_MERCHANT_EXPIRYDATE' =>'2012','DS_MERCHANT_CVV2' =>'123','DS_MERCHANT_TRANSACTIONTYPE' =>'A','DS_MERCHANT_IDENTIFIER' =>'REQUIRED',)
array ('error' =>false,'code' =>'0','Ds_Amount' =>'1000','Ds_Currency' =>'978','Ds_Order' =>'1234524534','Ds_Signature' =>'Xfh84TG95t7XRKQV/UGyhH+lXd6PFuGPeU25fgNpGUc=','Ds_MerchantCode' =>'xxxxxx','Ds_Terminal' =>'1','Ds_Response' =>'0000','Ds_AuthorisationCode' =>'415446','Ds_TransactionType' =>'A','Ds_SecurePayment' =>'0','Ds_Language' =>'1','Ds_ExpiryDate' =>'2012','Ds_Merchant_Identifier' =>'4597a931b735a7d8e55252e25894fa6dd3a9bed4','Ds_MerchantData' =>array (),'Ds_Card_Country' =>'724',)
For get error messages use classhttps://github.com/eusonlito/redsys-Messages
$error = \Redsys\Messages\Messages::getByCode($result['code']);# error outputarray ('code' =>'SIS0051','message' =>'Ds_Merchant_Order Número de pedido repetido','msg' =>'MSG0001','detail' =>'',)
The MIT License (MIT)
Copyright (c) 2016
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
About
Simple php class with redsys soap