Overview

Get Payment Authorization is the API call of Klarna's two-step checkout flow following Klarna JavaScript Initialization. The request is sent with the PaymentId and AuthenticationResult(redirectResult) appended in the return url to which the shopper gets returned(redirected) after the shopper finishes initial authentication process.

The same PaymentId must be used in the Get Payment Authorization request.

In Get Payment Authorization reply, ResponseCode is used to determine if the payment was successfully processed for that order. The order can be accepted when ResponseCode is APPROVED and must be rejected if the value is DECLINED.

URI Summary

Action

URI Template

URI Example

Non-URI Request

Response

POST

/v[M.m]/stores/{StoreID}/payments/authorization/get.[format]

/v1.0/stores/stores123/payments/authorization/get.xml

XML

200 + XML response

Request Elements

Element

Optional/Required

Description

Type

Restriction

/GetPaymentAuthorizationRequest/

OrderId

Required

Unique identifier for an order across all transactions of the same order.

Order Id should be the same as what is used in the order data passed in the initialization process.

String

Min 1 character

Max 20 characters

/GetPaymentAuthorizationRequest/

PaymentId

Required

Reference id element appended in the return url to which the shopper get returned(redirected) after the shopper finishes initial authentication process.

String

Min 1 chars

Max 64 chars

/GetPaymentAuthorizationRequest/

AuthenticationResult

Required

redirectResult appended in the return url to which the shopper get returned(redirected) after the shopper finishes initial authentication process

String

Length > 0

Request Example

Copy
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationRequest xmlns="http://api.gsicommerce.com/schema/checkout/1.0" requestId="1234567">
    <OrderId>Order-01</OrderId>
    <PaymentId>123456789123456789123456789Abcde</PaymentId>
    <AuthenticationResult>X3XtfGC7%21H4sIAAAAAAAAAGVSa2%2BjMBD8L3y6D4VSHgYinU4peTTXJqUQrlFVCRl7SWgScG0T
        KWr738%2FOQ5dTJSSknZ3Z2R1%2FGBxozYHIBO%2B30MgBltjofRiY0lrWbYM35woTjENl9Iw5SpPYny%2BexovFeBY6xpWx3m
        DeYHaUEJYAIRS3qKlqp2VZ3QQeMkMg1PTCG2RGflSZFFfYdQOXULCVBCbvnTLC%2B4S0XSMnmuoEkYM0qAx2nNfNMm4byTGRCp
        S8AwWJVcsY8BQq4NAQ0DQWIeNLSW61kvau2QrcKzDPBoq1wxvF7rm2betGVv8Bri0bPRReGSXHDY1bqsWOqxX4aEtRD3%2B%2B
        P8F5pkpb4GSFG3nyrsr9YfqYZwXE7bbIs37RB96yVki8gYv%2BS9PzaZZnn8dpJmuJKUFIU%2FlzPtGPaZFkhSK2vF7WKpNEs
        EtuPJ8mt9P0dvSUnhPh8N4pgf63GM%2BzJ42EJccatOSeHWTuhvH9Yz4vxsPZMJ3EF04vu3fnUxko1GfmIDve5HyjKispmei9X
        r9ekxWQddvJUz6HdSxM99BYpN1%2Bw%2F8VTg8xPaj%2BWrKa%2Fhwn%2Fmg0GEY%2BigdeELi3oQ5%2BXTenEFhXWjvHCu0bZ
        Huqy45810WRNVi%2BxH4pZqMM3b89lHcL%2F%2BVtspo9eG6Z3z8H1e9FHu2fAxGv%2Fl8kwRxvhb4WB9FtdKCiI0S9ajVXtmv
        Qy%2BOqDDzbj0yMHDC9AFdm6WAwI%2BoSpD5a2Ur16y9AtU0XYgMAAA%3D%3DKFmTC%2BBmZA0x8y1RAFc0uKzYygBKlZvyKxU
        Kf43C0i4%3D
    </AuthenticationResult>
</GetPaymentAuthorizationRequest>

Response Elements

Element

Optional/Required

Description

Type

Restriction

/GetPaymentAuthorizationReply/PaymentContext

Required

Unique identifier of the payment transaction for the order.

ComplexType

/GetPaymentAuthorizationReply/PaymentContext/OrderId

Required

Unique identifier of the order from the GetPaymentAuthorizationRequest

String

Min 1 char

Max 20 characters

/GetPaymentAuthorizationReply/

PaymentContext/TenderType

Required

Identifies the tender type.

String

Min 2 char

Max 4 characters

/GetPaymentAuthorizationReply/

PaymentContext/PaymentAccountUniqueId

Required

Either a raw PAN (payment account number such as a credit card number), a token

representing a PAN, or a placeholder value for non-PAN tenders.

String

Max 22 characters

/GetPaymentAuthorizationReply/

PaymentContext/PaymentAccountUniqueId@isToken

Required

Attribute that indicates whether the payment account number is tokenized

Boolean

true or false

/GetPaymentAuthorizationReply/

PaymentContextFinal

Optional

If the payment context in this reply is the final context.

If this value is true, then the payment context provided can be used for additional operations

in the workflow. If it is false then the context will be updated in the future and a new status

should be requested before any further operations in the worflow are attempted.

Boolean

true or false

/GetPaymentAuthorizationReply/

ResponseCode

Required

Status code describing the current state of the authorization.

Enum

Can be any of the below



APPROVED

DECLINED

ERROR

TIMEOUT

/GetPaymentAuthorizationReply/

AmountAuthorized

Required

The amount that has been authorized.

Decimal

Min 0.00

Max 9 digits

Fraction 2 digits

Response Example

Approved Payment Authorization Status Response

Copy
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
                              xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
    <PaymentContext>
        <OrderId>OrderId-01</OrderId>
        <TenderType>KL</TenderType>
        <PaymentAccountUniqueId isToken="true">INSTANTFINANCE</PaymentAccountUniqueId>
    </PaymentContext>
    <ResponseCode>APPROVED</ResponseCode>
    <AmountAuthorized currencyCode="USD">50.00</AmountAuthorized>
</GetPaymentAuthorizationReply>

Cancelled Payment Authorization Status Response

Copy
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
                              xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
    <PaymentContext>
        <OrderId>OrderId-01</OrderId>
        <TenderType>KL</TenderType>
        <PaymentAccountUniqueId isToken="true">INSTANTFINANCE</PaymentAccountUniqueId>
    </PaymentContext>
    <ResponseCode>CANCELLED</ResponseCode>
    <AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>

Declined Payment Authorization Status Response

Copy
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
                              xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
    <PaymentContext>
        <OrderId>OrderId-01</OrderId>
        <TenderType>KL</TenderType>
        <PaymentAccountUniqueId isToken="true">INSTANTFINANCE</PaymentAccountUniqueId>
    </PaymentContext>
    <ResponseCode>DECLINED</ResponseCode>
    <AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>

Error Payment Authorization Status Response

Copy
<?xml version="1.0" encoding="UTF-8"?>
     <GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
                                   xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
     <PaymentContext>
         <OrderId>OrderId-01</OrderId>
         <TenderType>KL</TenderType>
         <PaymentAccountUniqueId isToken="true">INSTANTFINANCE</PaymentAccountUniqueId>
     </PaymentContext>
     <ResponseCode>ERROR</ResponseCode>
     <AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>

Timeout Payment Authorization Status Response

Copy
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
                              xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
    <PaymentContext>
        <OrderId>OrderId-01</OrderId>
        <TenderType>KL</TenderType>
        <PaymentAccountUniqueId isToken="true">INSTANTFINANCE</PaymentAccountUniqueId>
    </PaymentContext>
    <ResponseCode>TIMEOUT</ResponseCode>
    <AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>