dev-master
9999999-devAPI client for the payment gateway of Checkout Finland Oy.
MIT
The Requires
- php >=5.4
The Development Requires
api payment gateway checkout finland
API client for the payment gateway of Checkout Finland Oy.
API client for the finnish payment gateway Checkout Finland., (*2)
The following versions of PHP are supported:, (*3)
Requires: * cURL or allow_url_fopen = On in php.ini, (*4)
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., (*5)
Via composer, (*6)
composer require rkioski/checkout-finland-api-client dev-master
Take a look at the example folder for a full working example., (*7)
Creating payment, (*8)
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); $payment->setUrls($return_url); $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, (*9)
require 'vendor/autoload.php'; use CheckoutFinland\Response; $demo_merchant_secret = "SAIPPUAKAUPPIAS"; $response = new Response($demo_merchant_secret); $response->setRequestParams($_GET); if($response->validate()) { // now check the status parameter if the payment was paid and do whatever you do in your shop when you get money }
API client for the payment gateway of Checkout Finland Oy.
MIT
api payment gateway checkout finland