1. Go to this page and download the library: Download ingenico/ogone-sdk-php 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/ */
ingenico / ogone-sdk-php example snippets
use Ogone\ShaComposer\LegacyShaComposer;
$shaComposer = new LegacyShaComposer($passphrase);
use Ogone\ShaComposer\AllParametersShaComposer;
$shaComposer = new AllParametersShaComposer($passphrase);
use Ogone\Passphrase;
use Ogone\Ecommerce\EcommercePaymentRequest;
use Ogone\ShaComposer\AllParametersShaComposer;
use Ogone\FormGenerator\SimpleFormGenerator;
$passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaInParameterFilter); //optional
$ecommercePaymentRequest = new EcommercePaymentRequest($shaComposer);
// Optionally set Ogone uri, defaults to TEST account
//$ecommercePaymentRequest->setOgoneUri(EcommercePaymentRequest::PRODUCTION);
// Set various params:
$ecommercePaymentRequest->setOrderid('123456');
$ecommercePaymentRequest->setAmount(150); // in cents
$ecommercePaymentRequest->setCurrency('EUR');
// ...
$ecommercePaymentRequest->validate();
$formGenerator = new SimpleFormGenerator;
$html = $formGenerator->render($ecommercePaymentRequest);
// Or use your own generator. Or pass $ecommercePaymentRequest to a view
use Ogone\Passphrase;
use Ogone\DirectLink\CreateAliasRequest;
use Ogone\ParameterFilter\AliasShaInParameterFilter;
use Ogone\ShaComposer\AllParametersShaComposer;
use Ogone\DirectLink\Alias;
$passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new AliasShaInParameterFilter);
$createAliasRequest = new CreateAliasRequest($shaComposer);
// Optionally set Ogone uri, defaults to TEST account
// $createAliasRequest->setOgoneUri(CreateAliasRequest::PRODUCTION);
// set DNO (Card/account number), ED (Expiry date (MMYY)), CVC (Card Verification Code)
// and the SHASIGN
use Ogone\DirectLink\DirectLinkPaymentRequest;
use Ogone\Passphrase;
use Ogone\ShaComposer\AllParametersShaComposer;
use Ogone\DirectLink\Alias;
$passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaInParameterFilter); //optional
$directLinkRequest = new DirectLinkPaymentRequest($shaComposer);
$directLinkRequest->setOrderid('order_1234');
$alias = new Alias('customer_123');
$directLinkRequest->setAlias($alias);
$directLinkRequest->setPspid('123456');
$directLinkRequest->setUserId('ogone-api-user');
$directLinkRequest->setPassword('ogone-api-password');
$directLinkRequest->setAmount(100);
$directLinkRequest->setCurrency('EUR');
$directLinkRequest->validate();
// now create a url to be posted to Ogone
// you have access to $directLinkRequest->toArray(), $directLinkRequest->getOgoneUri() and directLinkRequest->getShaSign()
use Ogone\DirectLink\DirectLinkQueryRequest;
use Ogone\Passphrase;
use Ogone\ShaComposer\AllParametersShaComposer;
use Ogone\DirectLink\Alias;
$passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaInParameterFilter); //optional
$directLinkRequest = new DirectLinkQueryRequest($shaComposer);
$directLinkRequest->setPspid('123456');
$directLinkRequest->setUserId('ogone-api-user');
$directLinkRequest->setPassword('ogone-api-password');
$directLinkRequest->setPayId('order_1234');
$directLinkRequest->validate();
// now create a url to be posted to Ogone
// you have access to $directLinkRequest->toArray(), $directLinkRequest->getOgoneUri() and directLinkRequest->getShaSign()
use Ogone\DirectLink\DirectLinkMaintenanceRequest;
use Ogone\DirectLink\MaintenanceOperation;
use Ogone\Passphrase;
use Ogone\ShaComposer\AllParametersShaComposer;
use Ogone\DirectLink\Alias;
$passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaInParameterFilter); //optional
$directLinkRequest = new DirectLinkMaintenanceRequest($shaComposer);
$directLinkRequest->setPspid('123456');
$directLinkRequest->setUserId('ogone-api-user');
$directLinkRequest->setPassword('ogone-api-password');
$directLinkRequest->setPayId('order_1234');
$directLinkRequest->setOperation(new MaintenanceOperation(MaintenanceOperation::OPERATION_AUTHORISATION_RENEW));
$directLinkRequest->validate();
// now create a url to be posted to Ogone
// you have access to $directLinkRequest->toArray(), $directLinkRequest->getOgoneUri() and directLinkRequest->getShaSign()
use Ogone\Ecommerce\EcommercePaymentResponse;
use Ogone\ShaComposer\AllParametersShaComposer;
// ...
$ecommercePaymentResponse = new EcommercePaymentResponse($_REQUEST);
$passphrase = new Passphrase('my-sha-out-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaOutParameterFilter); //optional
if($ecommercePaymentResponse->isValid($shaComposer) && $ecommercePaymentResponse->isSuccessful()) {
// handle payment confirmation
}
else {
// perform logic when the validation fails
}
use Ogone\DirectLink\CreateAliasResponse;
use Ogone\ShaComposer\AllParametersShaComposer;
// ...
$createAliasResponse = new CreateAliasResponse($_REQUEST);
$passphrase = new Passphrase('my-sha-out-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaOutParameterFilter); //optional
if($createAliasResponse->isValid($shaComposer) && $createAliasResponse->isSuccessful()) {
// Alias creation is succesful, get the Alias object
$alias = $createAliasResponse->getAlias();
}
else {
// validation failed, retry?
}
use Ogone\DirectLink\DirectLinkPaymentResponse;
$directLinkResponse = new DirectLinkPaymentResponse('ogone-direct-link-result-as-xml');
if($directLinkResponse->isSuccessful()) {
// handle payment confirmation
} else {
// perform logic when the validation fails
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.