argovaerts/bonsai-php

Bonsai API client library for PHP. Bonsai is a Belgian payment app that for every ten payments plants a tree.

dev-main 2021-07-23 16:15 UTC

This package is auto-updated.

Last update: 2024-03-23 22:22:38 UTC


README

Bonsai is a Belgian payment app that for every ten payments plants a tree.

This is a community effort to make a PHP SDK to make the usage of the API more straight forward.

Requirements

  • Bonsai account with merchant functionality active
  • = PHP 8.0 (other version might work as well, untested)

  • PHP cURL extension
  • Up-to-date OpenSSL (or other SSL/TLS toolkit)

Installation

By far the easiest way to install the Bonsai API client is to require it with Composer.

$ composer require argovaerts/bonsai-php

{
    "require": {
        "argovaerts/bonsai-php": "*"
    }
}

Creating a payment

use Bonsai\Api\BonsaiApiClient;

$client = new BonsaiApiClient('API_KEY', 'PROFILE_ID', <IS_TEST_BOOLEAN>);

$output = $this->client->create_transaction->perform([
    'amount'            => '0.01',
    'clientReference'   => 'reference or order id',
]);

Want to improve the API client?

This project is open for pull requests.

License

BlueOak-1.0.0 © Arne Govaerts.