https://github.com/matthiasmullie/ogone
Wrapper class to make Ogone implementations a lot easier.
https://github.com/matthiasmullie/ogone
Last synced: about 1 month ago
JSON representation
Wrapper class to make Ogone implementations a lot easier.
- Host: GitHub
- URL: https://github.com/matthiasmullie/ogone
- Owner: matthiasmullie
- Created: 2013-04-15T12:12:04.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-24T11:45:06.000Z (about 10 years ago)
- Last Synced: 2025-03-28T03:32:33.540Z (about 2 months ago)
- Language: PHP
- Size: 166 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ogone
## Example usage
```php
/*
* Build your Ogone object; you'll need to do this to build the submission form
* as well as to process the result from Ogone.
*/// order details
$orderID = 1;
$amount = 50;
$currency = 'EUR';// your Ogone config setup (see Ogone class phpdoc for more info)
$pspId = '';
$shaIn = '';
$shaOut = '';
$digest = 'SHA512'; // value can be either SHA1', 'SHA256' or 'SHA512
$environment = 'test'; // value can be either 'test' or 'prod'
$method = 'post'; // value can be either 'get' or 'post'
$verification = 'each'; // value can be either 'main' or 'each'// create Ogone-object
use MatthiasMullie\Ogone;
$ogone = new Ogone\Ogone($orderID, $amount, $pspId, $currency, $shaIn, $shaOut, $digest);// define test or production (for real payments) Ogone environment
$ogone->setEnvironment($environment);
$ogone->setMethod($method);
$ogone->setVerification($verification);/*
* Initialize a payment: build the form data to submit to Ogone.
*/// add parameters (see parameter list: https://secure.ogone.com/ncol/Ogone_e-Com-ADV_EN.pdf)
// here are some sample parameters
$ogone->setParameter('LANGUAGE', 'nl');
$ogone->setParameter('CN', 'Matthias Mullie');
$ogone->setParameter('EMAIL', '[email protected]');
$ogone->setParameter('OWNERADDRESS', '');
$ogone->setParameter('OWNERZIP', '');
$ogone->setParameter('OWNERTOWN', '');
$ogone->setParameter('OWNERCTY', '');
$ogone->setParameter('ACCEPTURL', '');
$ogone->setParameter('DECLINEURL', '');
$ogone->setParameter('EXCEPTIONURL', '');
$ogone->setParameter('CANCELURL', '');
$ogone->setParameter('TP', '');
// ...// build form to submit
$form = '';
$parameters = $ogone->getFormParameters();
foreach($parameters as $key => $value) {
$form .= '';
}
$form .= '';
$form .= '';/*
* Verify a payment.
*/// verify the SHA signature
if($ogone->isCorrectSHA()) {
// fetch all details retrieved from Ogone...
$ogoneResponse = $ogone->getDetail(); // no parameter// ... or retrieve a specific value
$status = $ogone->getDetail('status'); // 'status' parameter// your business logic here
}
```## Installation
Simply add a dependency on matthiasmullie/ogone to your composer.json file if you use [Composer](https://getcomposer.org/) to manage the dependencies of your project:
```sh
composer require matthiasmullie/ogone
```Although it's recommended to use Composer, you can actually include these files anyway you want.
## License
Ogone is [MIT](http://opensource.org/licenses/MIT) licensed.