sauladam/omnipay-barzahlen

Barzahlen driver for the Omnipay payment processing library

dev-master / 2.0.x-dev 2015-06-03 18:54 UTC

This package is auto-updated.

Last update: 2024-10-17 06:21:41 UTC


README

Barzahlen driver for the Omnipay PHP payment processing library

Build Status Total Downloads

This is non-official Omnipay-driver for the German payment gateway provider Barzahlen. In order to use it the Omnipay-Framework is required.

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements barzahlen support for Omnipay.

Installation

This package is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "sauladam/omnipay-barzahlen": "dev-master"
    }
}

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

Basic Usage

The following gateways are provided by this package:

  • Barzahlen

For general usage instructions, please see the main Omnipay repository.

Basically it's pretty straight forward:

Purchase (create a transaction):

require 'vendor/autoload.php';

use Omnipay\Omnipay;

$gateway = Omnipay::create('Barzahlen');

// Testmode is on by default until you explicitly switch it off.
// You can either do this here on the gateway level or for each request.
$gateway->setTestMode(false);
$gateway->setShopId('yourShopid');
$gateway->setPaymentKey('yourPaymentKey');

$request = $gateway->purchase(
	array(
		'currency' => 'EUR',
		// Amounts higher than 999.99 will not be accepted
		'amount' => '111.59',
		// The order_id is not mandatory, you can set
		// it later in another request if you want.
		'orderId' => '123456', 
		'customerDetails' => array(
			'email' => 'test@test.com',
			'street_nr' => 'Testsreet 10a',
			'zipcode' => '12345',
			'city' => 'Test City',
			'country' => 'DE',
		),
		// If you want to pass in any custom vars (not mandatory),
        // make sure you pass them in the right order
		'customVars' => array(
			'some var 0',
			'some var 1',
		),
	)
);

$response = $request->send();

if ($response->isSuccessful() && $response->isVerified())
{
	$transactionId = $response->getTransactionReference();
}

All the other Requests work accordingly:

Update (update the order-id)

$request = $gateway->update(array(
	'transactionId' => $transactionId,
	'orderId' => 'n3w0rd3r1d',
));

Resend Email (resend the email to the customer)

$request = $gateway->resendEmail(array(
	'transactionId' => $transactionId,
	'language' => 'de', // not mandatory
));

Void (cancel the transaction so the customer will stop receiving payment reminders)

$request = $gateway->void(array(
	'transactionId' => $transactionId,
	'language' => 'de', // not mandatory
));

Refund (give them their money back...)

$request = $gateway->refund(array(
	'transactionId' => $transactionId,
	'amount' => '20.00',
	'currency' => 'EUR',
	'language' => 'de', // not mandatory
));

You can find a really great API documentation at https://integration.barzahlen.de/de/api

Please note that this is not the official API implementation! You can find officially supportet Barzahlen API libraries at https://integration.barzahlen.de/de/api/api-bibliotheken

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.