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

:warning+:

Try it

Don't worry you wont be charged

Pay CHF 20.19

Description

The consumer can easily pay registering the contact information and creating an order. For the merchant this payment method means a guaranteed payment with a high acceptance rate.
Payment Method provider website :link+:

Request and response parameter reference

For a more detailed description of the request and response parameters for Klarna
please check the API Reference

Alias registration

For the moment Klarna only accepts registration during a payment. Support for registration only is not yet supported by Klarna

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 API calls

After a transactionId or alias was received by completing the payment flow on the web, the following server to server API calls can be used to do other actions.

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="1">
    <body merchantId="1000011011">
        <transaction refno="1503046708506">
            <request>
                <amount>2019</amount>
                <currency>CHF</currency>
                <reqtype>NOA</reqtype>
                <pmethod>KLN</pmethod>
                <sign>30916165706580013</sign>
                <aliasCC>2cfcf661-6eeb-4e71-b966-e554f6d38de0</aliasCC>
                <uppCustomerDetails>
  			<uppCustomerTitle>Herr</uppCustomerTitle>
  			<uppCustomerGender>male</uppCustomerGender>
  			<uppCustomerBirthDate>1950-01-01</uppCustomerBirthDate>
  			<uppCustomerCompanyRegisterNumber></uppCustomerCompanyRegisterNumber>
  			<uppCustomerFirstName>Mark</uppCustomerFirstName>
  			<uppCustomerLastName>Uber</uppCustomerLastName>
  			<uppCustomerStreet>Kreuzbühlstrasse</uppCustomerStreet>
  			<uppCustomerStreet2>26</uppCustomerStreet2>
  			<uppCustomerPhoneNumber>0796368005</uppCustomerPhoneNumber>
  			<uppCustomerEmail>youremail@email.com</uppCustomerEmail>
  			<uppCustomerCountry>CH</uppCustomerCountry>
  			<uppCustomerCity>Zurich</uppCustomerCity>
  			<uppCustomerZipCode>8008</uppCustomerZipCode>
  			<uppShippingDetails>yes</uppShippingDetails>
  			<uppShippingTitle>Herr</uppShippingTitle>
  			<uppShippingFirstName>Mark</uppShippingFirstName>
  			<uppShippingLastName>Uber</uppShippingLastName>
  			<uppShippingStreet>Kreuzbühlstrasse</uppShippingStreet>
  			<uppShippingStreet2>26</uppShippingStreet2>
  			<uppShippingPhoneNumber>0796368005</uppShippingPhoneNumber>
  			<uppShippingEmail>youremail@email.com</uppShippingEmail>
  			<uppShippingCountry>CH</uppShippingCountry>
  			<uppShippingCity>Zurich</uppShippingCity>
  			<uppShippingZipCode>8008</uppShippingZipCode>
  			<uppArticle_1_Id>1132884</uppArticle_1_Id>
  			<uppArticle_1_Name>TAS4013CH WEISS TASSIMO</uppArticle_1_Name>
  			<uppArticle_1_Type>physical</uppArticle_1_Type>
  			<uppArticle_1_Quantity>1</uppArticle_1_Quantity>
  			<uppArticle_1_Price>119</uppArticle_1_Price>
  			<uppArticle_1_Tax>1900</uppArticle_1_Tax>
  			<uppArticle_1_PriceWithoutVAT>100</uppArticle_1_PriceWithoutVAT>
  			<uppArticle_1_TaxAmount>19</uppArticle_1_TaxAmount>
  			<uppArticle_2_Id>1132885</uppArticle_2_Id>
  			<uppArticle_2_Name>TAS4013CH ROT TASSIMO</uppArticle_2_Name>
  			<uppArticle_2_Type>physical</uppArticle_2_Type>
  			<uppArticle_2_Quantity>1</uppArticle_2_Quantity>
  			<uppArticle_2_Price>900</uppArticle_2_Price>
  			<uppArticle_2_Tax>800</uppArticle_2_Tax>
  			<uppArticle_2_PriceWithoutVat>833</uppArticle_2_PriceWithoutVat>
  			<uppArticle_2_TaxAmount>67</uppArticle_2_TaxAmount>
  			<uppArticle_3_Id>1239552</uppArticle_3_Id>
  			<uppArticle_3_Name>Paketlieferung an die Haustore.</uppArticle_3_Name>
  			<uppArticle_3_Type>physical</uppArticle_3_Type>
  			<uppArticle_3_Quantity>1</uppArticle_3_Quantity>
  			<uppArticle_3_Price>1000</uppArticle_3_Price>
  			<uppArticle_3_Tax>800</uppArticle_3_Tax>
  			<uppArticle_3_PriceWithoutVat>926</uppArticle_3_PriceWithoutVat>
  			<uppArticle_3_TaxAmount>74</uppArticle_3_TaxAmount>
		</uppCustomerDetails>
            </request>
        </transaction>
    </body>
</authorizationService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<authorizationService version='1'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>2019</amount>
        <currency>CHF</currency>
        <reqtype>NOA</reqtype>
        <pmethod>KLN</pmethod>
        <sign>30916165706580013</sign>
        <aliasCC>2cfcf661-6eeb-4e71-b966-e554f6d38de0</aliasCC>
        <uppCustomerDetails>
          <uppCustomerTitle>Herr</uppCustomerTitle>
          <uppCustomerGender>male</uppCustomerGender>
          <uppCustomerBirthDate>1950-01-01</uppCustomerBirthDate>
          <uppCustomerCompanyRegisterNumber></uppCustomerCompanyRegisterNumber>
          <uppCustomerFirstName>Mark</uppCustomerFirstName>
          <uppCustomerLastName>Uber</uppCustomerLastName>
          <uppCustomerStreet>Kreuzbühlstrasse</uppCustomerStreet>
          <uppCustomerStreet2>26</uppCustomerStreet2>
          <uppCustomerPhoneNumber>0796368005</uppCustomerPhoneNumber>
          <uppCustomerEmail>youremail@email.com</uppCustomerEmail>
          <uppCustomerCountry>CH</uppCustomerCountry>
          <uppCustomerCity>Zurich</uppCustomerCity>
          <uppCustomerZipCode>8008</uppCustomerZipCode>
          <uppShippingDetails>yes</uppShippingDetails>
          <uppShippingTitle>Herr</uppShippingTitle>
          <uppShippingFirstName>Mark</uppShippingFirstName>
          <uppShippingLastName>Uber</uppShippingLastName>
          <uppShippingStreet>Kreuzbühlstrasse</uppShippingStreet>
          <uppShippingStreet2>26</uppShippingStreet2>
          <uppShippingPhoneNumber>0796368005</uppShippingPhoneNumber>
          <uppShippingEmail>youremail@email.com</uppShippingEmail>
          <uppShippingCountry>CH</uppShippingCountry>
          <uppShippingCity>Zurich</uppShippingCity>
          <uppShippingZipCode>8008</uppShippingZipCode>
          <uppArticle_1_Id>1132884</uppArticle_1_Id>
          <uppArticle_1_Name>TAS4013CH WEISS TASSIMO</uppArticle_1_Name>
          <uppArticle_1_Type>physical</uppArticle_1_Type>
          <uppArticle_1_Quantity>1</uppArticle_1_Quantity>
          <uppArticle_1_Price>119</uppArticle_1_Price>
          <uppArticle_1_Tax>1900</uppArticle_1_Tax>
          <uppArticle_1_PriceWithoutVAT>100</uppArticle_1_PriceWithoutVAT>
          <uppArticle_1_TaxAmount>19</uppArticle_1_TaxAmount>
          <uppArticle_2_Name>TAS4013CH ROT TASSIMO</uppArticle_2_Name>
          <uppArticle_2_Type>physical</uppArticle_2_Type>
          <uppArticle_2_Quantity>1</uppArticle_2_Quantity>
          <uppArticle_2_Price>900</uppArticle_2_Price>
          <uppArticle_2_Tax>800</uppArticle_2_Tax>
          <uppArticle_2_PriceWithoutVat>833</uppArticle_2_PriceWithoutVat>
          <uppArticle_2_TaxAmount>67</uppArticle_2_TaxAmount>
          <uppArticle_3_Id>1239552</uppArticle_3_Id>
          <uppArticle_3_Name>Paketlieferung an die Haustore.</uppArticle_3_Name>
          <uppArticle_3_Type>physical</uppArticle_3_Type>
          <uppArticle_3_Quantity>1</uppArticle_3_Quantity>
          <uppArticle_3_Price>1000</uppArticle_3_Price>
          <uppArticle_3_Tax>800</uppArticle_3_Tax>
          <uppArticle_3_PriceWithoutVat>926</uppArticle_3_PriceWithoutVat>
          <uppArticle_3_TaxAmount>74</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="1">
  <body merchantId="1000011011">
    <transaction refno="1503046708506">
      <request>
        <amount>119</amount>
        <currency>CHF</currency>
        <uppTransactionId>190627080632781195</uppTransactionId>
      </request>
    </transaction>
  </body>
</paymentService>
EOF

Response

<?xml version='1.0' encoding='UTF-8'?>
<paymentService version='1'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>119</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="1">
  <body merchantId="1000011011">
    <transaction refno="1503046708506">
      <request>
        <amount>119</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='1'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>119</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="1">
  <body merchantId="1000011011">
    <transaction refno="1503046708506">
      <request>
        <amount>119</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='1'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='1503046708506' trxStatus='response'>
      <request>
        <amount>119</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="3">
  <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='3'>
  <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>

Klarna


Suggested Edits are limited on API Reference Pages

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