{"id":15093104,"url":"https://github.com/b2binpay/api-php","last_synced_at":"2025-10-06T11:31:03.967Z","repository":{"id":52712864,"uuid":"157197579","full_name":"b2binpay/api-php","owner":"b2binpay","description":"B2BinPay API client for PHP","archived":true,"fork":false,"pushed_at":"2022-11-28T23:51:57.000Z","size":629,"stargazers_count":9,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-13T11:41:49.697Z","etag":null,"topics":["b2binpay","b2bx","bitcoin","cryptocurrency","ethereum","litecoin","monero","payment","payment-gateway","ripple","wallet"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b2binpay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-12T10:40:18.000Z","updated_at":"2024-10-24T14:54:57.000Z","dependencies_parsed_at":"2023-01-23T13:46:13.121Z","dependency_job_id":null,"html_url":"https://github.com/b2binpay/api-php","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/b2binpay/api-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b2binpay%2Fapi-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b2binpay%2Fapi-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b2binpay%2Fapi-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b2binpay%2Fapi-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b2binpay","download_url":"https://codeload.github.com/b2binpay/api-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b2binpay%2Fapi-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278601957,"owners_count":26013989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["b2binpay","b2bx","bitcoin","cryptocurrency","ethereum","litecoin","monero","payment","payment-gateway","ripple","wallet"],"created_at":"2024-09-25T11:03:38.938Z","updated_at":"2025-10-06T11:31:03.640Z","avatar_url":"https://github.com/b2binpay.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# B2BinPay API client for PHP\n\nAccepting [Bitcoin](https://bitcoin.org/), [Bitcoin Cash](https://www.bitcoincash.org/)\n, [Ethereum](https://www.ethereum.org/), [DASH](https://www.dash.org/), [Litecoin](https://litecoin.org/)\n, [Monero](https://getmonero.org/), [NEO](https://neo.org), [NEM](https://nem.io/), [Ripple](https://ripple.com/)\n, [Cardano](https://www.cardano.org/), [Dogecoin](https://dogecoin.com/), [Zcash](https://z.cash/)\n, [Stellar](https://www.stellar.org/), [EOS](https://eos.io/), [TRON](https://tron.network/)\n, [Binance Coin](https://www.binance.com/) and any ERC20 and stablecoin, NEO tokens in one place!\n\n[![Build Status](https://travis-ci.org/b2binpay/api-php.svg?branch=master)](https://travis-ci.org/b2binpay/api-php) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/b2binpay/api-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/b2binpay/api-php/?branch=master) [![Coverage Status](https://coveralls.io/repos/github/b2binpay/api-php/badge.svg?branch=master)](https://coveralls.io/github/b2binpay/api-php?branch=master)\n\n## Requirements\n\n+ [B2BinPay](https://b2binpay.com) account\n+ PHP \u003e= 7.1 (If you need 7.0, please, use [version 1.1.0](https://github.com/b2binpay/api-php/tree/1.1.0))\n+ PHP extensions enabled: cURL, JSON\n\n## Composer Installation\n\nThe easiest way to install the B2BinPay API client is to require it\nwith [Composer](http://getcomposer.org/doc/00-intro.md) through command-line:\n\n```shell\ncomposer require b2binpay/api-php\n```\n\nor by editing `composer.json`:\n\n```json\n    {\n  \"require\": {\n    \"b2binpay/api-php\": \"^1.2\"\n  }\n}\n```\n\n## Local installation\n\n```bash\ncomposer install --no-dev\ncp .env.example .env\n```\n\n## Support currencies\n\n| Currency | Name | Blockchain, links |\n| --- | --- | --- |\n| ADA | Cardano | [Cardano](https://www.cardano.org/) |\n| BCH | Bitcoin Cash | [Bitcoin Cash](https://www.bitcoincash.org/) |\n| BNB | Binance Coin | Binance Chain, [BEP2](https://explorer.binance.org/asset/BNB) |\n| BTC | Bitcoin | [Bitcoin](https://bitcoin.org/) |\n| BUSD-ETH | Binance USD | Ethereum, [Stablecoin](https://etherscan.io/token/0x4Fabb145d64652a948d72533023f6E7A623C7C53) |\n| DAI-ETH | Dai | Ethereum, [Stablecoin](https://etherscan.io/token/0x6b175474e89094c44da98b954eedeac495271d0f) |\n| DASH | Dash | [Dash](https://www.dash.org) |\n| DOGE | Dogecoin | [Dogecoin](https://dogecoin.com) |\n| EOS | EOS | [EOS](https://eos.io) |\n| ETH | Ethereum | [Ethereum](https://ethereum.org/en/) |\n| GUSD-ETH | Gemini Dollar | Ethereum, [Stablecoin](https://etherscan.io/token/0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd) |\n| LTC | Litecoin | [Litecoin](https://litecoin.org) |\n| NEO | Neo | [Neo](https://neo.org) |\n| PAX-ETH | Paxos Standard | Ethereum, [Stablecoin](https://etherscan.io/address/0x8e870d67f660d95d5be530380d0ec0bd388289e1) |\n| TRX | TRON | [TRON](https://tron.network) |\n| TUSD-ETH | TrueUSD | Ethereum, [Stablecoin](https://etherscan.io/token/0x0000000000085d4780B73119b644AE5ecd22b376) |\n| USDC-ETH | USD Coin | Ethereum, [Stablecoin](https://etherscan.io/token/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) |\n| USDT-ETH | Tether | Ethereum, [Stablecoin](https://etherscan.io/address/0xdac17f958d2ee523a2206206994597c13d831ec7) |\n| USDT-OMNI | Tether | OMNI, [Stablecoin](https://www.omniexplorer.info/asset/31) |\n| XEM | NEM | [NEM](https://www.nem.io) |\n| XLM | Stellar | [Stellar](https://www.stellar.org) |\n| XMR | Monero | [Monero](https://www.getmonero.org) |\n| XRP | Ripple | [Ripple](https://ripple.com/xrp/) |\n| ZEC | Zcash | [Zcash](https://z.cash) |\n\n## Getting started\n\nSee examples with comments in [examples/README.md](examples/README.md)\n\n### Create Provider instance\n\nUse the API key and secret to access your B2BinPay account:\n\n```php\n$provider = new B2Binpay\\Provider(\n    'API_KEY',\n    'API_SECRET'\n);\n``` \n\n#### Test Mode\n\nIn order to use testing sandbox, pass `true` as a third parameter for `B2Binpay\\Provider`:\n\n```php\n$provider = new B2Binpay\\Provider(\n    'API_KEY',\n    'API_SECRET',\n    true\n);\n``` \n\n**Warning:** Sandbox and main gateway have their own pairs of key and secret!\n\n### Create a bill\n\n_The payment currency is considered to match the currency of your wallet_.\n\nCreate a new bill:\n\n```php\n$bill = $provider-\u003ecreateBill(  \n        'WALLET_ID',\n        'AMOUNT',\n        'CURRENCY',\n        'LIFETIME',\n        'TRACKING_ID',\n        'CALLBACK_URL',\n        'SUCCESS_URL',\n        'ERROR_URL'\n  );\n```\n\n| Params | Description |\n| --- | --- |\n| WALLET_ID | (int) Each wallet is responsible for creating bill only in the currency assigned to it |\n| AMOUNT | (string) Amount in the value of the currency being created |\n| CURRENCY | (string) See list of supported currencies in the table above |\n| LIFETIME | (int) Number in seconds that will set bill to expire from the current creation date |\n| TRACKING_ID | (string) _Optional_. Track for bill tracking. This value will be returned on callback |\n| CALLBACK_URL | (string) _Optional_. URL to which the callback will be sent |\n| SUCCESS_URL | (string) _\nOptional_. URL to which the user can be sent after successful payment, is used only on the payment page |\n| ERROR_URL | (string) _\nOptional_. URL to which the user can be sent after unsuccessful payment, is used only on the payment page |\n\n### Convert currency\n\nYou can get actual rates and convert supported currencies respecting your wallet's parameters.\n\nGet rates for _BASE_CURRENCY_:\n\n```php\n$rates = $provider-\u003egetRates('BASE_CURRENCY', 'RATE_TYPE');\n```\n\n| Params | Description |\n| --- | --- |\n| BASE_CURRENCY | (string) *Optional*. Currency to which the rates will be calculated. Default: USD |\n| RATE_TYPE | (string) *Optional*. Receiving the type of rates, for **deposit** and **withdrawal**. Default: deposit  |\n\nConvert currency using actual rates:\n\n```php\n$amount = $provider-\u003econvertCurrency('AMOUNT', 'BASE_CURRENCY', 'CURRENCY', $rates);\n```\n\n| Params | Description |\n| --- | --- |\n| AMOUNT | (string) The amount in the currency to be converted |\n| BASE_CURRENCY | (string) The currency in which the amount is indicated  |\n| CURRENCY | (string) Currency in which you want to convert the amount |\n| $rates | (array) _\nOptional_. Current rates. If the parameter is not specified, then the rates will be requested again |\n\nNow you can provide `$amount` variable as a second parameter for `createBill()` method to set an accurate amount of\ncryptocurrency.\n\n### Add markup\n\nYou can add some markup to the existing amount.\n\nSet _10%_ markup for the current amount:\n\n```php\n$amount = $provider-\u003eaddMarkup($amount, 'CURRENCY', 10);\n```\n\n| Params | Description |\n| --- | --- |\n| $amount | (string) Amount to add markup |\n| CURRENCY | (string) Currency in which markup is added |\n| 10 | (int) Percentage on which to add markup |\n\n### Callback\n\nOnce bill status changed, our server can send a callback to your configured Callback URL. Also, you can specify Tracking\nID, which will return with the callback to identify the exact order. To do that provide additional parameters\nto `createBill()` method:\n\n```php\n$bill = $provider-\u003ecreateBill(\n        'WALLET_ID',\n        $amount,\n        'CURRENCY',\n        'LIFETIME',\n        '202009051801',\n        'https://my.callback.url/callback.php'\n    );\n```\n\n**Warning:** If specified, your Callback URL should return the message \"OK\" with status 200. Until that payment will not\nbe considered complete!\n\n```php\nheader('HTTP/1.1 200 OK');\nexit('OK');\n```\n\n#### Callback verification\n\nYou can verify Callback request headers by comparing it with the `$provider-\u003everifySign()` method output:\n\n```php\n$verifySign = $provider-\u003everifySign($_POST['sign']['time'], $_POST['sign']['hash']);\nif (!$verifySign) {\n    header('HTTP/1.1 401 Unauthorized');\n    exit();\n}\n```\n\n****WARNING:**** for each callback `$ _POST ['sign'] ['hash']` a new one is generated - if you\nreceived `$ _POST ['sign'] ['hash']` which was already used before, you should throw the same error as for signature\nverification\n\n#### Callback body\n\nBill callback request will contain the following data:\n\n```json\n{\n  \"data\": {\n    \"id\": BILL_ID,\n    \"url\": URL_TO_BILL_PAYMENT_PAGE,\n    \"address\": BLOCKCHAIN_ADDRESS,\n    \"created\": TIME,\n    \"expired\": TIME\n    |\n    NULL,\n    \"status\": BILL_STATUS,\n    \"tracking_id\": TRACKING_ID,\n    \"callback_url\": URL\n    |\n    NULL\n    \"amount\": AMOUNT_MULTIPLIED_BY_TEN_IN_POW,\n    \"actual_amount\": ALREADY_PAID_AMOUNT_MULTIPLIED_BY_TEN_IN_POW,\n    \"pow\": POW,\n    \"message\": MESSAGE\n    |\n    NULL,\n    \"transactions\": [\n      {\n        \"id\": TRANSACTION_ID,\n        \"bill_id\": BILL_ID,\n        \"created\": TIME,\n        \"amount\": TRANSACTION_AMOUNT_MULTIPLIED_BY_TEN_IN_POW\n        \",\n        \"pow\": POW,\n        \"status\": TRANSACTION_STATUS,\n        \"transaction\": HASH_TRANSACTION_IN_BLOCKCHAIN,\n        \"type\": 0,\n        \"currency\": {\n          \"iso\": ISO_CODE_CURRENCY,\n          \"alpha\": SYMBOL_CURRENCY\n        }\n      }\n    ],\n    \"currency\": {\n      \"iso\": ISO_CODE_CURRENCY,\n      \"alpha\": SYMBOL_CURRENCY\n    },\n    \"sign\": {\n      \"time\": TIME,\n      \"hash\": HASH\n    }\n  }\n}\n```\n\nWithdraw callback request will contain the following data:\n\n```json\n{\n  \"data\": {\n    \"id\": WITHDRAW_ID,\n    \"virtual_wallet_id\": VIRTUAL_WALLET_ID,\n    \"with_fee\": INCLUDE_COMMISSION_IN_WITHDRAW,\n    \"created\": TIME,\n    \"address\": BLOCKCHAIN_ADDRESS,\n    \"amount\": AMOUNT_MULTIPLIED_BY_TEN_IN_POW,\n    \"fee\": BLOCKCHAIN_FEE_MULTIPLIED_BY_TEN_IN_POW,\n    \"pow\": POW,\n    \"status\": WITHDRAW_STATUS,\n    \"transaction\": HASH_TRANSACTION_IN_BLOCKCHAIN\n    |\n    NULL\n    \"tracking_id\": TRACKING_ID\n    |\n    NULL,\n    \"unique_id\": UNIQUE_WITHDRAW_ID,\n    \"callback_url\": URL\n    |\n    NULL,\n    \"message\": MESSAGE\n    |\n    NULL,\n    \"currency\": {\n      \"iso\": ISO_CODE_CURRENCY,\n      \"alpha\": SYMBOL_CURRENCY\n    },\n    \"sign\": {\n      \"time\": TIME,\n      \"hash\": HASH\n    }\n  }\n}\n```\n\n### Create a withdrawal\n\n_From a virtual wallet, you can make withdrawals to any blockchain, for this you need to specify ADDRESS and CURRENCY_.\n\nCreate a new withdraw:\n\n```php\n$bill = $provider-\u003ecreateWithdrawal(  \n        'VIRTUAL_WALLET_ID',\n        'AMOUNT',\n        'CURRENCY',\n        'ADDRESS',\n        'UNIQUE_ID',\n        'TRACKING_ID',\n        'CALLBACK_URL',\n        'MESSAGE',\n        'WITH_FEE'\n    );\n```\n\n| Params | Description |\n| --- | --- |\n| VIRTUAL_WALLET_ID | (int) ID virtual wallet. If the currency of the virtual wallet does not match the currency in which the withdrawal is to be made, the system will automatically convert at the current rate |\n| AMOUNT | (string) Amount to be withdrawn |\n| CURRENCY | (string) See list of supported currencies in the table above |\n| ADDRESS | (string) Blockchain address to which you want to withdraw |\n| UNIQUE_ID | (int) Any unique positive number. This number should not be repeated from withdrawal to withdrawal |\n| TRACKING_ID | (string) _Optional_. Track for withdraw tracking. This value will be returned on callback |\n| CALLBACK_URL | (string) _Optional_. URL to which the callback will be sent |\n| MESSAGE | (string) _Optional_. Used for Ripple blockchain, NEM, Stellar, EOS and Binance Chain |\n| WITH_FEE | (boolean) _\nOptional_. Include the commission in the withdrawal amount. Not all blockchains support this method |\n\n## System statuses lists\n\n### List of bills statuses\n\n| Status | Description |\n| --- | --- |\n| -2 | Failed |\n| -1 | Expired |\n| 1 | Created |\n| 2 | Paid |\n\n### List of transactions statuses\n\n| Status | Description |\n| --- | --- |\n| -4 | Waiting for return |\n| -3 | Returned |\n| -2 | Failed |\n| -1 | Expired |\n| 0 | Pending |\n| 1 | Sent |\n| 2 | Approved |\n\n### List of withdraws statuses\n\n| Status | Description |\n| --- | --- |\n| -2 | Failed |\n| 0 | Waiting |\n| 1 | Pending |\n| 2 | Sent |\n\n### List of transfers statuses\n\n| Status | Description |\n| --- | --- |\n| -1 | Failed |\n| 0 | Pending |\n| 1 | Sent |\n\n### List of transfers types\n\n| Status | Description |\n| --- | --- |\n| 0 | Deposit from blockchain |\n| 1 | Bank transfer |\n| 2 | Auto withdraw |\n| 3 | Withdraw blockchain fee |\n| 4 | Token payout fee |\n| 5 | Finance deposit |\n| 6 | Bank transfer commission |\n| 7 | Commissions |\n\n## License\n\nB2BinPay\\API-PHP is licensed under the [MIT License](https://github.com/b2binpay/api-php/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb2binpay%2Fapi-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb2binpay%2Fapi-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb2binpay%2Fapi-php/lists"}