PHP code example of endelwar / gestpayws
1. Go to this page and download the library: Download endelwar/gestpayws 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/ */
endelwar / gestpayws example snippets
php
e EndelWar\GestPayWS\WSCryptDecryptSoapClient;
use EndelWar\GestPayWS\WSCryptDecrypt;
use EndelWar\GestPayWS\Parameter\EncryptParameter;
use EndelWar\GestPayWS\Data;
// enable or disable test environment
$enableTestEnv = true;
$soapClient = new WSCryptDecryptSoapClient($enableTestEnv);
try {
$gestpay = new WSCryptDecrypt($soapClient->getSoapClient());
} catch (\Exception $e) {
var_dump($e->getCode(), $e->getMessage());
}
// set mandatory info
$encryptParameter = new EncryptParameter();
$encryptParameter->shopLogin = 'GESPAY12345';
$encryptParameter->amount = '1.23';
$encryptParameter->shopTransactionId = '1';
$encryptParameter->uicCode = Data\Currency::EUR;
$encryptParameter->languageId = Data\Language::ITALIAN;
// set optional custom info as array
$customArray = array('STORE_ID' => '42', 'STORE_NAME' => 'Shop Abc123');
$encryptParameter->setCustomInfo($customArray);
// encrypt data
$encryptResult = $gestpay->encrypt($encryptParameter);
// get redirect link to Banca Sella
echo $encryptResult->getPaymentPageUrl($encryptParameter->shopLogin, $soapClient->wsdlEnvironment);