Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 2.48 KB

README.md

File metadata and controls

65 lines (43 loc) · 2.48 KB

❗ This library points to Checkout.com's classic API. Please refer to the latest PHP SDK instead to benefit from the updated API

Requirements

PHP 5 > 5.3.0

How to use the library

Add the latest version of checkout-php-library into your project by using Composer or manually:

Using Composer (Recommended)

Either run the following command in the root directory of your project:

composer require checkout/checkout-php-api

Or require the Checkout.com package inside the composer.json of your project:

"require": {
    "php": ">=5.2.4",
    "checkout/checkout-php-api": "1.2.18"
},

Manually

Download or clone the github repository, master or download a release, and manually add it to your project.

Example

After adding the library to your project, include the file autoload.php found in root of the library.

include 'checkout-php-api/autoload.php';

You will be required to set the secret key when initialising a new APIClient instance. You will also have option for other configurations defined in AppSettings.php file.

The constructor available for configuration:

 __construct($secretKey, $env = 'sandbox' ,$debugMode = false, $connectTimeout = 60, $readTimeout =60)

 //Example:
use com\checkout;
$apiClient = new checkout\ApiClient('sk_test_XXXXXXXXXXXX');

By default both $connectTimeout and $readTimeout are to 60 seconds. You may change them as needed.

$env accepts either 'sandbox' or 'live' as value. This parameter allow you to shift between the sandbox environment or live environment. By Default the sandbox environment will be used.

Sample code for: