FILTER BY TAG

Updating a Session

You can update a session for 48 hours after creating it. The session update service enables you to update items in the cart and customer information, with or without sending customer billing details. However, when you send customer billing details in the session update request, send as many billing details as possible for the best customer checkout experience. For a list of all of the information you can update in a session, see the Optional Fields for Updating a Session.
Updating a session requires the request ID from the original session, which is in the
id
response field.
Only update a session after the customer consents to sharing their data with Klarna.
IMPORTANT
PII data about a customer should be sent only after the customer chooses the Klarna payment option on your checkout page and consents to sharing their data with Klarna.

Klarna Payment Methods

When you request the session service, you can determine the Klarna payment method you want to offer your customers. Set the optional
paymentInformation.paymentType.method.type
request field to a value listed in the Payment Method column.
Payment Methods
Payment Method Field Value
Description
Klarna Products
pay_later
Customer pays total bill at a set date.
  • Klarna Invoice
  • Klarna Pay Later
  • Klarna Pay Later by Card (PLBC)
pay_now
Customer pays total bill at the time of checkout.
  • Klarna Direct Bank Transfer
  • Klarna Direct Debit
pay_over_time
Customer pays bill in equal multiple installments.
  • Klarna Account
  • Klarna Financing
  • Klarna Fixed Installment Plans
  • Klarna Interest Free
Example: Payment Methods in Session Request
{ "paymentInformation": { "paymentType": { "method": { "type": "pay_later" } } } }

Language Specification

To set the language for your Klarna checkout experience, include the
buyerInformation.language
field in your request. By not including this field, the Klarna checkout experience is set to English by default. For a list of all possible values, see the
ISO Standard Language Codes
guide.
Example: Language Specification
{ "buyerInformation": { "language": "es" } }

Endpoints

Send a PATCH request to one of these endpoints:
Production:
PATCH
https://api.cybersource.com
/pts/v2/payment-references/
{id}
Test:
PATCH
https://apitest.cybersource.com
/pts/v2/payment-references/
{id}
Set the
{id}
to the request ID contained in the original session response.

Response Status

The session service responds with one of these statuses as the field value:
  • INITIATED
    : The session is initiated and the customer may now checkout.
  • COMPLETED
    : The customer completed the checkout process.
The session service also responds with a reason code as the field value. For more information about reason codes, see the .

Response Statuses

The session service responds with one of these statuses as the field value:
  • COMPLETED
    : The customer completed the checkout process.
  • INITIATED
    : The session is initiated and the customer may now checkout.
The session service also responds with a reason code as the field value. For more information about reason codes, see the .

Required Fields for Updating a Session

Country-Specific Fields

Non-US Countries
US and Canada
IMPORTANT
The billing state and billing postal code fields are required when the billing country is set to
US
or
CA
.

Example: Update a Session

Request
{ "merchantInformation": { "cancelUrl": "https://www.test0.com", "successUrl": "https://www.google.com", "failureUrl": "https://www.test1.com" }, "orderInformation": { "billTo": { "administrativeArea": "CA", "postalCode": "22901", "country": "US" }, "amountDetails": { "currency": "USD" }, "lineItems": [ { "productName": "Skirt on the sky", "unitPrice": "2.00", "totalAmount": "2.00" } ] }, "paymentInformation": { "paymentType": { "name": "INVOICE", "method": { "name": "KLARNA" } } }, "processingInformation": { "actionList": "AP_SESSIONS", "paymentFlowMode": "HOP", "sessionType": "U" } }
Response to a Successful Request
{ "_links": { "self": { "method": "POST", "href": "/pts/v2/payment-references" }, "updateSession": { "method": "PATCH", "href": "/pts/v2/payment-references/7303027715656351504951" }, "status": { "method": "POST", "href": "/pts/v2/refresh-payment-status/7303027715656351504951" }, "order": { "method": "POST", "href": "/pts/v2/payment-references/7303027715656351504951/intents" } }, "clientReferenceInformation": { "code": "1730302771619" }, "id": "7303027715656351504951", "orderInformation": { "amountDetails": { "totalAmount": "2.00", "currency": "USD" } }, "processorInformation": { "responseDetails": "00000", "paymentUrl": "https://pay.playground.klarna.com/na/hpp/payments/2BUwyUw", "responseCode": "00000", }, "reconciliationId": "XFZ3Y2N91JHR", "status": "COMPLETED", "submitTimeUtc": "2024-10-30T153932Z" }