Capture Scenarios for Klarna Payments

Scenario Status / Return Code Description
The transaction has been fully captured.

Only payments with “Authorized” status can be captured.
Status: 2 Success
The payment has been partially captured.

Only payments with “Authorized” status can be captured.
Status: 35 Partially Captured
Retry Capture.

This happens when the request timeouts at Provider; a new capture request has to be initiated.
Return Code: 157 Unable to capture transaction
The transaction could not be captured.

The transaction is not in an Authorized status.
Return Code: 17 Payment is invalid

For a complete list of all the possible Return Code IDs go to our section GlobalPay Return Codes.

See the request – response examples for the above possible scenarios:

  • Success Status

    A payment can only be captured if it has an Authorized status. Once the payment has an Authorized status, you can capture either the full amount or a partial amount of the initial authorized amount for the transaction.

    A 200 HTTP response (OK) is returned if the request was completed successfully.

    Full capture means you capture the entire authorized amount for the initial transaction.

    Request:

    POST: https://paytest.smart2pay.com/v1/payments/3434057/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8
    
    {
        "Payment": {
            "ID": 3434057,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20171123140528",
            "MerchantTransactionID": "captureklarna",
            "OriginatorTransactionID": null,
            "Amount": "980",
            "Currency": "EUR",
            "CapturedAmount": "980",
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 1078,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30151,
            "NotificationDateTime": "20171123140924",
            "Customer": {
                "ID": 1524,
                "MerchantCustomerID": null,
                "Email": "youremail@email.com",
                "FirstName": "Testperson-se",
                "LastName": "Approved",
                "Gender": null,
                "SocialSecurityNumber": "410321-9202",
                "Phone": "0765260000",
                "Company": null,
                "DateOfBirth": "19700710"
            },
            "BillingAddress": {
                "ID": 1450,
                "City": "Ankeborg",
                "ZipCode": "12345",
                "State": null,
                "Street": "Stårgatan 1",
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "SE"
            },
            "ShippingAddress": {
                "ID": 1450,
                "City": "Ankeborg",
                "ZipCode": "12345",
                "State": null,
                "Street": "Stårgatan 1",
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "SE"
            },
            "Articles": [
                {
                    "MerchantArticleID": "1231",
                    "Name": "TEST",
                    "Quantity": 1,
                    "Price": "1000",
                    "VAT": "1000",
                    "Discount": "2",
                    "Type": "5",
                    "DiscountValue": "0"
                }
            ],
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 2,
                "Info": "Success",
                "Reasons": null
            },
            "MethodTransactionID": null,
            "TokenLifetime": 10,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=79F34F96810C627F6CCE8FA64D66F384.3434057"
        }
    }
  • Partially Captured Status

    Partial capture means you have the possibility to capture a smaller amount than the one from the initial authorized transaction. Partial capture is used when you have sent at least part of the order to the consumer and want to capture the amount for the item(s) that have been shipped.

    You can perform only one partial capture for an authorized transaction with the limitation that the amount of the partial capture to be smaller or equal than the initial authorized amount.

    There are 3 possibilities to partially capture a payment:

    1. Specify only the captured amount parameter in the query string, in order to partially capture the payment, like in the below example:

      Request:

      POST https://paytest.smart2pay.com/v1/payments/202239/capture?amount=1000
      Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

      Response:

      HTTP/1.1 200 OK
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 202239,
          "SkinID": 11,
          "ClientIP": null,
          "Created": "20180615085707",
          "MerchantTransactionID": "s2ptest_g241_a",
          "OriginatorTransactionID": null,
          "Amount": "2000",
          "Currency": "GBP",
          "CapturedAmount": "1000",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "MethodID": 1078,
          "MethodOptionID": null,
          "IncludeMethodIDs": null,
          "ExcludeMethodIDs": null,
          "PrioritizeMethodIDs": null,
          "SiteID": 30201,
          "NotificationDateTime": "20180615085820",
          "Customer": {
            "ID": 340,
            "MerchantCustomerID": "0125",
            "Email": "youremail@email.com",
            "FirstName": "Doe",
            "LastName": "Test",
            "Gender": "0",
            "SocialSecurityNumber": "0801363945",
            "SocialSecurityNumber2": null,
            "Phone": "+440745785615",
            "Company": "S2P",
            "DateOfBirth": null
            },
          "BillingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "ShippingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Name": "Physical",
            "Quantity": 1,
            "Price": "1000",
            "VAT": "1200",
            "Discount": "0.09",
            "Type": "5",
            "DiscountValue": "100"
            }
          ],
          "Details": null,
          "ReferenceDetails": null,
          "CustomParameters": null,
          "PreapprovalID": null,
          "Status": {
            "ID": 35,
            "Info": "PartiallyCaptured",
            "Reasons": null
            },
          "MethodTransactionID": null,
          "TokenLifetime": 10,
          "Capture": null,
          "PreapprovalDetails": null,
          "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
        }
      }
    2. Specify the captured amount parameter in the query string and send the minimal details for the Articles object, like in the below example:

      Request:

      POST  https://paytest.smart2pay.com/v1/payments/34340570/capture?amount=1000
      Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
      
      {
        "Payment": {
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Quantity": 1
            }
          ]
        }
      }

      Response:

      HTTP/1.1 200 OK
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 34340570,
          "SkinID": 11,
          "ClientIP": null,
          "Created": "20180615085707",
          "MerchantTransactionID": "s2ptest_g241_b",
          "OriginatorTransactionID": null,
          "Amount": "2000",
          "Currency": "GBP",
          "CapturedAmount": "1000",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "MethodID": 1078,
          "MethodOptionID": null,
          "IncludeMethodIDs": null,
          "ExcludeMethodIDs": null,
          "PrioritizeMethodIDs": null,
          "SiteID": 30201,
          "NotificationDateTime": "20180615085820",
          "Customer": {
            "ID": 340,
            "MerchantCustomerID": "0125",
            "Email": "youremail@email.com",
            "FirstName": "Doe",
            "LastName": "Test",
            "Gender": "0",
            "SocialSecurityNumber": "0801363945",
            "SocialSecurityNumber2": null,
            "Phone": "+440745785615",
            "Company": "S2P",
            "DateOfBirth": null
            },
          "BillingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "ShippingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Name": "Physical",
            "Quantity": 1,
            "Price": "1000",
            "VAT": "1200",
            "Discount": "0.09",
            "Type": "5",
            "DiscountValue": "100"
            }
          ],
          "Details": null,
          "ReferenceDetails": null,
          "CustomParameters": null,
          "PreapprovalID": null,
          "Status": {
            "ID": 35,
            "Info": "PartiallyCaptured",
            "Reasons": null
            },
          "MethodTransactionID": null,
          "TokenLifetime": 10,
          "Capture": null,
          "PreapprovalDetails": null,
          "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
        }
      }
    3. Specify the captured amount parameter in the query string and send the appropriate details for the Articles object together with the Shipping and Customer information, like in the below example:

      Request:

      POST  https://paytest.smart2pay.com/v1/payments/3434007/capture?amount=1000
      Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
      
      {
        "Payment": {
          "Description": "Shipped part of the order ",
          "MethodID": 1078,
          "Articles": [
            {
              "MerchantArticleID": "1231",
              "Name": "TEST",
              "Quantity": 1,
              "Price": 1000,
              "VAT": 1000,
              "Discount": 200,
              "Type": 5
            }
          ],
      "ShippingAddress": {
            "HouseExtension": "25",
            "HouseNumber": "22",
            "StreetNumber": "1",
            "State": "Iasi",
            "Street": "Stargatan",
            "ZipCode": "12345",
            "City": "Ankeborg",
            "Country": "SE"
          },
          "Customer": {
            "MerchantCustomerID": "0125",
            "FirstName": "Example",
            "LastName": "Test",
            "Gender": "1",
            "Email": "youremail@email.com",
            "Phone": "0765260000",
            "Company": "S2P"
          }
        }
      }

      Response:

      HTTP/1.1 200 OK
      Content-Type: application/json; charset=utf-8
      
      {
        "Payment": {
          "ID": 3434007,
          "SkinID": 11,
          "ClientIP": null,
          "Created": "20180615085707",
          "MerchantTransactionID": "s2ptest_g241_c",
          "OriginatorTransactionID": null,
          "Amount": "2000",
          "Currency": "GBP",
          "CapturedAmount": "1000",
          "ReturnURL": "http://demo.smart2pay.com/redirect.php",
          "Description": null,
          "MethodID": 1078,
          "MethodOptionID": null,
          "IncludeMethodIDs": null,
          "ExcludeMethodIDs": null,
          "PrioritizeMethodIDs": null,
          "SiteID": 30201,
          "NotificationDateTime": "20180615085820",
          "Customer": {
            "ID": 340,
            "MerchantCustomerID": "0125",
            "Email": "youremail@email.com",
            "FirstName": "Doe",
            "LastName": "Test",
            "Gender": "0",
            "SocialSecurityNumber": "0801363945",
            "SocialSecurityNumber2": null,
            "Phone": "+440745785615",
            "Company": "S2P",
            "DateOfBirth": null
            },
          "BillingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "ShippingAddress": {
            "ID": 3959,
            "City": "London",
            "ZipCode": "W13 3BG",
            "State": "London",
            "Street": "New Burlington St 113",
            "StreetNumber": "Apt 214",
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "GB"
            },
          "Articles": [
            {
            "MerchantArticleID": "1235",
            "Name": "Physical",
            "Quantity": 1,
            "Price": "1000",
            "VAT": "1200",
            "Discount": "0.09",
            "Type": "5",
            "DiscountValue": "100"
            }
          ],
          "Details": null,
          "ReferenceDetails": null,
          "CustomParameters": null,
          "PreapprovalID": null,
          "Status": {
            "ID": 35,
            "Info": "PartiallyCaptured",
            "Reasons": null
            },
          "MethodTransactionID": null,
          "TokenLifetime": 10,
          "Capture": null,
          "PreapprovalDetails": null,
          "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
        }
      }
  • Return Code: 157 – Unable to capture transaction

    The transaction could not be captured. Retry Capture. This happens when the request timeouts at Provider.

    Request:

    POST https://paytest.smart2pay.com/v1/payments/3434068/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 400 Bad Request
    Content-Type: application/json; charset=utf-8
    
    {
        "Payment": {
            "ID": 3434068,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20171123141730",
            "MerchantTransactionID": "testpaymentauthorized",
            "OriginatorTransactionID": null,
            "Amount": "900",
            "Currency": "DKK",
            "CapturedAmount": null,
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": "test smart2pay",
            "MethodID": 1078,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30151,
            "NotificationDateTime": "20171123141847",
            "Customer": null,
            "BillingAddress": null,
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 9,
                "Info": "Authorized",
                "Reasons": [
                    {
                        "Code": 157,
                        "Info": "Unable to capture transaction"
                    }
                ]
            },
            "MethodTransactionID": null,
            "TokenLifetime": null,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": null
        }
    }
  • Return Code: 17 – Payment is invalid

    The transaction could not be captured. The transaction is not in an Authorized status. You can receive this response when the payment you want to Capture is not Authorized or when the payment has already been Captured.

    Request:

    POST https://paytest.smart2pay.com/v1/payments/3434032/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 400 Bad Request
    Content-Type: application/json; charset=utf-8{
        "Payment": {
            "ID": 3434032,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20171123134852",
            "MerchantTransactionID": null,
            "OriginatorTransactionID": null,
            "Amount": null,
            "Currency": null,
            "CapturedAmount": null,
            "ReturnURL": null,
            "Description": null,
            "MethodID": 1078,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30151,
            "NotificationDateTime": "20171112000000",
            "Customer": null,
            "BillingAddress": null,
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 1,
                "Info": "Open",
                "Reasons": [
                    {
                        "Code": 17,
                        "Info": "Payment is invalid - 3434032"
                    }
                ]
            },
            "MethodTransactionID": null,
            "TokenLifetime": null,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": null
        }
    }