Skip to content

dotpay/omnipay-dotpay

Repository files navigation

Omnipay: Dotpay

Dotpay driver for the Omnipay PHP payment processing library

Installation

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

{
    "require": {
        "omnipay/dotpay": "~3.0"
    }
}

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:

  • Dotpay

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

Example usage:

Initialize gateway:

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

// Gateway specific parameters
$gateway->initialize([
    'accountId'  => 'YOUR_DOTPAY_ID',
    'pid'        => 'YOUR_SECRET_PIN',
    'type'       => '0',
    'action'     => 'https://ssl.dotpay.pl/test_payment/',
    'lang'       => 'pl',
    'apiVersion' => 'dev',
    'channel'    => '0'
]);
// Omnipay generic parameters
$params = [
    'amount' => 12.34,
    'currency' => 'PLN',
    'description' => 'Test payment',
    'returnUrl' => 'https://www.your-domain.nl/return_here',
    'notifyUrl' => 'https://www.your-domain.nl/notify_here',
    'email' => 'customer_email@example.com',
];

// You can add Dotpay-specific (not Omnipay generic) parameters here:
$params += [
    'first_name' => 'Jan',
    'last_name' => 'Kowalski',
];

$response = $gateway
    ->purchase($params)
    ->send();

if ($response->isRedirect()) {
    $response->redirect();
} else if ($response->isSuccessful()) {
    // process payment
} else {
    // process failure
}