PHPackages                             mnording/klarna-sms - 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. [API Development](/categories/api)
4. /
5. mnording/klarna-sms

ActiveLibrary[API Development](/categories/api)

mnording/klarna-sms
===================

SDK for integrating the Klarna SMS solution

0111PHP

Since Feb 3Pushed 9y ago2 watchersCompare

[ Source](https://github.com/mnording/KlarnaOfflineSDK-PHP)[ Packagist](https://packagist.org/packages/mnording/klarna-sms)[ RSS](/packages/mnording-klarna-sms/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Klarna Offline SDK
==================

[](#klarna-offline-sdk)

**Library that integrates and utilizes the Klarna offline API**

The full API specs are avaliable at apiary -&gt;

Installing the library
----------------------

[](#installing-the-library)

Best option for install is by composer

```
 composer require mnording/klarna-sms
```

Setting up the cart and config
------------------------------

[](#setting-up-the-cart-and-config)

Firstly you create a config of the current culture, your currency, country, shared secret and store ID.

```
$config = new MerchantConfig("Merchant_ID","Shared_SECRET","SEK","SE","sv-se",ServerMode::TEST);
```

To recieve your merchant ID and shared secret for your integration you will need to reach out to Klarna.

You then create a cart, and populate it with items

```
$cart = new Cart();
$item = new \Klarna\Entities\CartRow("test","testref",2000,2,25);
$cart->AddProduct($item);
```

You are also able to define discounts for the cart.

```
$discount = new \Klarna\Entities\CartRow("dicount","code222",-1000,1,25);
$cart->AddDiscount($discount);
```

*Note:* Prices are entered with amount of cents. Meaning a product that costs 10 SEK, you must enter 1000.

Creating the order
------------------

[](#creating-the-order)

First you send in the cart and config and an optional push url

**Use polling method**By only starting the order, you will receive a status url hosted by klarna that will communicate the order details once the customer has completed the purchase.

```
$order = new KlarnaSMSOrder($config,$cart,"PHONE","Terminal","Reference");
```

**Use push url method**If you define a status url, then order-data will be pushed to that url when customer has completed the purchase.

```
$t = new KlarnaSMSOrder($config,$cart,"PHONE","Terminal","Reference","https://myownsite.com/createorderwithstatusurl.php");
```

**Create the order**The create call will create the actual KCO session and send out the SMS to the consumer

```
$order->Create();
```

If you did not define your own status URL, Klarna will create one for you that you will use for polling the result of the transaction

**Cancel ongoing order**

```
$order->Cancel();
```

Note: Order must have been created before you can cancel it.

Reading the customer details
----------------------------

[](#reading-the-customer-details)

**Using polling method:**If you wanted Klarna to create a status url for you, you can use the pollUrl function to fetch the order-data.

```
$order->PollStatus(30);
```

This url will timeout every 60 seconds and you will need to re-trigger it to check as long as the customer has not completed the purchase

```
$orderdetails = $t->GetOrderInformation();
```

**Using status url method**If you defined your own statusurl, Klarna will post data to that url.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2128809?v=4)[Mattias Nording](/maintainers/mnording)[@mnording](https://github.com/mnording)

---

Top Contributors

[![mnording](https://avatars.githubusercontent.com/u/2128809?v=4)](https://github.com/mnording "mnording (23 commits)")

### Embed Badge

![Health badge](/badges/mnording-klarna-sms/health.svg)

```
[![Health](https://phpackages.com/badges/mnording-klarna-sms/health.svg)](https://phpackages.com/packages/mnording-klarna-sms)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
