adscomltd/cardinity-sdk-php

This package is abandoned and no longer maintained. No replacement package was suggested.

Client library for Cardinity credit card processing API

2.1.7 2020-09-13 08:50 UTC

This package is auto-updated.

Last update: 2024-01-21 07:58:45 UTC


README

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.