Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
* Added Payouts
* Minor bugfixes
  • Loading branch information
arianoangelo committed Mar 31, 2023
1 parent 77eda03 commit c3f01a6
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
22 changes: 22 additions & 0 deletions BlockBee/BlockBee.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ public static function get_estimate($coin, $addresses = 1, $priority = 'default'

public static function get_convert($coin, $value, $from, $api_key)
{
if (empty($api_key)) {
throw new Exception('API Key is Empty');
}

$response = BlockBee::_request($coin, 'convert', [
'value' => $value,
'from' => $from,
Expand All @@ -204,6 +208,24 @@ public static function get_convert($coin, $value, $from, $api_key)
return null;
}

public static function create_payout ($coin, $address, $value, $api_key) {
if (empty($api_key)) {
throw new Exception('API Key is Empty');
}

$response = BlockBee::_request($coin, 'payout', [
'address' => $address,
'value' => $value,
'apikey' => $api_key
]);

if ($response->status == 'success') {
return $response;
}

return null;
}

public static function process_callback($_get)
{
$params = [
Expand Down
36 changes: 32 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ PHP >= 5.6
ext-curl
```



## Install


```
composer require blockbee/php-blockbee
```
Expand Down Expand Up @@ -182,8 +179,39 @@ $coins = BlockBee\BlockBee::get_supported_coins($api_key);

Response is an array with all support coins.

### Request Payout

```php
<?php
require 'vendor/autoload.php'; // Where your vendor directory is

$create_payout = BlockBee\BlockBee::create_payout($coin, $address, $value, $api_key);
```

This function can be used by you to request payouts (withdrawals in your platform).

Where:
* ``$coin`` The cryptocurrency you want to request the Payout in (e.g `btc`, `eth`, `erc20_usdt`, ...).

* ``$address`` Address where the Payout must be sent to.

* ``$value`` Amount to send to the ``address``.

The response will be only a ``success`` to confirm the Payout Request was successfully created. To fulfill it you will need to go to BlockBee Dashboard.

## Help

Need help?
Contact us @ https://blockbee.io/contacts/
Contact us @ https://blockbee.io/contacts/

### Changelog

#### 1.0.0
* Initial release.

#### 1.0.1
* Minor bugfixes.

#### 1.1.0
* Added Payouts
* Minor bugfixes
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"docs": "https://docs.blockbee.io/"
},
"require": {
"php": ">=5.6.0",
"php": ">=7.2.0",
"ext-curl": "*",
"ext-json": "*"
},
Expand All @@ -28,5 +28,5 @@
"BlockBee\\": "BlockBee/"
}
},
"version": "1.0.1"
"version": "1.1.0"
}

0 comments on commit c3f01a6

Please sign in to comment.