GithubHelp home page GithubHelp logo

nicolas-joubert / kco_rest_php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from klarna/kco_rest_php

0.0 2.0 0.0 625 KB

PHP SDK library for Klarna Services

Home Page: https://developers.klarna.com/api/

License: Apache License 2.0

Shell 2.42% PHP 97.58%

kco_rest_php's Introduction

Klarna REST PHP SDK

Packagist Version Build Status Coverage Status

Welcome to Klarna. Smoooth payments.

Klarna Checkout

A full checkout experience embedded on your site. It lets your customers check out on your site with only their email and ZIP, and pay with the major payment methods including the specific Klarna payment methods. All available in one integration.

Klarna Payments

Klarna offers three payment methods. Pay now, Pay later and Slice it. It offers your consumers to try before they buy, finance purchases on your store, or make use of other payment options made available by Klarna.

Getting started

SDK covers all of Klarna API: https://developers.klarna.com/api/

Prerequisites

API Credentials

Before getting a production account you can get a playground one. Register here to be able to test your SDK integration before go live:

Later you need to register as a Klarna merchant to get a production credentials

PHP SDK Installation and Usage

To install the PHP SDK from the Central Composer repository use composer:

composer require klarna/kco_rest

Highly recommended to use version tag when installing SDK.

composer require klarna/kco_rest:1.2.3.4

Detailed information about the PHP SDK package and a list of available versions can be found here: https://packagist.org/packages/klarna/kco_rest

Include the SDK into your PHP file using the Composer autoloader:

<?php

require('vendor/autoload.php');

Documentation and Examples

Klarna API documentation: https://developers.klarna.com/api/
SDK References: https://klarna.github.io/kco_rest_php/

Example files can be found in the docs/ directory.
Additional documentation can be found at https://developers.klarna.com.

Logging and Debugging

PHP SDK logs information to STDOUT/STDERR. To enable debug mode, set DEBUG_SDK environment variable:

$ DEBUG_SDK=true php <your_program.php>

or

$ export DEBUG_SDK=1
$ php <your_program.php>

Another way to enable Debugging Mode is define the DEBUG_SDK inside your script:

<?php
// some code here
define('DEBUG_SDK', true);
// some code here

The output will look like:

DEBUG MODE: Request
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    GET : https://api.playground.klarna.com/customer-token/v1/tokens/TOKEN
Headers : {"User-Agent":["Library\/Klarna.kco_rest_php_3.1.0 (Guzzle\/6.3.3; curl\/7.54.0) OS\/Darwin_17.5.0 Language\/PHP_5.6.37"]}
   Body :

DEBUG MODE: Response
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Headers : {"Content-Type":["application\/json"],"Date":["Wed, 15 Aug 2018 15:55:53 GMT"],"Klarna-Correlation-Id":["ABC-123"],"Server":["openresty"],"Content-Length":["62"],"Connection":["keep-alive"]}
   Body : {
     "status" : "ACTIVE",
     "payment_method_type" : "INVOICE"
   }

Questions and feedback

If you have any questions concerning this product or the implementation, please create an issue: https://github.com/klarna/kco_rest_php/issues/new/choose

Use an official Klarna Contact us form (https://klarna.com) if you have a question about the integration.

How to contribute

At Klarna, we strive toward achieving the highest possible quality for our products. Therefore, we require you to follow these guidelines if you wish to contribute.

To contribute, the following criteria needs to be fulfilled:

  • Description regarding what has been changed and why
  • Pull requests should implement a boxed change
  • All code and documentation must follow the PSR-2 standard
  • New features and bug fixes must have accompanying unit tests:
    • Positive tests
    • Negative tests
    • Boundary tests (if possible)
    • No less than 90% decision coverage
  • All tests should pass

License

Klarna Checkout REST PHP SDK is licensed under Apache License, Version 2.0

kco_rest_php's People

Contributors

alexions avatar joakimlofgren avatar 0x20h avatar keis avatar freethan avatar mitemitreski avatar oradwell avatar sigismund avatar

Watchers

James Cloos avatar  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.