|
Manual
This brief manual will explain how to use the EZGone class. Integration ProcessGetting StartedBefore we get started, make sure you have access to the following:
Setting up the Ogone accountBefore you do anything with the plugin itself, you need to make sure the Ogone account will actually accept the incoming requests. To do so, log-in on your Ogone account and head over to the "Technical Information" page. Under "Data and origin verification", fill in a secret key you have chosen yourself. This key will be used to hash the parameters so they cannot be tampered. Now click "Confirm" to save the changes. There isn't actually any more configuration to do in order to use the basic functionality of the EZGone API. Of, course, you can customize the Ogone account to its full extent, but for this I'd recommend to take a look at the Ogone integration manual. Setting up EZGonePlace the ezgone-libs.php file on your web server. That's it. Calling the APIIn order to generate the link to the Ogone payment page, you'll first need to include the EZGone file in your PHP code. The best thing to do is to put the code below as early as possible in your PHP script: require 'path to the EZGone file/ezgone-libs.php'; Of course, the "path to the EZGone file" needs to be replaced with the exact location of the EZGone file. Now it's time to create the parameters and assign a value to each one of them. In this example I'll just call the basic parameters (being the PSPID, the order reference, the total amount of the transaction, the languae of the payment page and the currency): $pspid = new PayParam("pspid");
$orderid= new PayParam("orderid");
$amount= new PayParam("amount");
$language= new PayParam("language");
$currency = new PayParam("currency");Basically what happened is that I've told the API that I'd like to send over these parameters to the Ogone server so they can be used in the payment process. Now we simply need to assign a value to each one of them: $pspid->set_value("YourOgoneUsername");
$amount->set_value("5000"); // The total amount multiplied by 100
$orderid->set_value("order1288834");
$language->set_value("en_US"); // The page will be displayed in English
$currency->set_value("EUR"); // The chosen currency will be EuroThe API now knows which parameters to send and which values will be assigned to these parameters. The only thing that's left is to tell the API to hash the parameters and to generate the HTML form that will enable the card holder to be redirected to the Ogone servers. The only thing you need to do is: generate_prod_payment($display, $secretkey); or generate_test_payment($display, $secretkey); depending on the environment you wish to enable (test or production). You may notice the $display and $secretkey parameters. These are mandatory and will tell the plugin which text to display on the payment button ($display) and what secret key to use in order to hash the parameters (see Setting up the Ogone Account). Once you've done this, the API will generate a simple button that will be displayed wherever you've inserted the "generate" function. ReferencesIn order to get the most out of your installation, you might consider to take a look at the following documentation:
UTF-8 Support (optional)If you want to use UTF-8 encoding for enhanced character support, you can actually call the Generate payment functions with an additional argument: generate_prod_payment($display, $secretkey, $encoding); or generate_test_payment($display, $secretkey, $encoding); depending on the environment you wish to enable (test or production). If you assing the value "UTF" to the encoding argument, it will call the special UTF-8 payment page. Leaving the argument blank or assigning ISO to it will call the standard payment page. Important notesNever assign values directly to the $ezgone_methods var as it might keep the API from functioning correctly. Using the API doesn't guarantee the safety of your online payments. Always configure your fraud prevention module as good as possible and consider using a HTTPS connection instead of plain HTTP. |