Klarna Debit Risk Payment Request

Definition: POST https://paytest.smart2pay.com/v1/payments

Below you will find a full example of a payment request for Klarna Debit Risk method (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON object.

For Klarna Debit Risk payments only the following Amount, Currency, Country parameters are mandatory to be sent in the request, the rest of them are optional:

  • Amount – Order amount;
  • Currency – Purchase currency;
  • Country – Purchase country.

For a smoother user experience, we recommend always sending the Method ID 1183.

A 201 HTTP response (Created) is returned if the payment was correctly initialized.

For more information about status codes, please go to Basic HTTP Status Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAxOTk6OG16L0lsZkpaejIyVVhVUlFSeXRvdExQQ3pkWVJQekVmNHpyNDdBUWROWWxiUUxpTWc=

{
    "Payment": {
        "Amount": 100,
        "Currency": "GBP",
        "OriginatorTransactionID": "12345",
        "MethodID": "1183",
        "Description": "test",
        "ReturnURL": "http://demo2.smart2pay.com/redirect.php",
        "MerchantTransactionID": "KlarnaPayments-{{$timestamp}}",
        "Articles": [
            {
                "MerchantArticleID": "5009000",
                "Name": "TEST",
                "Quantity": 1,
                "Price": 100,
                "VAT": 10,
                "Discount": 0,
                "Type": 5,
                "TaxType": "0"
            }
        ],
        "BillingAddress": {
            "HouseExtension": "25",
            "HouseNumber": "22",
            "Street": "Great Russell",
            "StreetNumber": "1",
            "City": "London",
            "Region": "St. Jaoum es",
            "Phone": "00447516300001",
            "ZipCode": "WC1B 3DG",
            "Country": "GB"
        },
        "Customer": {
            "email": "test@test.com",
            "Phone": "00447516300001",
            "FirstName": "Doe",
            "LastName": "John"
        },
        "TokenLifetime": 10
    }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 27146999,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20240517091703",
        "MerchantTransactionID": "KlarnaPayments-1715937424",
        "OriginatorTransactionID": "12345",
        "Amount": "100",
        "Currency": "GBP",
        "CapturedAmount": null,
        "ReturnURL": "http://demo2.smart2pay.com/redirect.php",
        "ReturnURLSuccess": null,
        "ReturnURLFailure": null,
        "ReturnURLCancel": null,
        "ReturnURLProcessing": null,
        "Description": "test",
        "MethodID": 1183,
        "MethodOptionID": null,
        "MethodOptionIdString": null,
        "BankName": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30199,
        "NotificationDateTime": null,
        "Customer": {
            "MerchantCustomerID": null,
            "Email": "test@test.com",
            "FirstName": "Doe",
            "LastName": "John",
            "Gender": null,
            "SocialSecurityNumber": null,
            "Phone": "00447516300001",
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "City": "London",
            "ZipCode": "WC1B 3DG",
            "State": null,
            "Street": "Great Russell",
            "StreetNumber": "1",
            "HouseNumber": "22",
            "HouseExtension": "25",
            "Country": "GB"
        },
        "ShippingAddress": null,
        "Articles": [
            {
                "MerchantArticleID": "5009000",
                "Name": "TEST",
                "Quantity": 1,
                "Price": "100",
                "VAT": "10",
                "Discount": "0",
                "Type": "5",
                "TaxType": 0,
                "DiscountValue": "0"
            }
        ],
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "Fraud": null,
        "MethodTransactionID": null,
        "OriginalMerchantTID": null,
        "Unknown": false,
        "TokenLifetime": 10,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://gw-apm-globalpayapi.nuvei.com/Home?PaymentToken=3C1FBA02E352FA06F5EE3C7FE524D0F8.27146999",
        "Splits": null
    }
}

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section GlobalPay Return Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAxOTk6OG16L0lsZkpaejIyVVhVUlFSeXRvdExQQ3pkWVJQekVmNHpyNDdBUWROWWxiUUxpTWc=

{
    "Payment": {
        "Amount": 200,
        "Currency": "GBP",
        "OriginatorTransactionID": "12345",
        "MethodID": "1183",
        "Description": "test",
        "ReturnURL": "http://demo2.smart2pay.com/redirect.php",
        "MerchantTransactionID": "KlarnaPayments-{{$timestamp}}",
        "Articles": [
            {
                "MerchantArticleID": "5009000",
                "Name": "TEST",
                "Quantity": 1,
                "Price": 100,
                "VAT": 10,
                "Discount": 0,
                "Type": 5,
                "TaxType": "0"
            }
        ],
        "BillingAddress": {
            "HouseExtension": "25",
            "HouseNumber": "22",
            "Street": "Great Russell",
            "StreetNumber": "1",
            "City": "London",
            "Region": "St. Jaoum es",
            "Phone": "00447516300001",
            "ZipCode": "WC1B 3DG",
            "Country": "GB"
        },
        "Customer": {
            "email": "test@test.com",
            "Phone": "00447516300001",
            "FirstName": "Doe",
            "LastName": "John"
        },
        "TokenLifetime": 10
    }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 27147115,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20240517130108",
        "MerchantTransactionID": "KlarnaPayments-1715950869",
        "OriginatorTransactionID": null,
        "Amount": "200",
        "Currency": "GBP",
        "CapturedAmount": null,
        "ReturnURL": "http://demo2.smart2pay.com/redirect.php",
        "ReturnURLSuccess": null,
        "ReturnURLFailure": null,
        "ReturnURLCancel": null,
        "ReturnURLProcessing": null,
        "Description": "test",
        "MethodID": 1183,
        "MethodOptionID": null,
        "MethodOptionIdString": null,
        "BankName": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30199,
        "NotificationDateTime": "20240517130109",
        "Customer": {
            "MerchantCustomerID": null,
            "Email": "test@test.com",
            "FirstName": "Doe",
            "LastName": "John",
            "Gender": null,
            "SocialSecurityNumber": null,
            "Phone": "00447516300001",
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "City": "London",
            "ZipCode": "WC1B 3DG",
            "State": null,
            "Street": "Great Russell",
            "StreetNumber": "1",
            "HouseNumber": "22",
            "HouseExtension": "25",
            "Country": "GB"
        },
        "ShippingAddress": null,
        "Articles": [
            {
                "MerchantArticleID": "5009000",
                "Name": "TEST",
                "Quantity": 1,
                "Price": "100",
                "VAT": "10",
                "Discount": "0",
                "Type": "5",
                "TaxType": 0,
                "DiscountValue": "0"
            }
        ],
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 4,
            "Info": "Failed",
            "Reasons": [
                {
                    "Code": "118",
                    "Info": "Amount invalid"
                }
            ]
        },
        "Fraud": null,
        "MethodTransactionID": null,
        "OriginalMerchantTID": null,
        "Unknown": false,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null,
        "Splits": null
    }
}