Guides
These docs are for v1.0.1. Click to read the latest docs for v2.1.0.

Klarna

120

paymentmethod=KLN

Payment ProcessIntegration
Authorization✔️Payment Page✔️
Deferred Settlement✔️Split Mode✔️
Refund✔️Mobile SDK
Cancel✔️
Alias✔️

Description

Klarna is a payment solution that lets you choose your preferred way to conclude your payment during your purchase. You have the option to pay later without any interest or fees, or you can choose to pay with installments.

Klarna's website 🔗

📘

Request and response parameters

For a more detailed description of the request and response parameters for Klarna you may check our API Reference.

Customer Details

Klarna's payment page will prompt the user to fill in all the necessary details. The customer experience will be enhanced if you include the uppCustomerDetails parameters within your requests. If you decide to include uppCustomerDetails, please mind the following:

  • For digital products, only uppCustomerEmail is required.

  • For physical products, all customer details are required except uppCustomerBirthDate and uppCustomerPhone.

Extra merchant data

In some cases, Klarna may require additional parameters, so-called 'extra merchant data' (EMD), covering additional information about the items to be purchased. This extra information is required for Klarna's risk analyses. The required EMD information can be found in the appendix of your contract agreement with Klarna. The following EMD categories are currently supported:

  • klarnaCustomerAccountInfos*
  • klarnaEvents*
  • klarnaPaymentHistoryFull*
  • klarnaPaymentHistorySimple*
  • klarnaSubscriptions*

More EMD categories are available on request.

Alias

Additional parameters are required in your requests to successfully debit a previously created Klarna alias. The following parameters need to be included in your requests:

📘

Klarna payment methods supporting Alias

The following Klarna payment methods supports Alias:

  • Pay now direct debit
  • Pay later invoice

Server to Server Requests

After a successful authorization, you have the option to send the server to server calls below with an existing Klarna alias.

Authorization with alias

Request

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_authorize.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<authorizationService version="6">
    <body merchantId="1000011011">
        <transaction refno="1503046708506">
            <request>
                <amount>1000</amount>
                <currency>CHF</currency>
                <reqtype>NOA</reqtype>
                <pmethod>KLN</pmethod>
                <sign>30916165706580013</sign>
                <aliasCC>2cfcf661-6eeb-4e71-b966-e554f6d38de0</aliasCC>
                <uppCustomerDetails>
  			<uppCustomerTitle>Mr.</uppCustomerTitle>
  			<uppCustomerGender>male</uppCustomerGender>
  			<uppCustomerBirthDate>1950-01-01</uppCustomerBirthDate>
  			<uppCustomerCompanyRegisterNumber></uppCustomerCompanyRegisterNumber>
  			<uppCustomerFirstName>Mark</uppCustomerFirstName>
  			<uppCustomerLastName>Sample</uppCustomerLastName>
  			<uppCustomerStreet>Kreuzbuehlstrasse</uppCustomerStreet>
  			<uppCustomerStreet2>26</uppCustomerStreet2>
  			<uppCustomerPhoneNumber>0041442568191</uppCustomerPhoneNumber>
  			<uppCustomerEmail>[email protected]</uppCustomerEmail>
  			<uppCustomerCountry>CH</uppCustomerCountry>
  			<uppCustomerCity>Zurich</uppCustomerCity>
  			<uppCustomerZipCode>8008</uppCustomerZipCode>
  			<uppShippingDetails>yes</uppShippingDetails>
  			<uppShippingTitle>Herr</uppShippingTitle>
  			<uppShippingFirstName>Mark</uppShippingFirstName>
  			<uppShippingLastName>Sample</uppShippingLastName>
  			<uppShippingStreet>Kreuzbuehlstrasse</uppShippingStreet>
  			<uppShippingStreet2>26</uppShippingStreet2>
  			<uppShippingPhoneNumber>0041442568191</uppShippingPhoneNumber>
  			<uppShippingEmail>[email protected]</uppShippingEmail>
  			<uppShippingCountry>CH</uppShippingCountry>
  			<uppShippingCity>Zurich</uppShippingCity>
  			<uppShippingZipCode>8008</uppShippingZipCode>
  			<uppArticle_1_Id>1132884</uppArticle_1_Id>
  			<uppArticle_1_Name>Article 1</uppArticle_1_Name>
  			<uppArticle_1_Type>digital</uppArticle_1_Type>
  			<uppArticle_1_Quantity>1</uppArticle_1_Quantity>
  			<uppArticle_1_Price>500</uppArticle_1_Price>
  			<uppArticle_1_Tax>770</uppArticle_1_Tax>
  			<uppArticle_1_PriceWithoutVAT>463</uppArticle_1_PriceWithoutVAT>
  			<uppArticle_1_TaxAmount>37</uppArticle_1_TaxAmount>
  			<uppArticle_2_Id>1132885</uppArticle_2_Id>
  			<uppArticle_2_Name>Article 2</uppArticle_2_Name>
  			<uppArticle_2_Type>digital</uppArticle_2_Type>
  			<uppArticle_2_Quantity>1</uppArticle_2_Quantity>
  			<uppArticle_2_Price>400</uppArticle_2_Price>
  			<uppArticle_2_Tax>770</uppArticle_2_Tax>
  			<uppArticle_2_PriceWithoutVat>370</uppArticle_2_PriceWithoutVat>
  			<uppArticle_2_TaxAmount>30</uppArticle_2_TaxAmount>
  			<uppArticle_3_Id>1239552</uppArticle_3_Id>
  			<uppArticle_3_Name>Delivery</uppArticle_3_Name>
  			<uppArticle_3_Type>digital</uppArticle_3_Type>
  			<uppArticle_3_Quantity>1</uppArticle_3_Quantity>
  			<uppArticle_3_Price>100</uppArticle_3_Price>
  			<uppArticle_3_Tax>770</uppArticle_3_Tax>
  			<uppArticle_3_PriceWithoutVat>93</uppArticle_3_PriceWithoutVat>
  			<uppArticle_3_TaxAmount>7</uppArticle_3_TaxAmount>
		</uppCustomerDetails>
            </request>
        </transaction>
    </body>
</authorizationService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<authorizationService version='6'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <reqtype>NOA</reqtype>
        <pmethod>KLN</pmethod>
        <sign>30916165706580013</sign>
        <aliasCC>2cfcf661-6eeb-4e71-b966-e554f6d38de0</aliasCC>
        <uppCustomerDetails>
          <uppCustomerTitle>Mr.</uppCustomerTitle>
          <uppCustomerGender>male</uppCustomerGender>
          <uppCustomerBirthDate>1950-01-01</uppCustomerBirthDate>
          <uppCustomerCompanyRegisterNumber></uppCustomerCompanyRegisterNumber>
          <uppCustomerFirstName>Mark</uppCustomerFirstName>
          <uppCustomerLastName>Sample</uppCustomerLastName>
          <uppCustomerStreet>Kreuzbuehlstrasse</uppCustomerStreet>
          <uppCustomerStreet2>26</uppCustomerStreet2>
          <uppCustomerPhoneNumber>0041442568191</uppCustomerPhoneNumber>
          <uppCustomerEmail>[email protected]</uppCustomerEmail>
          <uppCustomerCountry>CH</uppCustomerCountry>
          <uppCustomerCity>Zurich</uppCustomerCity>
          <uppCustomerZipCode>8008</uppCustomerZipCode>
          <uppShippingDetails>yes</uppShippingDetails>
          <uppShippingTitle>Herr</uppShippingTitle>
          <uppShippingFirstName>Mark</uppShippingFirstName>
          <uppShippingLastName>Sample</uppShippingLastName>
          <uppShippingStreet>Kreuzbuelstrasse</uppShippingStreet>
          <uppShippingStreet2>26</uppShippingStreet2>
          <uppShippingPhoneNumber>0041442568191</uppShippingPhoneNumber>
          <uppShippingEmail>[email protected]</uppShippingEmail>
          <uppShippingCountry>CH</uppShippingCountry>
          <uppShippingCity>Zurich</uppShippingCity>
          <uppShippingZipCode>8008</uppShippingZipCode>
          <uppArticle_1_Id>1132884</uppArticle_1_Id>
          <uppArticle_1_Name>Article 1</uppArticle_1_Name>
          <uppArticle_1_Type>digital</uppArticle_1_Type>
          <uppArticle_1_Quantity>1</uppArticle_1_Quantity>
          <uppArticle_1_Price>500</uppArticle_1_Price>
          <uppArticle_1_Tax>770</uppArticle_1_Tax>
          <uppArticle_1_PriceWithoutVAT>463</uppArticle_1_PriceWithoutVAT>
          <uppArticle_1_TaxAmount>37</uppArticle_1_TaxAmount>
          <uppArticle_2_Name>Article 2</uppArticle_2_Name>
          <uppArticle_2_Type>digital</uppArticle_2_Type>
          <uppArticle_2_Quantity>1</uppArticle_2_Quantity>
          <uppArticle_2_Price>400</uppArticle_2_Price>
          <uppArticle_2_Tax>770</uppArticle_2_Tax>
          <uppArticle_2_PriceWithoutVat>370</uppArticle_2_PriceWithoutVat>
          <uppArticle_2_TaxAmount>30</uppArticle_2_TaxAmount>
          <uppArticle_3_Id>1239552</uppArticle_3_Id>
          <uppArticle_3_Name>Delivery</uppArticle_3_Name>
          <uppArticle_3_Type>digital</uppArticle_3_Type>
          <uppArticle_3_Quantity>1</uppArticle_3_Quantity>
          <uppArticle_3_Price>100</uppArticle_3_Price>
          <uppArticle_3_Tax>770</uppArticle_3_Tax>
          <uppArticle_3_PriceWithoutVat>93</uppArticle_3_PriceWithoutVat>
          <uppArticle_3_TaxAmount>7</uppArticle_3_TaxAmount>
        </uppCustomerDetails>
      </request>
      <response>
        <responseCode>01</responseCode>
        <responseMessage>Klarna trx successful.</responseMessage>
        <uppTransactionId>190627080632781195</uppTransactionId>
        <authorizationCode>632791196</authorizationCode>
        <acqAuthorizationCode>0</acqAuthorizationCode>
      </response>
    </transaction>
  </body>
</authorizationService>

Settlement

Request

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_processor.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="2">
  <body merchantId="1000011011">
    <transaction refno="1503046708506">
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627080632781195</uppTransactionId>
      </request>
    </transaction>
  </body>
</paymentService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='2'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627080632781195</uppTransactionId>
        <reqtype>COA</reqtype>
        <transtype>05</transtype>
      </request>
      <response>
        <responseCode>01</responseCode>
        <responseMessage>settlement succeeded</responseMessage>
      </response>
    </transaction>
  </body>
</paymentService>

Credit

Request

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_processor.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="2">
  <body merchantId="1000011011">
    <transaction refno="1503046708506">
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627080632781195</uppTransactionId>
        <transtype>06</transtype>
      </request>
    </transaction>
  </body>
</paymentService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='2'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627080632781195</uppTransactionId>
        <transtype>06</transtype>
        <reqtype>COA</reqtype>
      </request>
      <response>
        <responseCode>01</responseCode>
        <responseMessage>credit succeeded</responseMessage>
        <uppTransactionId>190627081044631748</uppTransactionId>
        <authorizationCode>944851749</authorizationCode>
        <acqAuthorizationCode>0</acqAuthorizationCode>
      </response>
    </transaction>
  </body>
</paymentService>%

Cancel

Request

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_processor.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="2">
  <body merchantId="1000011011">
    <transaction refno="1503046708506">
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627081229982000</uppTransactionId>
        <reqtype>DOA</reqtype>
      </request>
    </transaction>
  </body>
</paymentService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='2'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627081229982000</uppTransactionId>
        <reqtype>DOA</reqtype>
        <transtype>05</transtype>
      </request>
      <response>
        <responseCode>01</responseCode>
        <responseMessage>cancellation succeeded</responseMessage>
      </response>
    </transaction>
  </body>
</paymentService>

Status

Request

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_status.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<statusService version="5">
  <body merchantId="1000011011">
    <transaction>
      <request>
        <uppTransactionId>190627081229982000</uppTransactionId>
        <reqtype>STX</reqtype>
      </request>
    </transaction>
  </body>
</statusService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<statusService version='5'>
  <body merchantId='1000011011' status='accepted'>
    <transaction trxStatus='response'>
      <request>
        <uppTransactionId>190627081229982000</uppTransactionId>
        <reqtype>STX</reqtype>
      </request>
      <response itemNr='1'>
        <responseCode>7</responseCode>
        <responseMessage>MOA Cancel</responseMessage>
        <refno>1503046708506</refno>
        <amount>119</amount>
        <currency>CHF</currency>
        <authorizationCode>229992001</authorizationCode>
        <pmethod>KLN</pmethod>
        <uppTransactionId>190627081229982000</uppTransactionId>
        <maskedCC></maskedCC>
        <aliasCC>1539dcf7-e910-482a-b310-e60ef314192e</aliasCC>
        <expm></expm>
        <expy></expy>
        <trxDate>20190627</trxDate>
        <trxTime>081229</trxTime>
        <trtype>05</trtype>
      </response>
    </transaction>
  </body>
</statusService>