Skip to content

Commit c3f01a6

Browse files
author
arianoangelo
committed
v1.1.0
* Added Payouts * Minor bugfixes
1 parent 77eda03 commit c3f01a6

File tree

3 files changed

+56
-6
lines changed

3 files changed

+56
-6
lines changed

Diff for: BlockBee/BlockBee.php

+22
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ public static function get_estimate($coin, $addresses = 1, $priority = 'default'
191191

192192
public static function get_convert($coin, $value, $from, $api_key)
193193
{
194+
if (empty($api_key)) {
195+
throw new Exception('API Key is Empty');
196+
}
197+
194198
$response = BlockBee::_request($coin, 'convert', [
195199
'value' => $value,
196200
'from' => $from,
@@ -204,6 +208,24 @@ public static function get_convert($coin, $value, $from, $api_key)
204208
return null;
205209
}
206210

211+
public static function create_payout ($coin, $address, $value, $api_key) {
212+
if (empty($api_key)) {
213+
throw new Exception('API Key is Empty');
214+
}
215+
216+
$response = BlockBee::_request($coin, 'payout', [
217+
'address' => $address,
218+
'value' => $value,
219+
'apikey' => $api_key
220+
]);
221+
222+
if ($response->status == 'success') {
223+
return $response;
224+
}
225+
226+
return null;
227+
}
228+
207229
public static function process_callback($_get)
208230
{
209231
$params = [

Diff for: README.md

+32-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ PHP >= 5.6
1010
ext-curl
1111
```
1212

13-
14-
1513
## Install
1614

17-
1815
```
1916
composer require blockbee/php-blockbee
2017
```
@@ -182,8 +179,39 @@ $coins = BlockBee\BlockBee::get_supported_coins($api_key);
182179

183180
Response is an array with all support coins.
184181

182+
### Request Payout
183+
184+
```php
185+
<?php
186+
require 'vendor/autoload.php'; // Where your vendor directory is
187+
188+
$create_payout = BlockBee\BlockBee::create_payout($coin, $address, $value, $api_key);
189+
```
190+
191+
This function can be used by you to request payouts (withdrawals in your platform).
192+
193+
Where:
194+
* ``$coin`` The cryptocurrency you want to request the Payout in (e.g `btc`, `eth`, `erc20_usdt`, ...).
195+
196+
* ``$address`` Address where the Payout must be sent to.
197+
198+
* ``$value`` Amount to send to the ``address``.
199+
200+
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.
185201

186202
## Help
187203

188204
Need help?
189-
Contact us @ https://blockbee.io/contacts/
205+
Contact us @ https://blockbee.io/contacts/
206+
207+
### Changelog
208+
209+
#### 1.0.0
210+
* Initial release.
211+
212+
#### 1.0.1
213+
* Minor bugfixes.
214+
215+
#### 1.1.0
216+
* Added Payouts
217+
* Minor bugfixes

Diff for: composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"docs": "https://docs.blockbee.io/"
2020
},
2121
"require": {
22-
"php": ">=5.6.0",
22+
"php": ">=7.2.0",
2323
"ext-curl": "*",
2424
"ext-json": "*"
2525
},
@@ -28,5 +28,5 @@
2828
"BlockBee\\": "BlockBee/"
2929
}
3030
},
31-
"version": "1.0.1"
31+
"version": "1.1.0"
3232
}

0 commit comments

Comments
 (0)