PHP 5 > 5.3.0
Add the latest version of checkout-php-library into your project by using Composer or manually:
Using Composer (Recommended)
Require the Checkout.com package inside the composer.json of your project:
"require": {
"php": ">=5.2.4",
"checkout/checkout-php-api": "1.2.6"
},
Manually
Download or clone the github repository, {master} or {release/v{version number}, 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 $readTimeouset to 60 seconds. You got option to change them as needed. $env accept 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: Tokens