PHPackages                             unipag/unipag - 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. [API Development](/categories/api)
4. /
5. unipag/unipag

ActiveLibrary[API Development](/categories/api)

unipag/unipag
=============

A PHP Client for Unipag

0.3.0(11y ago)11.5k1ISCPHPPHP &gt;=5.2

Since Feb 10Pushed 11y ago2 watchersCompare

[ Source](https://github.com/unipag/unipag-php)[ Packagist](https://packagist.org/packages/unipag/unipag)[ Docs](http://www.unipag.com)[ RSS](/packages/unipag-unipag/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (10)Used By (0)

Unipag Client for PHP
=====================

[](#unipag-client-for-php)

[![https://travis-ci.org/unipag/unipag-php.png?branch=master](https://camo.githubusercontent.com/6e6c41979dacffe8ec95491897b0c10fc6f64982736f8fec546091086d3c913a/68747470733a2f2f7472617669732d63692e6f72672f756e697061672f756e697061672d7068702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/unipag/unipag-php)Requirements
------------

[](#requirements)

PHP versions 5.2, 5.3, 5.4, 5.5 compiled with cURL.

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

[](#installation)

### Install with Composer

[](#install-with-composer)

If you're using [Composer](http://getcomposer.org) to manage dependencies, you can add Unipag Client for PHP with it:

```
{
    "require": {
        "unipag/unipag": ">=0.1.0"
    }
}
```

or to get the latest version off the master branch:

```
{
    "require": {
        "unipag/unipag": "dev-master"
    }
}
```

### Install source from GitHub

[](#install-source-from-github)

Install the source code:

```
$ git clone git://github.com/unipag/unipag-php.git
```

And include it using the autoloader:

```
require_once '/your/libraries/path/Unipag/Autoloader.php';
Unipag_Autoloader::register();
```

Or, if you're using Composer:

```
require_once 'vendor/autoload.php';
```

Sample usage
------------

[](#sample-usage)

### Create invoice

[](#create-invoice)

```
// Get your key at https://my.unipag.com
Unipag_Config::$api_key = '';

$invoice = Unipag_Invoice::create(array(
    'amount' => 42,
    'currency' => 'USD',
));

// Done. $invoice->id now contains unique id of this invoice at Unipag.
```

### Handle webhook from Unipag

[](#handle-webhook-from-unipag)

Create a standalone page on your website which will handle events sent by Unipag. Register URL of this page at  &gt; Settings &gt; Webhooks. Initialize page code as following:

```
Unipag_Config::$api_key = '';

$event = Unipag_Event::fromJson($HTTP_RAW_POST_DATA);

// In this example we subscribe to invoice-related events only:
if ($event->related_object instanceof Unipag_Invoice) {

    // Always reload information from Unipag for security reasons:
    $invoice = $event->related_object->reload();

    // Now $invoice contains the most recent information, securely loaded from Unipag.
}
```

Tip: webhooks can be a pain to debug. Check out Unipag Network Activity log, it is available at  &gt; Network Activity. You may find it useful for your webhook handlers debugging.

### Usage of invoice "custom\_data" property

[](#usage-of-invoice-custom_data-property)

Invoice objects have an optional "custom\_data" property, which can be used to store up to 32KB of arbitrary data in JSON format. You can freely use this field to store additional information about invoices, which is specific for your application.

In PHP, you can use associative and numeric arrays, strings, numbers, boolean and NULL values in any combination to store them in custom\_data. All of these types will be properly serialized when sending to Unipag and deserialized when fetching them back. Consider the following examples, all of them are valid usages of custom\_data property:

```
Unipag_Config::$api_key = '';

$invoice = Unipag_Invoice::create(array(
    'amount' => 42,
    'currency' => 'USD',
));

// Store associative and numeric arrays, and single values
$invoice->custom_data = array(
    'address' => array(
        'billing' => '5863 Gentle Pond Rise, Suspension, Ontario, CA',
        'shipping' => '9215 Red Ridge, Lancer, Idaho, US',
    ),
    'contact_phones' => array('555-4242', '555-9000'),
    'magic_number' => 42,
);
$invoice->save();

// Clean everything out
$invoice->custom_data = NULL;
$invoice->save();

// Store a single value. Yes, it will be a valid JSON.
$invoice->custom_data = True;
$invoice->save();

// Store numeric array as a root element. Let's assume that we need to save cart items:
$invoice->custom_data = array(
    array(
        'product' => 'apples',
        'price' => 10.0,
        'quantity' => 1,
    ),
    array(
        'product' => 'oranges',
        'price' => 12.5,
        'quantity' => 2,
    ),
);
$invoice->save();
```

Report bugs
-----------

[](#report-bugs)

Report issues to the project's [Issues Tracking](https://github.com/unipag/unipag-php/issues) on Github.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~71 days

Recently: every ~105 days

Total

9

Last Release

4311d ago

### Community

Maintainers

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

---

Top Contributors

[![stebunovd](https://avatars.githubusercontent.com/u/1415093?v=4)](https://github.com/stebunovd "stebunovd (38 commits)")

---

Tags

apipaymentsunipag

### Embed Badge

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

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

###  Alternatives

[transbank/transbank-sdk

Transbank SDK

62658.8k14](/packages/transbank-transbank-sdk)[openbuildings/paypal

PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.

29176.3k](/packages/openbuildings-paypal)[samerior/mobile-money

Mobile payments API - Kenya

252.3k](/packages/samerior-mobile-money)

PHPackages © 2026

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