Download the PHP package mlocati/nexi-xpay without Composer

On this page you can find all versions of the php package mlocati/nexi-xpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nexi-xpay

MLocati's unofficial Nexi XPay client library for PHP

This project contains a PHP library that makes it easy to use the Nexi XPay APIs (not for Intesa Sanpaolo bank).

This requires a merchant Alias and a MAC Key. If instead you have an API Key, you may need to use this other library.

Installation

Install with composer

Simply run the following command:

Manual installation

Download the code of this library, place it somewhere in your project, and add this PHP instruction before using anything of this library:

Usage

Configuration

First of all, you have need a merchant alias and a MAC Key (provided to you by Nexi).

You also need the base URL of the Nexi XPay API. You can find its default value in MLocati\Nexi\XPay\Configuration:

This library provides an easy way to represent a configuration, by using the MLocati\Nexi\XPay\Configuration\FromArray class:

Of course you can override the default base URL (use the baseUrl array key).

You can also use a custom class, provided it implements the MLocati\Nexi\XPay\Configuration interface.

The Nexi Client

The main class of this library is MLocati\Nexi\XPay\Client: it allows you invoking the Nexi APIs.

You can create an instance of it simply with:

HTTP Communications

The Nexi client needs to perform HTTP requests. In order to do that, it automatically detects the best available way to do that:

You can also provide your own implementation, provided it implements the MLocati\Nexi\XPay\HttpClient interface. That way you can easily log the communication with the Nexi servers, as well as customize the HTTP client (for example because you are behind a proxy).

For example, if you want to use your custom HTTP client implementation, you can simply write:

Sample Usage

The Nexi client provided by this library allows you to use some of the methods you can find in the Nexi documentation website.

Here's a sample code that allows you to accept payments:

  1. Your customer is on apage of your website where you want to place a "Pay with Nexi" button:

  2. when the users click the "Pay with Nexi" button, they will go to the Nexi servers where they can enter their credit card
  3. when the users pay on the Nexi website, they will come back to your website at the URL used in the setUrl() above. When that URL is called, you can have some code like this:

    
    <?php
    use MLocati\Nexi\XPay\Entity\SimplePay\Callback\Data;
    
    $data = Data::fromCustomerRequest($_GET);
    $data->checkMac($configuration);
    if ($data->getEsito() === \MLocati\Nexi\XPay\Entity\Response::ESITO_OK) {
       // The order has been paid
    } else {
       // Display an error message and let users come back to the checkout page
    }

All versions of nexi-xpay with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.2
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mlocati/nexi-xpay contains the following files

Loading the files please wait ....