PHPackages                             vrajroham/php-klarna - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. vrajroham/php-klarna

ActiveLibrary[Payment Processing](/categories/payments)

vrajroham/php-klarna
====================

Klarna REST PHP SDK

v2.0.0(8mo ago)029[1 issues](https://github.com/vrajroham/php-klarna/issues)MITPHPPHP ^8.0CI passing

Since Sep 28Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/vrajroham/php-klarna)[ Packagist](https://packagist.org/packages/vrajroham/php-klarna)[ Docs](https://github.com/vrajroham/php-klarna)[ RSS](/packages/vrajroham-php-klarna/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (6)Used By (0)

PHP Klarna SDK
==============

[](#php-klarna-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/87f7275e0ee63183e7e9913eb3ca35b2b46951c18df1a7112a5f578e03cff809/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7672616a726f68616d2f7068702d6b6c61726e612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vrajroham/php-klarna)[![Build Status](https://camo.githubusercontent.com/0aa7eb8be32970dcd71aa52affd389e8e06bb0b70914e4a3d866260f0051661d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7672616a726f68616d2f7068702d6b6c61726e612f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/vrajroham/php-klarna)[![Quality Score](https://camo.githubusercontent.com/58529a3153206cb59caef7a26674bb553a7653a25e64d6a03cf84306286c3fe9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7672616a726f68616d2f7068702d6b6c61726e612e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/vrajroham/php-klarna)[![Total Downloads](https://camo.githubusercontent.com/103a30fe03792d9d792122fd43f2c3bff9dbf98a3a6853f466834cf3d769f028/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7672616a726f68616d2f7068702d6b6c61726e612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vrajroham/php-klarna)[![PHP Composer](https://github.com/vrajroham/php-klarna/actions/workflows/php.yml/badge.svg)](https://github.com/vrajroham/php-klarna/actions/workflows/php.yml)

A comprehensive PHP SDK for integrating with Klarna's REST APIs. This package provides a clean, intuitive interface for all major Klarna services including Payments, Orders, Checkouts, and Customer Token management.

🚀 Features
----------

[](#-features)

- **Complete API Coverage**: Support for Payments, Orders, Checkouts, and Customer Tokens APIs
- **Multi-Region Support**: Works with EU, North America (NA), and Oceania (OC) regions
- **Environment Flexibility**: Easy switching between test (playground) and live environments
- **Type-Safe**: Built with proper PHP typing and comprehensive error handling
- **Developer Friendly**: Intuitive method names and comprehensive documentation
- **PSR-4 Compliant**: Follows PHP-FIG standards for autoloading
- **Modern PHP**: Requires PHP 8.0+ with latest dependencies

📋 Requirements
--------------

[](#-requirements)

- PHP 8.0 or higher
- Guzzle HTTP Client 6.5+ or 7.1+
- Carbon 2.40+ for date handling
- Valid Klarna API credentials

🔐 Prerequisites &amp; Authentication
------------------------------------

[](#-prerequisites--authentication)

### Getting Klarna API Credentials

[](#getting-klarna-api-credentials)

Before using this SDK, you need to obtain API credentials from Klarna:

1. **For Testing**: Sign up for a [Klarna Playground account](https://docs.klarna.com/resources/developer-tools/testing-payments/before-you-test/)
2. **For Production**: Contact Klarna to get live API credentials

### Authentication Details

[](#authentication-details)

Klarna uses **HTTP Basic Authentication** with:

- **Username**: Your Klarna API username (UID)
- **Password**: Your Klarna API password

### Required Headers

[](#required-headers)

The SDK automatically sets these headers:

```
Authorization: Basic {base64(username:password)}
Accept: application/json
Content-Type: application/json

```

### Regions &amp; Endpoints

[](#regions--endpoints)

RegionCodeTest Base URLLive Base URLEurope`EU``https://api.playground.klarna.com/``https://api.klarna.com/`North America`NA``https://api-na.playground.klarna.com/``https://api-na.klarna.com/`Oceania`OC``https://api-oc.playground.klarna.com/``https://api-oc.klarna.com/`📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require vrajroham/php-klarna
```

⚡ Quick Start
-------------

[](#-quick-start)

### Basic Setup

[](#basic-setup)

```
