PHPackages                             bizvip/unipayment.client - 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. bizvip/unipayment.client

ActiveLibrary[Payment Processing](/categories/payments)

bizvip/unipayment.client
========================

This SDK provides a convenient abstraction of UniPayment's Gateway API and allows developers to focus on payment flow/e-commerce integration rather than on the specific details of client-server interaction using the raw API.

1.1.5(2y ago)028MITPHPPHP ^7.3 || ^8.0

Since Feb 21Pushed 2y agoCompare

[ Source](https://github.com/bizvip/UniPaymentClient.PHP)[ Packagist](https://packagist.org/packages/bizvip/unipayment.client)[ Docs](https://unipayment.io)[ RSS](/packages/bizvip-unipaymentclient/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (4)Used By (0)

UniPayment PHP Client
=====================

[](#unipayment-php-client)

[![GitHub license](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/UniCryptoLab/UniPaymentClient.PHP/blob/main/UniPaymentClient/LICENSE.txt)[![Packagist](https://camo.githubusercontent.com/d5594aa8b562583a5057aec52e4823a8bec6642df5bc1af9cbc6269f213f490c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f756e697061796d656e742f636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/unipayment/client)

A PHP client for the [UniPayment Client API](https://unipayment.readme.io/reference/overview).

This SDK provides a convenient abstraction of UniPayment's Gateway API and allows developers to focus on payment flow/e-commerce integration rather than on the specific details of client-server interaction using the raw API.

Getting Started
---------------

[](#getting-started)

[SDK Tutorial](https://unipayment.io/en/docs/sdk/tutorial/)

Before using the UniPayment API, sign up for your [API key](https://console.unipayment.io/).

If you want to use the Sandbox, sign up [here](https://sandbox-console.unipayment.io/).

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

[](#installation)

### Install Composer

[](#install-composer)

```
curl -sS https://getcomposer.org/installer | php
```

### Install via composer

[](#install-via-composer)

Add unipayment/client into require section of composer.json

```
{
  "require": {
    "unipayment/client": "1.*"
  }
}
```

Initializing UniPayment client
------------------------------

[](#initializing-unipayment-client)

```
client = new \UniPayment\Client\UniPaymentClient();
client->getConfig()->setClientId("your client id");
client->getConfig()->setClientSecret("you client secret");
```

Sandbox is used in the same way with is\_sandbox as true.

```
$client = new \UniPayment\Client\UniPaymentClient();
$client->getConfig()->setClientId("your client id");
$client->getConfig()->setClientSecret("you client secret");
$client->getConfig()->setIsSandbox(true)
```

Create an invoice
-----------------

[](#create-an-invoice)

> Reference：[https://unipayment.readme.io/reference/create\_invoice](https://unipayment.readme.io/reference/create_invoice)

```
$client_id='your client id'
$client_secret='your client secret'
$app_id = 'your payment app id'

$createInvoiceRequest = new \UniPayment\Client\Model\CreateInvoiceRequest();
$createInvoiceRequest->setAppId($app_id);
$createInvoiceRequest->setPriceAmount("10.05");
$createInvoiceRequest->setPriceCurrency("USD");
$createInvoiceRequest->setNotifyUrl("https://example.com/notify");
$createInvoiceRequest->setRedirectUrl("https://example.com/redirect");
$createInvoiceRequest->setOrderId("#123456");
$createInvoiceRequest->setTitle("MacBook Air");
$createInvoiceRequest->setDescription("MacBookAir (256#)");

$client = new \UniPayment\Client\UniPaymentClient();
$client->getConfig()->setClientId($client_id);
$client->getConfig()->setClientSecret($client_secret);

create_invoice_response = $this->uniPaymentClient->createInvoice($createInvoiceRequest);
```

### CreateInvoiceResponse

[](#createinvoiceresponse)

```
{
  "code": "OK",
  "msg": "",
  "data": {
    "app_id": "cee1b9e2-d90c-4b63-9824-d621edb38012",
    "invoice_id": "Dj2mNCXXWCGKT89kcU8NJn",
    "order_id": "ORDER_123456",
    "price_amount": 2.0,
    "price_currency": "USD",
    "network": null,
    "address": null,
    "pay_amount": 0.0,
    "pay_currency": null,
    "exchange_rate": 0.0,
    "paid_amount": 0.0,
    "create_time": "2022-09-14T06:31:57",
    "expiration_time": "2022-09-14T06:36:57",
    "confirm_speed": 2,
    "status": 1,
    "error_status": 0,
    "invoice_url": "https://sandbox-app.unipayment.io/i/Dj2mNCXXWCGKT89kcU8NJn"
  }
}
```

Handle IPN
----------

[](#handle-ipn)

> Reference：

> Invoice Status:

IPNs (Instant Payment Notifications) are sent to the notify\_url when order status is changed to paid, confirmed and complete.

```
$app_id='your client id'
$api_key='your client secret'
$notify='{"ipn_type":"invoice","event":"invoice_created","app_id":"cee1b9e2-d90c-4b63-9824-d621edb38012","invoice_id":"12wQquUmeCPUx3qmp3aHnd","order_id":"ORDER_123456","price_amount":2.0,"price_currency":"USD","network":null,"address":null,"pay_currency":null,"pay_amount":0.0,"exchange_rate":0.0,"paid_amount":0.0,"confirmed_amount":0.0,"refunded_price_amount":0.0,"create_time":"2022-09-14T04:57:54.5599307Z","expiration_time":"2022-09-14T05:02:54.559933Z","status":"New","error_status":"None","ext_args":"Merchant Pass Through Data","transactions":null,"notify_id":"fd58cedd-67c6-4053-ae65-2f6fb09a7d2c","notify_time":"0001-01-01T00:00:00"}';

$client = new \UniPayment\Client\UniPaymentClient();
$client->getConfig()->setClientId($app_id);
$client->getConfig()->setClientSecret($api_key);

$response = $$client->checkIpn($notify);
```

IPN notify

```
{
	"ipn_type": "invoice",
	"event": "invoice_expired",
	"app_id": "cee1b9e2-d90c-4b63-9824-d621edb38012",
	"invoice_id": "3Q7fyLnB2YNhUDW1fFNyEz",
	"order_id": "20",
	"price_amount": 6.0,
	"price_currency": "SGD",
	"network": null,
	"address": null,
	"pay_currency": null,
	"pay_amount": 0.0,
	"exchange_rate": 0.0,
	"paid_amount": 0.0,
	"confirmed_amount": 0.0,
	"refunded_price_amount": 0.0,
	"create_time": "2022-09-12T03:36:03",
	"expiration_time": "2022-09-12T03:41:03",
	"status": "Expired",
	"error_status": "None",
	"ext_args": null,
	"transactions": null,
	"notify_id": "8ccd2b61-226b-48e5-99b8-acb1f350313e",
	"notify_time": "2022-09-12T03:56:10.5852752Z"
}
```

Run Example
-----------

[](#run-example)

1.Get source code form GitHub

```
git clone https://github.com/UniCryptoLab/UniPaymentClient.PHP.git
```

2.Run project in PHPStorm

License
-------

[](#license)

MIT License

Copyright (c) 2021 UniPayment

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52% 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 ~0 days

Total

3

Last Release

864d ago

### Community

Maintainers

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

---

Top Contributors

[![UniCryptoLab](https://avatars.githubusercontent.com/u/101961719?v=4)](https://github.com/UniCryptoLab "UniCryptoLab (13 commits)")[![bizvip](https://avatars.githubusercontent.com/u/38232156?v=4)](https://github.com/bizvip "bizvip (6 commits)")[![shameem-devp](https://avatars.githubusercontent.com/u/1511232?v=4)](https://github.com/shameem-devp "shameem-devp (6 commits)")

---

Tags

paymentgatewaybitcoinethUSDCUSDTunipayment

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42361.9k4](/packages/bitpay-sdk)[shetabit/multipay

PHP Payment Gateway Integration Package

293361.0k4](/packages/shetabit-multipay)[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4851.0k](/packages/sebdesign-laravel-viva-payments)[bitpay/sdk-light

Light version of the PHP library for the new cryptographically secure BitPay API

19148.2k3](/packages/bitpay-sdk-light)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[plisio/plisio-api-php

156.8k](/packages/plisio-plisio-api-php)

PHPackages © 2026

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