PHP code example of deruwe / atos-sips

1. Go to this page and download the library: Download deruwe/atos-sips 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/ */

    

deruwe / atos-sips example snippets


  
	use Sips\ShaComposer\AllParametersShaComposer;
	$shaComposer = new AllParametersShaComposer($passphrase);

	

	use Sips\Passphrase;
	use Sips\PaymentRequest;

	$passphrase = new Passphrase('passphrase-defined-in-sips-interface');
	$shaComposer = new AllParametersShaComposer($passphrase);

	$paymentRequest = new PaymentRequest($shaComposer);

	// Optionally set Sips uri, defaults to TEST account
	//$paymentRequest->setSipsUri(PaymentRequest::PRODUCTION);

	// Set various params:
	$paymentRequest->setMerchantId('123456');
    $paymentRequest->setKeyVersion('1');
    $paymentRequest->setTransactionReference($sipsTransactionReference);
    $paymentRequest->setAmount(1000);
    $paymentRequest->setCurrency('EUR');
    $paymentRequest->setLanguage('nl');
    $paymentRequest->setPaymentBrand('VISA');
	// ...

	$paymentRequest->validate();

	// Create Http client to send the paymentRequest
    // We use Zend_Http_Client here, feel free to use your favourite HTTP client library
	$client = new Zend_Http_Client($paymentRequest->getSipsUri());
	$client->setParameterPost('Data', $paymentRequest->toParameterString());
    $client->setParameterPost('InterfaceVersion', '<Sips interfaceVersion>');
    $client->setParameterPost('Seal', $paymentRequest->getShaSign());

    $response = $client->request(Zend_Http_Client::POST);
    echo $response->getRawBody();
    exit();


  	
	use Sips\PaymentResponse;
	use Sips\ShaComposer\AllParametersShaComposer;

	// ...

	$paymentResponse = new PaymentResponse($_REQUEST);

	$passphrase = new Passphrase('passphrase-defined-in-sips-interface');
	$shaComposer = new AllParametersShaComposer($passphrase);

	if($paymentResponse->isValid($shaComposer) && $paymentResponse->isSuccessful()) {
		// handle payment confirmation
	}
	else {
		// perform logic when the validation fails
	}