PHPackages                             mc2p/mc2p-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. mc2p/mc2p-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mc2p/mc2p-php
=============

PHP library for the MyChoice2Pay API.

v1.0.7(2y ago)038.3k—1.3%Apache-2.0PHPPHP &gt;=5.3.0

Since Sep 12Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (11)Used By (0)

MyChoice2Pay PHP
================

[](#mychoice2pay-php)

Overview
========

[](#overview)

MyChoice2Pay PHP provides integration access to the MyChoice2Pay API.

[![Build Status](https://camo.githubusercontent.com/98c6be1bc59aa1f0e5f646e4c2309bfed66b60442d5af453ba32d4f3de5c1cb0/68747470733a2f2f7472617669732d63692e6f72672f6d6332702f6d6332702d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mc2p/mc2p-php)

Installation
============

[](#installation)

You can install using `composer`:

```
composer require mc2p/mc2p-php

```

or from source code:

```
git clone https://github.com/mc2p/mc2p-php mc2p

```

Quick Start Example
===================

[](#quick-start-example)

```
require_once __DIR__ . '/vendor/autoload.php'; // If you install from composer

require_once('mc2p/src/MC2P/MC2PClient.php');  // If you install from source code

use MC2P\MC2PClient;

$mc2p = new MC2PClient('KEY', 'SECRET_KEY');

# Create transaction
$transaction = $mc2p->Transaction(
    array(
        "currency" => "EUR",
        "products" => array(
            array(
                "amount" => 1,
                "product_id" => "PRODUCT-ID"
            )
        )
    )
);
# or with product details
$transaction = $mc2p->Transaction(
    array(
        "currency" => "EUR",
        "products" => array(
            array(
                "amount" => 1,
                "product" => array(
                    "name" => "Product",
                    "price" => 5
                )
            )
        )
    )
);
$transaction->save();
$transaction->getPayUrl() # Send user to this url to pay
$transaction->getIframeUrl() # Use this url to show an iframe in your site

# Get plans
$plansPaginator = $mc2p->plan->itemList(null);
$count = $plansPaginator->count;
$results = $plansPaginator->results; # Application's plans
$nextList = $plansPaginator->getNextList();

# Get product, change and save
$product = $mc2p->Product(
    array(
        "id" => "PRODUCT-ID"
    )
);
$product->retrieve();
$product->price = 10;
$product->save();

# Create and delete tax
$tax = $mc2p->Tax(
    array(
        "name" => "Tax",
        "percent" => 5
    )
);
$tax->save();
$tax->delete();

# Check if transaction was paid
$transaction = $mc2p->Transaction(
    array(
        "id" => "c8325bb3-c24e-4c0c-b0ff-14fe89bf9f1f"
    )
);
$transaction->retrieve();
$transaction->status == 'D' # Paid

# Create subscription
$subscription = $mc2p->Subscription(
    array(
        "currency" => "EUR",
        "plan_id" => "PLAN-ID",
        "note" => "Note example"
    )
)
# or with plan details
$subscription = $mc2p->Subscription(
    array(
        "currency" => "EUR",
        "plan" => array(
            "name" => "Plan",
            "price" => 5,
            "duration" => 1,
            "unit" => "M",
            "recurring" => True
        ),
        "note" => "Note example"
    )
);
$subscription->save()
$subscription->getPayUrl() # Send user to this url to pay
$subscription->getIframeUrl() # Use this url to show an iframe in your site

# Receive a notification
$notificationData = $mc2p->NotificationData(JSON_DICT_RECEIVED_FROM_MYCHOICE2PAY, $mc2p);
$notificationData->getStatus() == 'D'; # Paid
$notificationData->getTransaction(); # Transaction Paid
$notificationData->getSale(); # Sale generated

```

Exceptions
==========

[](#exceptions)

```
require_once __DIR__ . '/vendor/autoload.php'; // Autoload files using Composer autoload

use MC2P\MC2PClient;

# Incorrect data
$shipping = $mc2p->Shipping(
    array(
        "name" => "Normal shipping",
        "price" => "text" # Price must be number
    )
);

try {
    $shipping->save();
} catch (MC2P\InvalidRequestMC2PError $e) {
    $e->getMessage(); # Status code
}

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~248 days

Recently: every ~397 days

Total

10

Last Release

937d ago

Major Versions

v0.1.0 → v1.0.12017-09-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/b872ed679fd7f68b7d3d051289436e39897761e4ff69224c40a5ad69d2fec45f?d=identicon)[mychoice2pay](/maintainers/mychoice2pay)

---

Top Contributors

[![abelpuentes](https://avatars.githubusercontent.com/u/884827?v=4)](https://github.com/abelpuentes "abelpuentes (27 commits)")

---

Tags

apisdkrestpaymentsmychoice2paymc2p

### Embed Badge

![Health badge](/badges/mc2p-mc2p-php/health.svg)

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

###  Alternatives

[gopay/payments-sdk-php

GoPay's PHP SDK for Payments REST API

841.6M14](/packages/gopay-payments-sdk-php)

PHPackages © 2026

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