• This repository has been archived on 02/Jun/2020
  • Stars
    star
    31
  • Rank 820,005 (Top 17 %)
  • Language
    PHP
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[DEPRECATED] Official PHP SDK library for Klarna Services

[DEPRECATED] Official Klarna REST PHP SDK

Packagist Version Build Status Coverage Status

SDK Deprecation Warning and Sunsetting

Dear community, the SDK you are currently looking at is now deprecated. These are details related to sunsetting:

  • We intend to archive this repo on June 1 2020 (01/06/20)
  • Until November 1 2020 (01/11/20) high severity security issues found within the latest published version will be fixed. All support will cease after this date.
  • No new builds will follow effective April 20 (20/04/2020) apart from the fixes mentioned above.

Workarounds

We are making Klarna REST API definition files available in Swagger / OAS v2 format, under the Klarna API Reference section on the Klarna Developer Portal. These will be regularly updated as the APIs evolve. You can use tools like https://swagger.io/tools/swagger-codegen/ to generate your own SDKs, client libraries, etc.

Shop now. Pay later.

Shop at your favorite stores today and experience the freedom to pay later with 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:

PHP SDK Installation and Usage

Install via Composer

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');

Manual installation

To install the PHP SDK manually you need to clone the repo to any folder on your machine:

git clone [email protected]:klarna/kco_rest_php.git /path/to/some/folder/kco_rest_php

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

<?php

require('/path/to/some/folder/kco_rest_php/src/autoload.php');

⚠️Warning: Using manually installed SDK requires you to use the CURLTransport instance to send HTTP requests.

Read more about How to use HTTP Transport

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

Be aware, the SDK just checks if the DEBUG_SDK is defined! It means you will see the debug information by using define('DEBUG_SDK', false); or export DEBUG_SDK=no

More information about the DEBUG_SDK flag can be found here: #32

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

More Repositories

1

electron-redux

Use redux in the main and browser processes in electron
JavaScript
743
star
2

ui

[Archived] 🔩 Klarna's UI components library
JavaScript
210
star
3

circuit_breaker

💥 An Erlang library for breaking out of faulty services
Erlang
180
star
4

ponos

ponos is a simple yet powerful load generator written in erlang
Erlang
158
star
5

mnesia_eleveldb

An eleveldb backend for Mnesia
Erlang
155
star
6

jesse

This repository is no longer actively maintained, please see
Erlang
135
star
7

erlavro

Avro support for Erlang/Elixir (http://avro.apache.org/)
Erlang
130
star
8

higher-order-components

A collection of useful React higher-order components
JavaScript
129
star
9

system_monitor

BEAM VM telemetry collector
Erlang
70
star
10

product-page-dataset

49
star
11

bec

The BitBucket Erlang Client
Erlang
47
star
12

snabbkaffe

Collection of utilities for trace-based testing
Erlang
45
star
13

brucke

Brucke - Inter-cluster bridge of kafka topics
Erlang
44
star
14

katt

This repository is no longer actively maintained, please see
Erlang
42
star
15

mnesia_pg

Postgres backend to Mnesia via mnesia_ext
Erlang
41
star
16

kco-mobile-sdk

[Deprecated] Klarna Checkout SDK for mobile apps in iOS and Android
HTML
38
star
17

kco_php

DEPRECATED: Klarna Checkout PHP library
PHP
33
star
18

leveldb_manager

Small service for snapshotting eleveldb without stopping the Erlang node
Erlang
32
star
19

klarna-mobile-sdk

Klarna Mobile SDK for iOS
Objective-C
28
star
20

remote-frames

Render a subset of the React tree to a different location, from many locations, without having to coordinate them
JavaScript
27
star
21

kastle

Kafka REST proxy
Erlang
27
star
22

kco_rest_java

[DEPRECATED] Official Java SDK library for Klarna Services
Java
24
star
23

react-native-zlib

Inflate/Deflate data compression via native code.
Java
24
star
24

react-native-klarna-inapp-sdk

Klarna's React Native wrapper for the In-App SDK
Kotlin
22
star
25

geofences-reducer

Reduces overlapping geofences
TypeScript
20
star
26

kco_rest_dotnet

[DEPRECATED] Official .NET.Core SDK library for Klarna Services
C#
20
star
27

avlizer

Avro Data Serializer for Erlang
Erlang
19
star
28

lager_middleman_backend

Erlang
18
star
29

soapbox

RIP: XMLRPCful microframework.
16
star
30

disable-scroll

Fix the screen to the current position and get a canvas where to draw on top of it
JavaScript
15
star
31

ui-react-components

Klarna's UI React Components
JavaScript
15
star
32

vnet

A model of a distributed Erlang network within a single VM.
Erlang
14
star
33

krc

RIP: The K Riak Client.
13
star
34

kco_python

Klarna Checkout Python Library
Python
13
star
35

klarna-mobile-sdk-flutter

Klarna's Flutter wrapper plugin for the Klarna Mobile SDK
Kotlin
10
star
36

hubot-stash-poll

Poll your Atlassian Stash repositories for pull request changes
CoffeeScript
10
star
37

klarna-on-demand-ios

Klarna On Demand SDK for iOS
Objective-C
10
star
38

graphite-erlang

A dead-simple graphite metrics writer for Erlang
Erlang
10
star
39

erl_unused_includes

Shell
10
star
40

kp-android-example-app

An example Android app to demonstrate Klarna Mobile SDK for Klarna Payments usage https://github.com/klarna/klarna-mobile-sdk
Kotlin
9
star
41

ui-css-components

Klarna's UI CSS Components
CSS
9
star
42

php-xmlrpc

DEPRECATED: the klarna xmlrpc library for php
PHP
9
star
43

kco_dotnet

DEPRECATED: Klarna Checkout dotnet library
C#
8
star
44

klarna-on-demand-android

Klarna On Demand SDK for Android
Java
8
star
45

rimu

RIP: Riak implementations of MeshUp interfaces.
Erlang
8
star
46

cloud9-gradle-template

Template workspace structure for a Java Gradle project in Cloud9
Java
7
star
47

katt-js

KATT (Klarna API Testing Tool) is an HTTP-based testing tool for Node.
CoffeeScript
7
star
48

op5-cli

A command-line interface for the OP5 monitoring system
Python
7
star
49

day.zip

Shell
6
star
50

op5lib

A Python library for OP5's REST API.
Python
6
star
51

smoooth-tutorials

Repository hosting all code examples for the Klarna Smoooth Tutorials
JavaScript
6
star
52

kco_java

DEPRECATED:Klarna Checkout Java Library
Java
6
star
53

kp-ios-example-app

An example iOS app to demonstrate Klarna Mobile SDK for Klarna Payments usage
Swift
5
star
54

klarna.github.io

HTML
5
star
55

stdapp.mk

Generic Makefile for building Erlang applications
Makefile
5
star
56

sample-digital-goods-backend

A sample integration of Klarna's Digital Goods
Ruby
5
star
57

browser

☔ "It is best to act with confidence, no matter how little right you have to it." Lillian Hellman
JavaScript
5
star
58

ansible-role-import-and-trust-certificate

Ansible role for importing and trusting PEM certificates.
4
star
59

on-demand-for-digital-goods-docs

4
star
60

op5lib_ansible

Python
4
star
61

cloudconfig

Cloudconfig is an application that manages configurations for resources in Cloudstack.
Ruby
4
star
62

restit

REST Interface Tool is a prototype for consuming pure REST APIs.
CoffeeScript
4
star
63

hybrid-android-example-app

Kotlin
3
star
64

m2-kco-postnl

Magento 2.x Add-On module to add support for PostNL to Klarna Checkout
JavaScript
3
star
65

katt-util

KATT utilities for KATT blueprints.
CoffeeScript
2
star
66

sample-ondemand-backend

A very slim backend that facilitates purchases for an app using the Klarna on Demand SDK.
Ruby
2
star
67

klarna-apigen-theme

Klarna ApiGen Theme
HTML
2
star
68

m1-klarna-payments

Magento 1.x Klarna Payments plugin
PHP
2
star
69

kco_asp

Klarna Checkout ASP Library
ASP
2
star
70

kp-mobile-sdk

Klarna Payments SDK for mobile apps in iOS and Android
2
star
71

sfcc-klarna-payments

Salesforce Commerce Cloud Cartdrige for Klarna Payments Integration
JavaScript
2
star
72

ui-workshop

Konferense 2016 - UI Components workshop
JavaScript
2
star
73

kco-android-example-app

An example Android app to demonstrate Klarna Checkout SDK usage
Java
2
star
74

katt-player

KATT player is a mock HTTP server that replies with HTTP responses based on KATT blueprints.
CoffeeScript
2
star
75

klarna-mobile-sdk-android

Klarna Mobile SDK for Android
2
star
76

m1-klarna-checkout

Magento 1.x Klarna Checkout plugin
PHP
1
star
77

kco-ios-example-app

An example iOS app to demonstrate Klarna Checkout SDK usage
Objective-C
1
star
78

nordicjs

A code challenge and short presentation to show at nordic.js
CSS
1
star
79

klarna-on-demand-integration-tests

Contains common integration tests for Klarna's on Demand SDKs
Ruby
1
star
80

m1-kp-altaddress

Magento 1.x Sample Add-On module to add support for EMD to Klarna Payments
PHP
1
star
81

cookbook-secretfiles

Generic way of handling encrypted files
Ruby
1
star
82

ansible-role-homebrew

Ansible role for installing Homebrew and Homebrew Cask.
1
star
83

KlarnaMobileSDKDemo

Klarna Mobile SDK demo app for iOS
Swift
1
star
84

kco-cordova-example-app

An example Cordova app to demonstrate Klarna Checkout SDK usage
Java
1
star
85

ui-prototype

A base for prototyping
JavaScript
1
star
86

passkeyring

Python
1
star
87

on-demand-for-digital-goods-python

On demand for digital goods. Simple example in Python
Python
1
star
88

gradle-react-native

Gradle Plugin for Building React Native projects
Kotlin
1
star
89

m1-kco-altaddress

Magento 1.x Sample Add-On module to add support for EMD to Klarna Checkout
PHP
1
star
90

ipx-mock

A mock for IPX SMS Service
Ruby
1
star
91

omniauth-klarna

This is the official OmniAuth strategy to authenticate with Klarna via OAuth2.
Ruby
1
star
92

react-native-klarna

A React Native wrapper around Klarna Checkout SDK
Java
1
star
93

swedish_personal_number

A Value Object that provides some convenience helpers to deal with Swedish personal numbers
Ruby
1
star