Name Last Update
..
docs Loading commit data...
spec Loading commit data...
src Loading commit data...
tests Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
composer.json Loading commit data...
phpspec.yml.dist Loading commit data...
phpunit.xml.dist Loading commit data...

Cardinity Client PHP Library

Build Status Scrutinizer Code Quality

This is official PHP client library for Cardinity's API.
Library includes all the functionality provided by API. Library was designed to be flexible and self-explanatory for developers to implement.

Documentation

More detailed documentation with usage examples can be found here.

Usage

Installing via Composer

$ php composer.phar require cardinity/cardinity-sdk-php

Direct Download

You can download the latest release file starting with cardinity-sdk-php-*.zip.

Making API Calls

Initialize the client object

use Cardinity\Client;
$client = Client::create([
    'consumerKey' => 'YOUR_CONSUMER_KEY',
    'consumerSecret' => 'YOUR_CONSUMER_SECRET',
]);

Create new payment

use Cardinity\Method\Payment;
$method = new Payment\Create([
    'amount' => 50.00,
    'currency' => 'EUR',
    'settle' => false,
    'description' => 'some description',
    'order_id' => '12345678',
    'country' => 'LT',
    'payment_method' => Payment\Create::CARD,
    'payment_instrument' => [
        'pan' => '4111111111111111',
        'exp_year' => 2021,
        'exp_month' => 12,
        'cvc' => '456',
        'holder' => 'Mike Dough'
    ],
]);
/** @type Cardinity\Method\Payment\Payment */
$payment = $client->call($method);
$paymentId = $payment->getId();
// serializes object into string for storing in database
$serialized = serialize($payment);

Get existing payment

$method = new Payment\Get('cb5e1c95-7685-4499-a2b1-ae0f28297b92');
/** @type Cardinity\Method\Payment\Payment */
$payment = $client->call($method);

API documentation

https://developers.cardinity.com/api/v1/

Development Status

All the API v1 methods are implemented.