2017 © Pedro PelĂĄez
 

library paytrail-php

Paytrail REST client for PHP.

image

nordsoftware/paytrail-php

Paytrail REST client for PHP.

  • Monday, June 12, 2017
  • by crisu83
  • Repository
  • 37 Watchers
  • 11 Stars
  • 1,389 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 14 Versions
  • 13 % Grown

The README.md

paytrail-php

Build Status Coverage Status, (*1)

Paytrail REST client for PHP., (*2)

Usage

<?php

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

use Paytrail\Object\UrlSet;
use Paytrail\Object\Address;
use Paytrail\Object\Contact;
use Paytrail\Object\Payment;
use Paytrail\Object\Product;
use Paytrail\Http\Client;

$urlSet = new UrlSet;
$urlSet->configure(array(
  'successUrl'      => 'https://www.demoshop.com/sv/success',
  'failureUrl'      => 'https://www.demoshop.com/sv/failure',
  'notificationUrl' => 'https://www.demoshop.com/sv/notify',
));

$address = new Address;
$address->configure(array(
  'streetAddress'   => 'Test street 1',
  'postalCode'      => '12345',
  'postalOffice'    => 'Helsinki',
  'countryCode'     => 'FI',
));

$contact = new Contact;
$contact->configure(array(
  'firstName'       => 'Test',
  'lastName'        => 'Person',
  'email'           => 'test.person@demoshop.com',
  'phoneNumber'     => '040123456',
  'companyName'     => 'Demo Company Ltd',
  'address'         => $address,
));

$payment = new Payment;
$payment->configure(array(
  'orderNumber'     => 1,
  'urlSet'          => $urlSet,
  'contact'         => $contact,
  'locale'          => Payment::LOCALE_ENUS,
));

$product = new Product;
$product->configure(array(
  'title'           => 'Test product',
  'code'            => '01234',
  'amount'          => 1.00,
  'price'           => 19.90,
  'vat'             => 23.00,
  'discount'        => 0.00,
  'type'            => Product::TYPE_NORMAL,
));

$payment->addProduct($product);

$client = new Client('13466', '6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ');
$client->connect();
try {
  $result = $client->processPayment($payment);
} catch (Exception $e) {
  die('Paytrail payment failed: ' . $e->getMessage());
}

header('Location: ' . $result->getUrl());

Confirming a payment


<?php $client = new Client('13466', '6pKF4jkv97zmqBJ3ZL8gUw5DfT2NMQ'); $client->connect(); if ($client->validateChecksum($_GET["RETURN_AUTHCODE"], $_GET["ORDER_NUMBER"], $_GET["TIMESTAMP"], $_GET["PAID"], $_GET["METHOD"])) { // Payment receipt is valid // If needed, the used payment method can be found from the variable $_GET["METHOD"] // and order number for the payment from the variable $_GET["ORDER_NUMBER"] } else { // Payment receipt was not valid, possible payment fraud attempt }

License

MIT. See LICENSE., (*3)

The Versions

12/06 2017

dev-master

9999999-dev

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

12/06 2017

1.0.0

1.0.0.0

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

12/06 2017

dev-develop

dev-develop

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

13/09 2016

0.4.0

0.4.0.0

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

16/05 2016

0.3.2

0.3.2.0

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

29/03 2016

0.3.1

0.3.1.0

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

24/03 2016

0.3.0

0.3.0.0

Paytrail REST client for PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kenneth Söderlund

30/10 2014

0.2.0

0.2.0.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

02/02 2014

0.1.5

0.1.5.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

04/12 2013

0.1.4

0.1.4.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

28/11 2013

0.1.3

0.1.3.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

28/11 2013

0.1.2

0.1.2.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

28/11 2013

0.1.1

0.1.1.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

28/11 2013

0.1.0

0.1.0.0

Paytrail REST client for PHP.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires