Download the PHP package blockbee/php-blockbee without Composer
On this page you can find all versions of the php package blockbee/php-blockbee. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download blockbee/php-blockbee
More information about blockbee/php-blockbee
Files in blockbee/php-blockbee
Package php-blockbee
Short Description BlockBee's PHP library
License MIT
Homepage https://github.com/blockbee-io/php-blockbee
Informations about the package php-blockbee
BlockBee's PHP Library
Official PHP library of BlockBee
Table of Contents
- Requirements
- Installation
- API and utils
- Checkout
- Payouts
- Help
- Changelog
Requirements:
Installation
API and utils
Generating a new address
Where:
$coin
is the coin you wish to use, from BlockBee's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...
)
$my_address
is your own crypto address, where your funds will be sent to. If you already set your address in our Dashboard you can leave this empty.
$callback_url
is the URL that will be called upon payment
$parameters
is any parameter you wish to send to identify the payment, such as ['order_id' => 1234]
$blockbee_params
parameters that will be passed to BlockBee _(check which extra parameters are available here: https://docs.blockbee.io/#operation/create)
$payment_address
is the newly generated address, that you will show your users
$api_key
is the API Key provided by our Dashboard.
With get_address()
you will be creating the request in our API using this endpoint: https://docs.blockbee.io/#operation/create.
Response sample:
Getting notified when the user pays
The URL you provided earlier will be called when a user pays, for easier processing of the request we've added the process_callback
helper
The $payment_data
will be an array with the following keys:
address_in
- the address generated by our service, where the funds were received
address_out
- your address, where funds were sent
txid_in
- the received TXID
txid_out
- the sent TXID or null, in the case of a pending TX
confirmations
- number of confirmations, or 0 in case of pending TX
value
- the value that your customer paid
value_coin
- the value that your customer paid, in the main coin denomination (e.g BTC
)
value_forwarded
- the value we forwarded to you, after our fee
value_forwarded_coin
- the value we forwarded to you, after our fee, in the main coin denomination (e.g BTC
)
coin
- the coin the payment was made in (e.g: 'btc', 'eth', 'erc20_usdt', ...
)
pending
- whether the transaction is pending, if false
means it's confirmed
plus, any values set on $params
when requesting the address, like the order ID.
From here you just need to check if the value matches your order's value.
Checking the logs of a request
All the data
returned in the response can be checked here: https://docs.blockbee.io/#operation/logs
Response sample:
Generating a QR code
For object creation, same parameters as before. You must first call get_address
as this method requires the payment address to have been created.
Where:
$value
Value to request the user, in the main coin (BTC, ETH, etc). Optional, pass false
to not add a value to the QR.
$size
Size of the QR Code image in pixels. Optional, pass false
to use the default size of 512.
Response is an object with qr_code
(base64 encoded image data) and payment_uri
(the value encoded in the QR), see https://docs.blockbee.io/#operation/qrcode for more information.
Response sample:
Usage
Estimating transaction fees
Where:
$coin
is the coin you wish to check, from BlockBee's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...
)
$addresses
The number of addresses to forward the funds to. Optional, defaults to 1.
$priority
Confirmation priority, needs to be one of ['fast', 'default', 'economic']
. Optional, defaults to default
.
Response is an object with estimated_cost
and estimated_cost_usd
, see https://docs.blockbee.io/#operation/estimate for more information.
Response sample:
Converting between cryptocurrencies and FIAT
Where:
$coin
the target currency to convert to, from BlockBee's supported currencies (e.g 'btc', 'eth', 'erc20_usdt', ...
)
$value
Value to convert in from
.
$from
Currency to convert from, FIAT or crypto.
Response is an object with value_coin
and exchange_rate
, see https://docs.blockbee.io/#operation/convert for more information.
Response sample:
Getting supported coins
Response is an array with all support coins.
Response sample:
Checkout
Requesting Payment
Where:
$api_key
is the API Key provided by our Dashboard.$parameters
is any parameter you wish to send to identify the payment, such as['order_id' => 1234]
$blockbee_params
parameters that will be passed to BlockBee _(check which extra parameters are available here: https://docs.blockbee.io/#operation/payment)$redirect_url
URL in your platform, where the user will be redirected to following the payment. Should be able to process the payment using thesuccess_token
.$notify_url
URL in your platform, where the IPN will be sent notifying that a deposit was done. Parameters are available here: https://docs.blockbee.io/#operation/depositipn.$value
amount in currency set in Payment Settings you want to receive from the user.
Getting notified when the user completes the Payment
When receiving payments, you have the option to receive them in either the
notify_url
or theredirect_url
, but adding theredirect_url
is required (refer to our documentation at https://docs.blockbee.io/#operation/paymentipn).
Response sample:
Payment Logs
Fetch Payment information and IPN logs.
Where:
- is the
payment_id
returned by the payment creation endpoint.
Response sample:
Requesting Deposit
Where:
$api_key
is the API Key provided by our Dashboard.$parameters
is any parameter you wish to send to identify the payment, such as['order_id' => 1234]
$blockbee_params
parameters that will be passed to BlockBee _(check which extra parameters are available here: https://docs.blockbee.io/#operation/deposit)$notify_url
URL in your platform, where the IPN will be sent notifying that a deposit was done. Parameters are available here: https://docs.blockbee.io/#operation/depositipn.
Getting notified when the user makes a deposit
When receiving deposits, you must provide a
notify_url
where our system will send an IPN every time a user makes a deposit (refer to our documentation at https://docs.blockbee.io/#operation/depositipn).
Response sample:
Deposit Logs
Fetch Deposit information and IPN logs.
Where:
- is the
payment_id
returned by the deposit creation endpoint.
Response sample:
Payouts
Payout Request: Simple order with the address and the amount to send.
Payout: Aggregation of Payout Requests. Can send up to 100
transactions.
Create Payout / Payout Request
This function can be used by you to create Payouts.
Where:
-
$coin
The cryptocurrency you want to request the Payout in (e.gbtc
,eth
,erc20_usdt
, ...). -
$requests
Address(es) together with the amount that must be sent. $process
If the Payout Requests will be sent right away. Defaults tofalse
. Note: iftrue
will instantly queue the payouts to be sent to the destination addresses.
Response sample:
List Payouts / Payout Requests
List all Payouts or Payout Requests in your account.
Note: If $requests
is true
it will fetch a Payout Requests list.
Where:
-
$coin
The cryptocurrency you want to request the lists in (e.gbtc
,eth
,erc20_usdt
, ...). -
$status
The status of the Payout / Payout Request. Possible statuses are:- Payout Request: [
all
,pending
,rejected
,processing
,done
] - Payout: [
created
,processing
,done
,error
]
- Payout Request: [
-
$page
This endpoint is paginated and will show only50
items per page. Defaults to1
. $requests
Iftrue
will fetch Payout Requests, otherwise will fetch Payouts. Defaults tofalse
.
Response sample:
Get Payout Wallet
Gets your Payout Wallet for the specified coin
. Can algo get the balance.
Where:
-
$coin
The cryptocurrency you want to request the lists in (e.gbtc
,eth
,erc20_usdt
, ...). $balance
Iftrue
will also fetch the balance of the address.
Response sample:
Create Payout with Payout Request ID(s)
With this function you can create a Payout in the created
status by simply providing an array with the Payout Requests ID
.
Where:
$ids
its an array with the Payout RequestsID
.
Response sample:
Process Payout by ID
By default, a Payout when created will be in created
state. With this function you may finish it using its ID
.
Where:
$id
Its theID
of the Payout you wish to fulfill.
Response sample:
Check the Payout status
Will return all important information regarding a Payout, specially its status.
Where:
$id
Its theID
of the Payout you wish to check.
Response sample:
Help
Need help?
Contact us @ https://blockbee.io/contacts/
Changelog
1.0.0
- Initial release.
1.0.1
- Minor bugfixes.
1.1.0
- Added Payouts
- Minor bugfixes
1.1.1
- Minor bugfixes
1.1.2
- Minor bugfixes
2.0.0
- Automated Payouts
- Support to BlockBee Checkout page
- Various improvements
2.0.1
- Minor bugfixes
2.1.0
- Minor bugfixes
- Improve error handling
2.1.1
- Minor bugfixes
2.1.2
- Minor improvements
Breaking Changes
2.0.0
create_payout
parameters were changed and will require you to update your code.
All versions of php-blockbee with dependencies
ext-curl Version *
ext-json Version *