PHPackages                             payxpert/connect2pay - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. payxpert/connect2pay

ActiveLibrary[Payment Processing](/categories/payments)

payxpert/connect2pay
====================

PayXpert Payment Page System client library

2.73.0(5mo ago)898.9k↓24%91Apache-2.0PHPPHP &gt;=7.4CI failing

Since Mar 16Pushed 5mo ago5 watchersCompare

[ Source](https://github.com/PayXpert/connect2pay-php-client)[ Packagist](https://packagist.org/packages/payxpert/connect2pay)[ Docs](https://github.com/PayXpert/connect2pay-php-client)[ RSS](/packages/payxpert-connect2pay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (9)Used By (1)

PayXpert Payment Page client
============================

[](#payxpert-payment-page-client)

[![Build Status](https://camo.githubusercontent.com/95ad21112c7859d15f005ae8897a95a9defdeaa86b198a0bc35219d7f208090a/68747470733a2f2f7472617669732d63692e6f72672f50617958706572742f636f6e6e656374327061792d7068702d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PayXpert/connect2pay-php-client)

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.

Installation
------------

[](#installation)

Easy installation with Composer is available. Install with [`composer.phar`](http://getcomposer.org).

```
php composer.phar require "payxpert/connect2pay"
```

Basic usage
-----------

[](#basic-usage)

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

```
use PayXpert\Connect2Pay\Connect2PayClient;
use PayXpert\Connect2Pay\containers\request\PaymentPrepareRequest;
use PayXpert\Connect2Pay\containers\Order;
use PayXpert\Connect2Pay\containers\Shipping;
use PayXpert\Connect2Pay\containers\Shopper;
use PayXpert\Connect2Pay\containers\Account;
use PayXpert\Connect2Pay\containers\constant\OrderShippingType;
use PayXpert\Connect2Pay\containers\constant\PaymentMethod;
use PayXpert\Connect2Pay\containers\constant\PaymentMode;
use PayXpert\Connect2Pay\containers\constant\AccountAge;
use PayXpert\Connect2Pay\containers\constant\AccountLastChange;
use PayXpert\Connect2Pay\containers\constant\AccountPaymentMeanAge;

$connect2pay = "https://connect2.payxpert.com/";
// This will be provided once your account is approved
$originator  = "000000";
$password    = "Gr3atPassw0rd!";

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

$prepareRequest = new PaymentPrepareRequest();
$shopper = new Shopper();
$account = new Account();
$order = new Order();
$shipping = new Shipping();

// Set all information for the payment
$prepareRequest->setPaymentMethod(PaymentMethod::CREDIT_CARD);
$prepareRequest->setPaymentMode(PaymentMode::SINGLE);
// To charge €25.99
$prepareRequest->setCurrency("EUR");
$prepareRequest->setAmount(2599);
// Extra custom data that are returned with the payment status
$prepareRequest->setCtrlCustomData("Give that back to me please!!");
// Where the customer will be redirected after the payment
$prepareRequest->setCtrlRedirectURL("https://merchant.example.com/payment/redirect");
// URL on the merchant site that will receive the callback notification
$prepareRequest->setCtrlCallbackURL("https://merchant.example.com/payment/callback");

$order->setId("ABC-123456");
$order->setShippingType(OrderShippingType::DIGITAL_GOODS);
$order->setDescription("Payment of €25.99");

$shopper->setId("1234567WX");
$shopper->setFirstName("John")->setLastName("Doe");
$shopper->setAddress1("Debit Street, 45");
$shopper->setZipcode("3456TRG")->setCity("New York")->setState("NY")->setCountryCode("US");
$shopper->setHomePhonePrefix("212")->setHomePhone("12345678");
$shopper->setEmail("shopper@example.com");

$account->setAge(AccountAge::LESS_30_DAYS);
$account->setDate("20210106");
$account->setLastChange(AccountLastChange::LESS_30_DAYS);
$account->setLastChangeDate("20210106");
$account->setPaymentMeanAge(AccountPaymentMeanAge::LESS_30_DAYS);
$account->setPaymentMeanDate("20210106");
$account->setSuspicious(false);

$shipping->setName("Lady Gogo");
$shipping->setAddress1("125 Main Street");
$shipping->setZipcode("ABC-5678")->setState("NY")->setCity("New York")->setCountryCode("US");
$shipping->setPhone("+47123456789");

$shopper->setAccount($account);
$prepareRequest->setShopper($shopper);
$prepareRequest->setOrder($order);
$prepareRequest->setShipping($shipping);

$result = $c2pClient->preparePayment($prepareRequest);
if ($result !== false) {
    // 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'] = $result->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($result));
} else {
    echo "Payment preparation error occurred: " . $c2pClient->getClientErrorMessage() . "\n";
}
```

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

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance71

Regular maintenance activity

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~403 days

Recently: every ~560 days

Total

8

Last Release

165d ago

PHP version history (3 changes)v2.7.0PHP &gt;= 5.4

2.70.0PHP &gt;=5.4

2.73.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c3fd4adf0979d0e0618e50879f1e5221bf6aad29b77da3cb2a1c7ee6f8b5274?d=identicon)[payxpert](/maintainers/payxpert)

---

Top Contributors

[![holajsh](https://avatars.githubusercontent.com/u/2796216?v=4)](https://github.com/holajsh "holajsh (15 commits)")[![hdolinski](https://avatars.githubusercontent.com/u/8227024?v=4)](https://github.com/hdolinski "hdolinski (2 commits)")[![jdeniau](https://avatars.githubusercontent.com/u/1398469?v=4)](https://github.com/jdeniau "jdeniau (1 commits)")

---

Tags

3dsalipaybankbank-transfercredit-cardcreditcardpaymentpayment-gatewaypayment-pagesepawechatwechat-mini-programpaymentcredit-cardbank transferSEPA Direct Debit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/payxpert-connect2pay/health.svg)

```
[![Health](https://phpackages.com/badges/payxpert-connect2pay/health.svg)](https://phpackages.com/packages/payxpert-connect2pay)
```

###  Alternatives

[verotel/flexpay-php-client

A client to Verotel FlexPay online payment gateway

12210.4k](/packages/verotel-flexpay-php-client)[enupal/stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x

3416.5k1](/packages/enupal-stripe)[henryejemuta/laravel-monnify

A laravel package to seamlessly integrate monnify api within your laravel application

132.1k](/packages/henryejemuta-laravel-monnify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
