Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
composer.lock
composer.phar
/nbproject/
/.idea/*
/.idea/*
/build/*
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ branches:

matrix:
include:
- php: 5.4
- php: 5.5
- php: 5.6
- php: 7
- php: 7.1
Expand Down
238 changes: 234 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,235 @@
[![Build Status](https://travis-ci.org/andypieters/omnipay-paynl.svg?branch=master)](https://travis-ci.org/andypieters/omnipay-paynl)
[![Coverage Status](https://coveralls.io/repos/github/andypieters/omnipay-paynl/badge.svg?branch=master)](https://coveralls.io/github/andypieters/omnipay-paynl?branch=master)
<p align="center">
<img src="https://www.pay.nl/uploads/1/brands/main_logo.png" />
</p>
<h1 align="center">PAY. Omnipay driver</h1>

# omnipay-paynl
Pay.nl driver for the Omnipay payment processing library
# Description

PAY. driver for the Omnipay payment processing library

- [Description](#description)
- [Available payment methods](#available-payment-methods)
- [Requirements](#requirements)
- [Installation](#installation)
- [Update instructions](#update-instructions)
- [Usage](#usage)
- [Support](#support)


# Available payment methods

Bank Payments | Creditcards | Gift cards & Vouchers | Pay by invoice | Others |
:-----------: | :-----------: | :-----------: | :-----------: | :-----------: |
iDEAL + QR |Visa | VVV Cadeaukaart | AfterPay | PayPal |
Bancontact + QR | Mastercard | Webshop Giftcard | Achteraf betalen via Billink | WeChatPay |
Giropay |American Express | FashionCheque | Focum AchterafBetalen.nl | AmazonPay |
MyBank | Carte Bancaire | Podium Cadeaukaart | Capayable Achteraf Betalen | Cashly |
SOFORT | PostePay | Gezondheidsbon | in3 keer betalen, 0% rente | Pay Fixed Price (phone) |
Maestro | Dankort | Fashion Giftcard | Klarna | Instore Payments (POS) |
Bank Transfer | Cartasi | GivaCard | SprayPay | Przelewy24 |
| Tikkie | De Cadeaukaart | YourGift | Creditclick | Apple Pay |
| Multibanco | | Paysafecard | | Payconiq
| | | Huis en Tuin Cadeau


# Requirements

PHP 5.6 or higher


# Installation
#### Installing

In command line, navigate to the installation directory of Omnipay

Enter the following command:

```
composer require league/omnipay:^3 paynl/omnipay-paynl
```

The plugin is now installed


##### Setup

1. Create a new php file
2. Use the following code:
```
# require autoloader
require_once('vendor/autoload.php');

use Omnipay\Omnipay;

# Setup payment gateway
$gateway = Omnipay::create('Paynl');

$gateway->setApiToken('abcdefgdjwaiodjwaodjaowidwad');
$gateway->setTokenCode('AT-0000-0000');
$gateway->setServiceId('SL-0000-0000');
```
3. Enter the TokenCode, API token and serviceID (these can be found in the PAY. Admin Panel --> https://admin.pay.nl/programs/programs
4. Save the file
5. Require the file where you wish to use the plugin.

Go to the *Manage* / *Services* tab in the PAY. Admin Panel to enable extra payment methods.


#### Update instructions

In command line, navigate to the installation directory of Omnipay

Enter the following command:

```
composer update league/omnipay:^3 paynl/omnipay-paynl
```

The plugin has now been updated


# Usage


PAY. items
```
# Use PAY. Item class
use Omnipay\Paynl\Common\Item;

# Add items to transaction
$arrItems = array();
$item = new Item();
$item->setProductId('SKU01')
->setProductType('ARTICLE')
->setVatPercentage(21)
->setDescription('Description')
->setName('PAY. article')
->setPrice('10')
->setQuantity(4);
$arrItems[] = $item;

$item = new Item();
$item->setProductId('SHIP01')
->setProductType('SHIPPING')
->setVatPercentage(21)
->setDescription('Description')
->setName('PAY. shipping')
->setPrice('5')
->setQuantity(1);
$arrItems[] = $item;

$item = new Item();
$item->setProductId('SKU02')
->setProductType('DISCOUNT')
->setVatPercentage(21)
->setDescription('Description')
->setName('PAY. promotion')
->setPrice('1')
->setQuantity(1);
$arrItems[] = $item;
```

Start a transaction

```
# Send purchase request
$response = $gateway->purchase(
[
'amount' => '46.00',
'currency' => 'USD',
'transactionReference' => 'referenceID1',
'clientIp' => '192.168.192.12',
'returnUrl' => 'http://dev.local:8080/pay.php',
'items' => $arrItems,
'card' => array(
'firstName' => 'Example',
'lastName' => 'User',
'gender' => 'M',
'birthday' => '01-02-1992',
'phone' => '1111111111111111',
'email' => '[email protected]',
'country' => 'NL',

'shippingAddress1' => 'Shippingstreet 1B',
'shippingAddress2' => '',
'shippingCity' => 'Shipingtown',
'shippingPostcode' => '1234AB',
'shippingState' => '',
'country' => 'NL',

'billingFirstName' => 'Billingexample',
'billingLastName' => 'Billinguser',
'billingAddress1' => 'Billingstreet 1B',
'billingAddress2' => '',
'billingCity' => 'Billingtown',
'billingPostcode' => '1234AB',
'billingState' => '',
'country' => 'NL'
)
]
)->send();

# Process response
if ($response->isSuccessful()) {

# Payment was successful
var_dump($response);

} elseif ($response->isRedirect()) {

# Redirect to offsite payment gateway
# $response->redirect();
var_dump($response);

} else {

# Payment failed
echo $response->getMessage();
}
```

Refund a transaction
```
$response = $gateway->refund([
'transactionReference' => "PAY. transactionId",
'amount' => '46.00',
'currency' => 'USD',
'transactionId' => 765897
])->send();

if ($response->isSuccessful()) {

# Refund was successful
print_r($response);

} else {

# Refund failed
echo $response->getMessage();
}

```

Capture a transaction
```
$response = $gateway->capture([
'transactionReference' => "PAY. transactionId",
'items' => $arrItems
])->send();

if ($response->isSuccessful()) {

# Capture was successful
print_r($response);

} else {

# Capture failed
echo $response->getMessage();
}
```

# Support
https://www.pay.nl

Contact us: [email protected]
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "andypieters/omnipay-paynl",
"name": "paynl/omnipay-paynl",
"type": "library",
"description": "Pay.nl driver for the Omnipay payment processing library",
"keywords": [
Expand Down
Loading