Git Product home page Git Product logo

checkout-sdk-php's Introduction

The Checkout SDK for PHP enables developers to easily work with Checkout.com APIs. It requires PHP 5.6.

Getting Help

If you encounter a bug with Checkout SDK for PHP please search the existing issues and try to make sure your problem doesn’t already exist before opening a new issue. The GitHub issues are intended for bug reports and feature requests. For help and questions with using Checkout SDK for PHP please contact our integration support team.

For full usage details, see the Wiki.

Installation

Installation with Composer (Recommended)

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

composer require checkout/checkout-sdk-php

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

"require": { "php": ">=5.6", "checkout/checkout-sdk-php": "1.0.0"}.

Clone repository

Alternatively you can clone the repository from GitHub with git clone

git clone [email protected]:checkout/checkout-sdk-php.git

Quickstart

A card token can be obtained using one of Checkout.com's JavaScript frontend solutions such as Frames or any of the mobile SDKs

Include a checkout-sdk-php/checkout.php to access the operations for each API:

use Checkout\CheckoutApi;
use Checkout\Models\Tokens\Card;
use Checkout\Models\Payments\TokenSource;
use Checkout\Models\Payments\Payment;

// Set the secret key
$secretKey = 'sk_test_key';

// Initialize the Checkout API in Sandbox mode. Use new CheckoutApi($liveSecretKey, false); for production
$checkout = new CheckoutApi($secretKey);


// Create a payment method instance with card details
$method = new TokenSource('tok_key_goes_here');

// Prepare the payment parameters
$payment = new Payment($method, 'GBP');
$payment->amount = 1000; // = 10.00

// Send the request and retrieve the response
$response = $checkout->payments()->request($payment);

Tests

Install PHPUnit by running composer require --dev phpunit/phpunit and execute the tests with ./vendor/bin/phpunit.

checkout-sdk-php's People

Contributors

aquila-freitas-cko avatar david-fiaty-cko avatar nicolas-maalouf-cko avatar alfie-loakes-cko avatar ioan-ghisoi-cko avatar abdelrahman-iaaly-cko avatar shiuh-yaw avatar ioan-ghisoi avatar jjclane avatar mruz avatar toooni avatar vitse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.