PHP SDK

PHP SDK

The Buckaroo PHP SDK is an open source library that connects a PHP application to the Buckaroo API. It handles authentication, request signing and response parsing, so you can start payments, verify push messages, and refund or look up transactions with a few lines of code.

Running a store on an e-commerce platform? Use one of our ready-made plugins and apps instead. This SDK is for custom applications.

Building a Laravel application?
The Laravel Wrapper is built on this SDK and adds Laravel conventions.


Requirements

RequirementDetails
Buckaroo accountCreate an account if you do not have one yet
PHP7.4 or higher
PHP extensionsjson, pcre, fileinfo
OpenSSLAn up-to-date SSL/TLS toolkit
ComposerTo install the SDK and its dependencies

Installation

Install the SDK with Composer:

composer require buckaroo/sdk

Composer also installs the SDK's own dependencies, so there is nothing else to set up.

The source code is on GitHub.


Quick start

Create the client with your store key and secret key, then start a payment and send the customer to the payment page:

require __DIR__ . '/vendor/autoload.php';

$buckaroo = new \Buckaroo\BuckarooClient('STORE_KEY', 'SECRET_KEY', 'test');

$response = $buckaroo->method('ideal')->pay([
    'invoice'     => 'INV-1001', // must be unique per payment
    'amountDebit' => 10.00,
    'description' => 'Order #1001',
    'returnURL'   => 'https://example.com/buckaroo/return',
    'pushURL'     => 'https://example.com/buckaroo/push',
]);

if ($response->hasRedirect()) {
    header('Location: ' . $response->getRedirectUrl());
    exit;
}

That starts an iDEAL | Wero payment in test mode. The result of the payment arrives on your push URL, so continue with these pages in order:

  1. Configuration: credentials, test and live mode, defaults and logging
  2. Payments: start a payment, read the response and handle errors
  3. Push messages: receive and verify the payment result
  4. Order management: refunds, captures and transaction lookups
  5. Test and go live: what to test and how to switch to production

What you can build

The SDK covers the Buckaroo payment methods and the additional services such as Subscriptions, Credit Management, PayPerEmail, Split Payments and iDIN. Every method is called the same way, with its own service code.


Versioning

The SDK follows semantic versioning:

PartMeaning
MAJORBreaking changes that require additional testing and caution
MINORNew functionality with limited impact
PATCHBug fixes and hotfixes only

Every change is recorded in the changelog and on the releases page.


Contribute

The SDK is open source under the MIT license, and contributions are welcome.
Read the contribution guidelines before you open a pull request, and target the develop branch.



Did this page help you?