Download the PHP package italiamultimedia/xpay-web without Composer

On this page you can find all versions of the php package italiamultimedia/xpay-web. 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 xpay-web

italiamultimedia/xpay-web

PHP library for Nexi XPay Web / Phoenix API-key integrations.

This package targets the API-key based XPay Web endpoints, not the legacy Alias + MAC integration.

Implemented functionality:

Installation

The HTTP payment services need:

For a plain PHP project, one simple combination is:

Frameworks may already provide these services; in that case, pass your framework's PSR implementations instead.

Configuration

You need two values from your application configuration:

The environment matters because it decides which Nexi API base URL is used:

Use the sandbox environment with a sandbox API key. Use the production environment only with a production API key.

Example .env values:

This package does not read .env files directly. Read those values with your framework/configuration layer, then pass them into PaymentSystemSettings.

Plain PHP example:

You can also pass the strings directly:

Using Configuration::ENVIRONMENT_TEST and Configuration::ENVIRONMENT_PRODUCTION is preferred because it avoids typos.

Create Services

Create one DependencyContainer with your payment settings, then use PaymentServiceFactory to build services.

Create A Hosted Payment Page

Create an order in your application first, then send Nexi the hosted payment page request.

Notes:

If you do have a webhook listener:

Verify Payment Status

After the customer returns to your resultUrl, do not trust only the redirect parameters. Verify the order through Nexi:

The result redirect may include paymentId, but this library treats your local orderId as the source of truth.

Hosted Result And Notifications

The result URL should already be tied to the local order.

For server-to-server notifications, Nexi posts JSON to your notificationUrl. Parse that received payload and validate it with the security token you stored when creating the hosted payment page:

For notification-only parsing, new DependencyContainer() is enough because payment settings are not needed.

Error Handling

API errors are thrown as NexiApiException.

Supported customer message language codes are en and it. Unknown languages fall back to English.

Recurring Hosted Payments

Nexi recurring payments are MIT payments: Merchant Initiated Transactions. The first customer-present payment creates a contract, then later charges can be made against that contract.

This package supports both phases:

For the first payment, Nexi still receives the same POST /orders/hpp request; the recurrence data tells Nexi to create a contract from the card used on the hosted page.

Use MIT_SCHEDULED when the later merchant charges have a defined schedule, for example every 30 days or on the first day of each month. Nexi also accepts contractExpiryDate and contractFrequency for scheduled contracts.

Use MIT_UNSCHEDULED when the later merchant charges do not have a fixed schedule, for example usage-based or variable-date billing.

Scheduled example:

Unscheduled example:

Store the contractId in your application together with the customer/subscription. Nexi expects it to be unique in your merchant domain.

Subsequent recurring charges are the second phase of Nexi recurring payments and use POST /orders/mit. They are server-to-server calls and do not redirect the customer back to the hosted page.

For subsequent payments:

Manual Sandbox Scripts

The sandbox scripts do not test server-to-server notifications. To test notification parsing, point notificationUrl at a real listener in your application and pass the received payload to HostedPaymentResultService::parseHostedPaymentNotification().

Development


All versions of xpay-web with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
fig/http-message-util Version ^1
psr/http-client Version ^1.0
psr/http-factory Version ^1
psr/log Version ^3
webservco/data Version ^1
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 italiamultimedia/xpay-web contains the following files

Loading the files please wait ...