The developer.datatrans.com Developer Hub

Welcome to the developer.datatrans.com developer hub. You'll find comprehensive guides and documentation to help you start working with developer.datatrans.com as quickly as possible, as well as support if you get stuck. Let's jump right in!

paymentmethod=KLN

paymentmethod=KLN

Payment Process
Integration

Authorization

:heavy-check-mark+:

Payment Page

:heavy-check-mark+:

Deferred Settlement

:heavy-check-mark+:

Split Mode

:heavy-check-mark+:

Refund

:heavy-check-mark+:

Mobile SDK

:x+:

Cancel

:heavy-check-mark+:

Alias

:heavy-check-mark+:

Try it

Don't worry you wont be charged.

Pay CHF 10.00

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 :link+:

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

Web payment flow

 1 
[Not supported by viewer]
Customer
enters account information and
clicks Pay
[Not supported by viewer]
Merchant Website
Merchant Website
Merchant Server
Merchant Server
Payment Page loaded from Datatrans
Payment Page loaded from Datatrans
Klarna
Klarna<br>
 3 
[Not supported by viewer]
 Customer selects mode of payment ( e.g. Pay later, Slice it, Pay now )
[Not supported by viewer]
 2 
[Not supported by viewer]
 4 
[Not supported by viewer]
Validates and prepares forwarding to Acquirer
Validates and prepares forwarding to Acquirer
Authorization /  Alias registration / Forwarding
[Not supported by viewer]
 7 
[Not supported by viewer]
Receives Result 
Receives Result 
 8 
[Not supported by viewer]
Invokes merchant's
POST URL (Webhook)
Invokes merchant's<br>POST URL (Webhook)
Receives Result 
Receives Result 
 9 
[Not supported by viewer]
Redirects customer back to merchant
Redirects customer back to merchant
Customer gets redirected to merchant page
Customer gets redirected to merchant page
 5 
[Not supported by viewer]
 7.1 
[Not supported by viewer]
Consumer Payment at Klarna
[Not supported by viewer]
 6 
[Not supported by viewer]

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>

Updated 15 days ago

Klarna


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.