API client class for the finnish payment gateway Checkout Finland
Latest commit 7b39baf Nov 13, 2014 @rkioski readme update
Failed to load latest commit information.
example added examples Nov 12, 2014
src/CheckoutFinland added examples Nov 12, 2014
tests/Spec/CheckoutFinland add sendPost to client Nov 11, 2014
.gitignore Added readme.md Oct 15, 2014
.travis.yml Add travis configuration Nov 9, 2014
LICENSE Initial setup Oct 15, 2014
README.md readme update Nov 13, 2014
composer.json typo fix Nov 13, 2014
phpspec.yml Initial setup Oct 15, 2014



Build Status Latest Stable Version Latest Unstable Version License

API client for the finnish payment gateway Checkout Finland.


The following versions of PHP are supported:

  • PHP 5.4
  • PHP 5.5
  • PHP 5.6
  • HHVM


  • cURL or allow_url_fopen = On in php.ini

Client will try to send an HTTP POST by using PHP stream context with file_get_contents() or if that fails it will check if cURL extension is installed and try to use that instead.


Via composer

composer require rkioski/checkout-finland-api-client dev-master


Take a look at the example folder for a full working example.

Creating payment

require 'vendor/autoload.php';

use CheckoutFinland\Payment;
use CheckoutFinland\Client;

$demo_merchant_id       = "375917";
$demo_merchant_secret   = "SAIPPUAKAUPPIAS";
$return_url             = "http://yourservice.com/your_return_handling_script.php";

$payment = new  Payment($demo_merchant_id, $demo_merchant_secret);


$stamp          = time(); // unique id for the payment  
$amount         = '1000'; // amount is in cents
$reference      = '12344';
$message        = 'Nuts and bolts';
$delivery_date  = new \DateTime('2014-12-31');

$first_name     = 'John';
$family_name    = 'Doe';
$address        = 'Some Street 13 B 2';
$postcode       = '33100';
$post_office    = 'Some city';
$country        = 'FIN';
$language       = 'EN';

$payment->setOrderData($stamp, $amount, $reference, $message, $delivery_date);
$payment->setCustomerData($first_name, $family_name, $address, $postcode, $post_office, $country, $language);

$client = new Client();

$response = $client->sendPayment($payment);

$response_xml = @simplexml_load_string($response);
// redirect to payment page
header('Location: '.$response_xml->paymentURL);

// or show the payment buttons on your webpage, you will find all the data you need in the response xml

Handling return

require 'vendor/autoload.php';

use CheckoutFinland\Response;

$demo_merchant_secret   = "SAIPPUAKAUPPIAS";

$response = new Response($demo_merchant_secret);


    // now check the status parameter if the payment was paid and do whatever you do in your shop when you get money