Skip to content
Ogone PHP library
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Ogone PHP library

This library allows you to easily implement an Ogone integration into your project. It provides the necessary components to complete a correct payment flow with the Ogone platform.


  • PHP 5.3
  • network connection between your webserver and the Ogone platform

As always, this is work in progress. Please feel free to fork this project and let them pull requests coming!


The library complies to the PSR-0 standard, so it can be autoloaded using PSR-0 classloaders like the one in Symfony2. See autoload.php for an example.

  • Create a PaymentRequest, containing all the info needed by Ogone.
  • Generate a form
  • Submit it to Ogone (client side)
  • Receive a PaymentResponse back from Ogone (as a HTTP Request)

Both PaymentRequest and PaymentResponse are authenticated by comparing the SHA sign, which is a hash of the parameters and a secret passphrase. You can create the hash using a ShaComposer.

SHA Composers

Ogone provides 2 methods to generate a SHA sign:

  • "Main parameters only"

    Main parameters only

    Implementation using this library is trivial:

    use Ogone\ShaComposer\LegacyShaComposer;
    $shaComposer = new LegacyShaComposer($passphrase);
  • "Each parameter followed by the passphrase" This method allows you to select one of the following encryption methods: SHA-1 (default), SHA-256 or SHA-512.

    Each parameter followed by the passphrase

    Implementation using this library is trivial:

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

This library currently supports both the legacy method "Main parameters only" and the new method "Each parameter followed by the passphrase" with SHA-1 encryption.

PaymentRequest and FormGenerator


    use Ogone\Passphrase;
    use Ogone\PaymentRequest;
    use Ogone\FormGenerator;

    $passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
    $shaComposer = new AllParametersShaComposer($passphrase);
    $shaComposer->addParameterFilter(new ShaInParameterFilter); //optional

    $paymentRequest = new PaymentRequest($shaComposer);

    // Optionally set Ogone uri, defaults to TEST account

    // Set various params:
    $paymentRequest->setAmount('150'); // in cents
    // ...


    $formGenerator = new SimpleFormGenerator; 
    $html = $formGenerator->render($paymentRequest);
    // Or use your own generator. Or pass $paymentRequest to a view


    use Ogone\PaymentResponse;
    use Ogone\ShaComposer\AllParametersShaComposer;

    // ...

    $paymentResponse = new PaymentResponse($_REQUEST);

    $passphrase = new Passphrase('my-sha-out-passphrase-defined-in-ogone-interface');
    $shaComposer = new AllParametersShaComposer($passphrase);
    $shaComposer->addParameterFilter(new ShaOutParameterFilter); //optional

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

Parameter filters

ParameterFilters are used to filter the provided parameters (no shit Sherlock). Both ShaIn- and ShaOutParameterFilters are provided and are based on the parameter lists defined in the Ogone documentation. Parameter filtering is optional, but we recommend using them to enforce expected parameters.

Something went wrong with that request. Please try again.