Skip to content

Initialize purchase

/klarna_instant_shopping/initialize_purchase

Target audience: Developers

1
Release version: 4.4.3

Initialize a Klarna Instant Shopping purchase

Introduction

This endpoint creates a klarna instant shopping session. This is used to gather information on a Klarna Instant Shopping purchase since the purchase is made at the merchant. Payway needs to have this information for setting up the initial order and payment.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/klarna_instant_shopping/initialize_purchase
Production https://backend.worldoftulo.com/external/api/v1/klarna_instant_shopping/initialize_purchase

Requirements

Identity Scope
No /external/klarna_payments/w

/payway/core_concepts/session/#payway-identity

Curl example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/klarna_instant_shopping/initialize_purchase \
  --header 'authorization: Bearer <token>' \
  --header 'content-type: application/json' \
  --data '{
    "purchase_id": "<UUID>",
    "account_id": "7f0d3aa745cfebfb8544ab21",
    "code":  "adeprimo_digital",
    "period_type": "limited",
    "period_id": "5f0d9ea795cfebfb8544ab12",
    "client_ip": "<client ip address>",
    "client_user_agent": "<client user agent>",
    "client_language": "<client language code>",
    "traffic_source": "traffic source",
    "merchant_reference": "merchant reference"
  }'

Parameters

The request should be sent as application/json.

Parameter Description Required Format
purchase_id Unique id for the purchase, needs to be generated on the seller site Yes String
account_id Payway account id that is making the purchase Yes String
code The code of the package or campaign e.g. adeprimo_digital Yes String
period_type limited or recurring. Always set to recurring for campaigns Yes String
period_id Specific payment period id.Use payment periods API for fetching available payment periods Yes String
client_ip Client browser ip, needed for setting up order and payment in Payway Yes String
client_user_agent Client browser user agent string, needed for setting up order and payment in Payway Yes String
client_language Client language Yes String
traffic_source Traffic source to save on order in Payway, must be pre-defined in PAP No String
merchant_reference Merchant reference to use for recurring Klarna payments No String

Response

The response is sent as application/json.

Example of a successful response:

1
2
3
4
5
{
  "item": {
    "purchase_id": "<UUID>"
  }
}

Parameter Description
purchase_id The purchase id that was sent

Errors

This API uses the common error conventions of the Payway API

See common error responses