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

ActiveLibrary[API Development](/categories/api)

noname9/api-php
===============

PHP client for B2BinPay

1.1.1(5y ago)08MITPHPPHP ^7

Since Nov 13Pushed 5y agoCompare

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

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

B2BinPay API client for PHP
===========================

[](#b2binpay-api-client-for-php)

Accepting [Bitcoin](https://bitcoin.org/), [Bitcoin Cash](https://www.bitcoincash.org/), [Ethereum](https://www.ethereum.org/), [DASH](https://www.dash.org/), [Litecoin](https://litecoin.org/), [Monero](https://getmonero.org/), [NEO](https://neo.org), [NEM](https://nem.io/), [Ripple](https://ripple.com/), [B2BX](https://b2bx.org/) and any ERC20, NEO tokens in one place!

[![Build Status](https://camo.githubusercontent.com/a25d22664178efa65727758ca992a6a58313f95eba4ab5578e366641b0cb89ae/68747470733a2f2f7472617669732d63692e6f72672f623262696e7061792f6170692d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/b2binpay/api-php) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/8c5d8902132bf6af706b65d4f1e096c6eaf6861009eeb4efeb9526b90e31c15b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f623262696e7061792f6170692d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/b2binpay/api-php/?branch=master) [![Coverage Status](https://camo.githubusercontent.com/2e297516330ce2c7f17beb7bffb11028c26fce26724fd0a15200cd4f6ff83c51/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f623262696e7061792f6170692d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/b2binpay/api-php?branch=master)

Requirements
------------

[](#requirements)

- [B2BinPay](https://b2binpay.com) account
- PHP &gt;= 7.0
- PHP extensions enabled: cURL, JSON

Composer Installation
---------------------

[](#composer-installation)

The easiest way to install the B2BinPay API client is to require it with [Composer](http://getcomposer.org/doc/00-intro.md) through command-line:

```
    $ composer require noname9/api-php

```

or by editing `composer.json`:

```
    {
        "require": {
            "noname9/api-php": "^1.0"
        }
    }

```

Getting started
---------------

[](#getting-started)

See example code with comments in [public/index.php](public/index.php)

### Create Provider instance

[](#create-provider-instance)

Use the API key and secret to access your B2BinPay account:

```
$provider = new B2Binpay\Provider(
    'API_KEY',
    'API_SECRET'
);
```

#### Test Mode

[](#test-mode)

In order to use testing sandbox, pass `true` as a third parameter for `B2Binpay\Provider`:

```
$provider = new B2Binpay\Provider(
    'API_KEY',
    'API_SECRET',
    true
);
```

**Warning:** Sandbox and main gateway have their own pairs of key and secret!

### Create a bill

[](#create-a-bill)

*The payment currency is considered to match the currency of your wallet*.

Create a new bill:

```
$bill = $provider->createBill(
    WALLET_ID,
    '0.00000001',
    'BTC',
    LIFETIME
);
```

*where `LIFETIME` - number of seconds for payment page to live and `WALLET_ID` - your B2BinPay wallet id.*

Now the bill id is available in the `$bill->id` property. You should store this id with your order.

After storing the bill id you can find an url to the payment page in the `$bill->url` property.

Finally, you can check bill status by requesting it using the stored id:

```
$billCheck = $provider->getBill($bill->id);
```

The bill status will be stored in `$billCheck->status` property.

### Convert currency

[](#convert-currency)

You can get actual rates and convert supported currencies respecting your wallet's parameters.

Get rates for *USD*:

```
$rates = $provider->getRates('USD');
```

Convert currency using actual rates:

```
$amount = $provider->convertCurrency('100', 'USD', 'BTC', $rates);
```

Now you can provide `$amount` variable as a second parameter for `createBill()` method to set an accurate amount of cryptocurrency.

### Add markup

[](#add-markup)

You can add some markup to the existing amount.

Set *10%* markup for current amount:

```
$amount = $provider->addMarkup($amount, 'BTC', 10);
```

### Get your wallet's params

[](#get-your-wallets-params)

You can retrieve your wallet's params to find out actual currency and current amount:

```
$wallet = $provider->getWallet(WALLET_ID);
```

Now your wallet's currency alpha code is stored in the `$wallet->currency->alpha` parameter.

You can use it for `createBill()`, `addMarkup()` and `convertCurrency()` methods.

### Callback

[](#callback)

Once bill status changed, our server can send a callback to your configured Callback URL. Also, you can specify Tracking ID, which will return with the callback to identify the exact order. To do that provide additional parameters to `createBill()` method:

```
$bill = $provider->createBill(
    WALLET_ID,
    '0.00000001',
    'BTC',
    LIFETIME,
    TRACKING_ID,
    'https://my.callback.url/'
);
```

**Warning:** If specified, your Callback URL should return the message "OK" with status 200. Until that payment will not be considered complete!

```
header('HTTP/1.1 200 OK');
exit('OK');
```

#### Callback verification

[](#callback-verification)

You can verify Callback request headers by comparing it with the `getAuthorization()` method output:

```
if (empty($headers['Authorization']) || ($headers['Authorization'] !== $provider->getAuthorization())) {
    header('HTTP/1.1 401 Unauthorized');
    exit();
}
```

#### Callback body

[](#callback-body)

Callback request will contain the following data:

```
{
    "data": {
        "id": ID,
        "url": URL_TO_BILL_PAGE,
        "address": BLOCKCHAIN_ADDRESS,
        "created": TIME,
        "expired": TIME|NULL,
        "status": BILL_STATUS,
        "tracking_id": TRACKING_ID,
        "amount": AMOUNT_MULTIPLIED_BY_TEN_IN_POW,
        "actual_amount": ALREADY_PAID_AMOUNT_MULTIPLIED_BY_TEN_IN_POW,
        "pow": POW,
        "message": MESSAGE
    }
}

```

### List of bill statuses

[](#list-of-bill-statuses)

StatusDescription-2Payment error-1Payment lifetime is exceeded1Payment pending2Payment success3Payment freeze4Payment closed (funds are withdrawn)License
-------

[](#license)

B2BinPay\\API-PHP is licensed under the [MIT License](https://github.com/b2binpay/api-php/blob/master/LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% 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 ~219 days

Total

4

Last Release

2083d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d91982a9c7d80676d2810505e84b0897266b1a70dd251d67ac4205d91ca9c8b?d=identicon)[noname9](/maintainers/noname9)

---

Top Contributors

[![a1ebedew](https://avatars.githubusercontent.com/u/44876151?v=4)](https://github.com/a1ebedew "a1ebedew (26 commits)")[![SerhiiKalita](https://avatars.githubusercontent.com/u/13070582?v=4)](https://github.com/SerhiiKalita "SerhiiKalita (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[netflie/whatsapp-cloud-api

The first PHP SDK to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform

640431.7k4](/packages/netflie-whatsapp-cloud-api)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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