PHP
XPay Overview
The PHP language is an open source language called server side: this means that, unlike languages such as HTML, CSS or JavaScript that are interpreted first by the browser, the PHP code is executed directly on the web server, where the scripts formulate HTML instructions that are only at the end transmitted to the browser and then to the visitor.
Installation
You can install the Nexi SDK for PHP using the composer command:
code
composer require nexigroup/npg-sdkTBD
Configuration
Before you can communicate with the gateway, you must create a configuration object that implements the ICONFIGURATION interface.
Once instantiated, this object can invoke the PAYMENTGATEWAYCLIENT constructor that instantiates the object that handles calls to the gateway.
Example of use
Having obtained the object indicated in the previous section, it is possible to proceed with the requests to the gateway. Below is an example of payment using the method Hosted Payment Page:
Objects, as well as "set" methods for setting parameters, are referenced by the POST/orders/hpp API. The SDK has been developed by keeping the parameter names the same as those of the gateway APIs, to facilitate and improve the user experience.
Example of use
<?php $paymentGatewayClient = new PaymentGatewayClient($config);
Objects, as well as "set" methods for setting parameters, are referenced by the API POST /orders/hpp
. The SDK was developed keeping the parameter names the same as those of the gateway API, to facilitate and improve the user experience.