thanpa/buckaroo-php-sdk

There is no license information available for the latest version (dev-master) of this package.

A PHP SDK for Buckaroo payment provider

dev-master 2019-02-11 09:21 UTC

This package is auto-updated.

Last update: 2024-09-12 04:56:23 UTC


README

Currently only accepting iDEAL

Requirements

To use the Buckaroo API client, the following things are required:

The client uses curl, so make sure that your PHP is installed with the curl extension.

Installation via Composer

composer require thanpa/buckaroo-php-sdk

Manual Installation

Download the code from the repository (git).

Create an autoload file and include it in your project.

How to receive payments

To successfully receive a payment, these steps should be implemented:

  1. Create a service that you need (for now only Ideal is available).

  2. Create a transaction and add the service that you have created.

  3. Send the customer to the provided redirect url.

  4. Update the transaction status (Buckaroo will push information).

Initializing the Buckaroo API client, and setting your API key.

Getting started

$buckaroo = new \Buckaroo\Buckaroo();
$buckaroo->setApiKeys("TEST_API_WEBSITE_KEY", "TEST_API_SECRET_KEY");

Executing a new transaction

Creating a new payment.

$service = new \Buckaroo\Service\Ideal('Pay');
$service->setIssuer('ABNANL2A');

You have to provide the type of the transaction (Pay or Refund)

Then add the payment to a newly created transaction

$transaction
    ->addService($service)
    ->setAmount(10.00)
    ->setInvoice('#CG0001');

Finally, execution of the transaction.

$buckaroo->execute($transaction);

After executing, the transaction key can be retrieved from the $transaction->getKey() method.

Now that the transaction is ready, redirect the customer to the payment provider.

header("Location: " . $transaction->getRequiredAction()->getRedirectURL(), true, 303);

This can be done with the 303 See Other http response code

Retrieving an existing transaction

This is pretty easy and you only need to call getTransaction method of the Buckaroo master class.

$transaction = $buckaroo->getTransaction('THIS-IS-THE-TRANSACTION-KEY');

Then the $transaction variable will hold a Transaction instance with all information populated in it.

Retrieving refund information

This is also done easily with only a call to getRefundInfo method of the Buckaroo master class.

$refundInfo = $buckaroo->getRefundInfo('THIS-IS-THE-REFUND-TRANSACTION-KEY');

Then the $refundInfo variable will hold a RefundInfo instance with all information populated in it.

Making a transaction instance out of a Buckaroo push

$transaction = $buckaroo->populateFromPush('{...<here goes the request body>...}');

Once again you have a transaction instance, ready to be used for anything you need.

Support

Contact: www.thanpa.comhello@thanpa.com — +30 2521105247