Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
* Automated Payouts
* Support to BlockBee Checkout page
* Various improvements
  • Loading branch information
arianoangelo committed Mar 14, 2024
1 parent 205780a commit 2ffe569
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion BlockBee/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct($api_key, $parameters = [], $bb_params = [])
* Handles request to payments.
* @return array
*/
public function payment_request($redirect_url, $value)
public function payment_request($redirect_url, $notify_url, $value)
{
if (empty($redirect_url) || empty($value)) {
return null;
Expand All @@ -38,10 +38,12 @@ public function payment_request($redirect_url, $value)
if (!empty($this->parameters)) {
$req_parameters = http_build_query($this->parameters);
$redirect_url = "{$redirect_url}?{$req_parameters}";
$notify_url = "{$notify_url}?{$req_parameters}";
}

$bb_params = array_merge([
'redirect_url' => $redirect_url,
'notify_url' => $notify_url,
'apikey' => $this->api_key,
'value' => $value
], $this->bb_params);
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,14 @@ require 'vendor/autoload.php'; // Where your vendor directory is

$bb = new BlockBee\Checkout($api_key, $parameters, $blockbee_params);

$payment_address = $bb->payment_request($redirect_url, $value);
$payment_address = $bb->payment_request($redirect_url, $notify_url, $value);
```
#### Where:
* ``$api_key`` is the API Key provided by our [Dashboard](https://dash.blockbee.io/).
* ``$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 the `success_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
Expand Down
2 changes: 1 addition & 1 deletion test.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

$bb_checkout = new BlockBee\Checkout($api_key, $parameters, $blockbee_params);

# var_dump($bb_checkout->payment_request('https://example.com/', 5)) . PHP_EOL;
# var_dump($bb_checkout->payment_request('https://example.com/', 'https://example.com/', 5)) . PHP_EOL;

# var_dump($bb_checkout->deposit_request('https://example.com/')) . PHP_EOL;

Expand Down

0 comments on commit 2ffe569

Please sign in to comment.