PHP code example of simotod / omnipay-setefi

1. Go to this page and download the library: Download simotod/omnipay-setefi 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/ */

    

simotod / omnipay-setefi example snippets



	$gateway = Omnipay::create('\SimoTod\OmnipaySetefi\Gateway');

	$request = $gateway->purchase(
 		array(
            'id'                    => '99999999',
            'password'              => '99999999',
            'amount'                => '1.00',
            'returnUrl'             => 'http://www.merchant.it/notify',
            'cancelUrl'             => 'http://www.merchant.it/error',
            'transactionId'         => 'TRCK0001',
            'description'           => 'Description'
            'language'              => \SimoTod\OmnipaySetefi\Gateway::LANG_ITA
 		)
	);

	//Set test mode. Remove this row or set to false in production.
	$request->setTestMode(true);

	$response = $request->send();

	if ($response->isRedirect()) {
		// (optional) save the $response->getTransactionReference() token.
        // redirect to offsite payment Setefi
        $response->redirect();
    } else {
        // payment failed: display message to customer
        echo $response->getMessage();
    }