Skip to content
PayXpert Payment Page System PHP client library.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PayXpert Payment Page client

Build Status

This library is the official PHP client to interact with the PayXpert Payment Page system. The whole payment workflow is implemented through easy to use methods.


Easy installation with Composer is available. Install with composer.phar.

php composer.phar require "payxpert/connect2pay"

Basic usage

The example below shows a simple use to create a Credit Card payment.

use PayXpert\Connect2Pay\Connect2PayClient;

$connect2pay = "";
// This will be provided once your account is approved
$originator  = "000000";
$password    = "Gr3atPassw0rd!";

$c2pClient = new Connect2PayClient($connect2pay, $originator, $password);

// Set all information for the payment
// To charge €25.99
$c2pClient->setOrderDescription("Payment of €25.99");
// Extra custom data that are returned with the payment status
$c2pClient->setCtrlCustomData("Give that back to me please !!");
// Where the customer will be redirected after the payment
// URL on the merchant site that will receive the callback notification

if ($c2pClient->validate()) {
  if ($c2pClient->preparePayment()) {
    // The customer token info returned by the payment page could be saved in session (may
    // be used later when the customer will be redirected from the payment page)
    $_SESSION['merchantToken'] = $c2pClient->getMerchantToken();

    // The merchantToken must also be used later to validate the callback to avoid that anyone
    // could call it and abusively validate the payment. It may be stored in local database for this.

    // Now redirect the customer to the payment page
    header('Location: ' . $c2pClient->getCustomerRedirectURL());
  } else {
    echo "error prepareTransaction: ";
    echo $c2pClient->getClientErrorMessage() . "\n";
} else {
  echo "Validation error occured: " . $c2pClient->getClientErrorMessage() . "\n";

See scripts in the examples/ folder to see more use cases.

You can’t perform that action at this time.