Klarna Docs - Sharing Subscription Details with Klarna

Sharing Subscription Details with Klarna

Klarna’s automatic payments provides our partners with support for the acquisition of payments for their subscription use cases. When an order gets created in this context, Klarna requires a specific field to be sent along the order lines.

The subscription object lets Klarna make better underwriting decisions and present more appropriate payment options (like monthly subscriptions vs. annual), it is also leveraged and plays a vital role in the post-purchase display of automatic payments in the Klarna app.  

Technical considerations:

  • Klarna doesn’t manage, maintain or validate unicity of the data points sent, meaning that any subscription name sent will be accepted, regardless of it existing on your side  
  • subscription should be included whenever order lines are shared - both in the token creation flow (create session, load, auth, create order) and the creation of an order using a token.
  • When using “delayed captures” with our Order Management API, you will need to include the subscription object if you override order lines.

The subscription object contains the following elements:  

ElementFormatDescriptionRequired
namestringThe name of the subscription product.  This string should not include the name of the merchant or partner.  The recommended format would include a subscription id and double curly brackets as follows: Premium Membership {{12394832}} Y
intervalstringThe cadence unit for the subscription plan.  Allowed values: "DAY", "WEEK", "MONTH", "YEAR"Y
interval_countintThe corresponding number for the interval unit.Y

To demonstrate how to use set the values in the object, for a subscription that is charged quarterly, the value of the interval would be "MONTH" and the interval_count to 3. For an annually charged subscription, the interval would be "YEAR" and the interval_count would be 1.

In the recommended format example for the name element in the table above, Premium Membership {{12394832}}, “Premium Membership” is the name of the subscription product and “12394832” the identifier used for this subscription for this consumer. Klarna may group multiple orders related to the same identifier for the same subscription product when presenting payment information to the consumer.

A consumer has subscribed to a monthly streaming subscription for 15.99 every month. The customer has a free 14 day trial to start.

Create Session: Order lines include  the subscription object

JSON
POST /payments/v1/sessions 
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA== 
Content-Type: application/json 
{ 
  "intent": "tokenize",
  "purchase_country": "DE", 
  "purchase_currency": "EUR", 
  "locale": "de-DE", 
  "order_amount": 0, 
  "order_tax_amount": 0, 

Order lines expected when creating automatic payments:

Create Customer Token Order Request with the Subscription Object

JSON
POST /customer-token/v1/tokens/{customerToken}/order 
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA== 
Klarna-Idempotency-Key: b19f321c-8f38-11ec-b909-0242ac120002
Content-Type: application/json 
{ 
  "auto_capture": true,
  "purchase_country": "DE", 
  "purchase_currency": "EUR", 
  "locale": "de-DE",
  "merchant_reference1": "123456",

A consumer has subscribed to regularly receive 2 different goods with different rhythms: ink cartridges every month and deodorant creme every 2 months.

Multiple Subscription Items (Create Session)

JSON
POST /payments/v1/sessions 
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA== 
Content-Type: application/json 
{ 
  "intent": "buy_and_tokenize",
  "purchase_country": "DE", 
  "purchase_currency": "EUR", 
  "locale": "de-DE", 
  "billing_address": {
       	"given_name": "Thomas",

Place Order Request to complete the first purchase at checkout:

JSON
POST /payments/v1/authorizations/<authorization_token>/order
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json
{
  "purchase_country": "DE",
  "purchase_currency": "EUR",
  "billing_address": {
       	"given_name": "Thomas",
       	"family_name": "Testkunde",
       	"email": "thomas.testkunde@gmail.com",

Create Customer Token Order Request for month 1

JSON
POST /customer-token/v1/tokens/{customerToken}/order 
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA== 
Klarna-Idempotency-Key: b19f321c-8f38-11ec-b909-0242ac122202
Content-Type: application/json 
{ 
  "auto_capture": true,
  "purchase_country": "DE", 
  "purchase_currency": "EUR", 
  "locale": "de-DE",
  "merchant_reference1": "123456",

Create Customer Token Order Request for month 2

JSON
POST /customer-token/v1/tokens/{customerToken}/order 
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA== 
Klarna-Idempotency-Key: b19f321c-8f38-11ec-b909-0242ac121102
Content-Type: application/json 
{ 
  "auto_capture": true,
  "purchase_country": "DE", 
  "purchase_currency": "EUR", 
  "locale": "de-DE",
  "merchant_reference1": "123456",

Sample Capture Request with the subscription object:

JSON
POST /ordermanagement/v1/orders/{order_id}/captures
Authorization: Basic pwhcueUff0MmwLShJiBE9JHA==
Content-Type: application/json
{
  "captured_amount": 999,
  "reference": "12345678", 
  "order_lines": [{ 
        "type": "digital", 
        "subscription": { 
        	"name": " Premium Monthly {{1234834}}",