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
requestID
response field.
Only update a session after the customer consents to sharing their data with Klarna.
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
paymentMethod_name
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
<paymentMehtod_name>
pay_later
</paymentMethod_name>

Language Specification

To set the language for your Klarna checkout experience, include the
billTo_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
<billTo> <language>es</language> </billTo>

Endpoints

Set the
apSessionsService_run
field to
true
, and send the request to one of these endpoints:
Production:
https://ics2ws.ic3.com/commerce/1.x/transactionProcessor
Test:
https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor

Response Status

The session service responds with one of these statuses as the
apSessionReply_status
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
apSessionReply_reasonCode
field value. For more information about reason codes, see the Reason Codes for the Simple Order API.

Response Statuses

The session service responds with one of these statuses as the
apSessionReply_status
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
apSessionReply_reasonCode
field value. For more information about reason codes, see the Reason Codes for the Simple Order API.

Required Fields for Updating a Session

Set to
KLI
.
apSessionsService_cancelURL
Set to the URL the customer is directed to after cancelling the Klarna payment.
Set to the URL the customer is directed to after the Klarna payment fails.
apSessionsService_requestID
Set to
true
.
Set to
U
.
Set to the URL the customer is directed to after successfully completing the Klarna payment.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.

Country-Specific Fields

Coupon Fields

To include a coupon in your request, include these fields.
Set to
coupon
.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.
Replace the
#
character with the number
0
for the first item and consecutive numbers for any additional items.

Optional Fields for Updating a Session

These are the optional fields you can include to update an existing session.
Set to the same value as the
billTo_state
field if the field is present.
billTo_language
If this field is not included, the language is set to English by default.
For a list of possible values, see the
ISO Standard Language Codes
guide.
Set to the same value as the
billTo_district
field.

XML Example: Updating a Session

Request
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"> <merchantID>test_merchant</merchantID> <merchantReferenceCode>refnum-1234</merchantReferenceCode> <billTo> <firstName>Anna</firstName> <lastName>Schmidt</lastName> <street1>Leopoldstrasse 4</street1> <street2>Apt 2</street2> <city>Lichtenberg</city> <district>Berlin</district> <state>Berlin</state> <postalCode>10318</postalCode> <country>DE</country> <phoneNumber>5551234567</phoneNumber> <email>
test@cybs.com
</email> <dateOfBirth>19820101</dateOfBirth> <language>DE-DE</language> </billTo> <shipTo> <firstName>Anna</firstName> <lastName>Schmidt</lastName> <street1>Leopoldstrasse 4</street1> <street2>Apt 2</street2> <city>Lichtenberg</city> <state>Berlin</state> <district>Berlin</district> <postalCode>10318</postalCode> <country>DE</country> <phoneNumber>5551234567</phoneNumber> <email>
test@cybs.com
</email> </shipTo> <item id="0"> <unitPrice>19.99</unitPrice> <quantity>1</quantity> <productName>Green Widget</productName> <taxAmount>1.00</taxAmount> <totalAmount>20.99</totalAmount> </item> <item id="1"> <unitPrice>10.00</unitPrice> <quantity>2</quantity> <productName>Blue Widget</productName> <taxAmount>2.00</taxAmount> <totalAmount>22.00</totalAmount> </item> <item id="2"> <unitPrice>5.00</unitPrice> <quantity>1</quantity> <productName>shipping</productName> <totalAmount>5.00</totalAmount> </item> <purchaseTotals> <currency>EUR</currency> <discountAmount>3.00</discountAmount> <grandTotalAmount>44.99</grandTotalAmount> </purchaseTotals> <apPaymentType>KLI</apPaymentType> <apSessionsService run="true"> <sessionsType>U</sessionsType> <sessionsRequestID>4848446567036715804007</sessionsRequestID> </apSessionsService> </requestMessage>
Response
<replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"> <merchantReferenceCode>refnum-1234</merchantReferenceCode> <requestID>4848446567036715804007</requestID> <decision>ACCEPT</decision> <reasonCode>100</reasonCode> <purchaseTotals> <currency>EUR</currency> </purchaseTotals> <apSessionsReply> <reasonCode>100</reasonCode> <responseCode>00000</responseCode> </apSessionsReply> </replyMessage>