Capture a Payment

Definition: Full Capture – POST /v1/payments/{id}/capture
Partial Capture – POST /v1/payments/{id}/capture?{amount}

Where:
  • {id} – GlobalPay Payment ID
  • {amount} – The amount to be captured smaller or equal than the initial authorized amount

A payment can only be captured if it has an Authorized status. The Authorized status can only be obtained for Cards, Klarna methods, Cards Russsia, Paysafecard, Paypal and PostFinance payment methods.

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.

For more detailed information regarding different Capture scenarios for a specific payment method, please click on the appropriate link: Cards, Klarna Payments, Cards Russia and PostFinance.

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/3897941/capture
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

Response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "Payment": {
    "ID": 3897941,
    "SkinID": 11,
    "ClientIP": null,
    "Created": "20180615085707",
    "MerchantTransactionID": "s2ptest_g241",
    "OriginatorTransactionID": null,
    "Amount": "899",
    "Currency": "GBP",
    "CapturedAmount": 899,
    "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",
      "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": 2,
      "Info": "Success",
      "Reasons": null
      },
    "MethodTransactionID": null,
    "TokenLifetime": 10,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
  }
}

Partial capture means you have the possibility to capture a smaller amount than the one from the initial authorized transaction.

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.

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": 2,
      "Info": "Success",
      "Reasons": null
      },
    "MethodTransactionID": null,
    "TokenLifetime": 10,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=8E9EBC84E9E19B696BC9A805564E85A7.3897941"
  }
}

For more information regarding Full and Partial Capture for Klarna Payments, please visit our Klarna Payments section.

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/3897941/capture
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

Response:

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

{
  "Payment": {
    "ID": 3897941,
    "SkinID": null,
    "ClientIP": null,
    "Created": "20180615085707",
    "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": 30201,
    "NotificationDateTime": "20180615085820",
    "Customer": null,
    "BillingAddress": null,
    "ShippingAddress": null,
    "Articles": null,
    "Details": null,
    "ReferenceDetails": null,
    "CustomParameters": null,
    "PreapprovalID": null,
    "Status": {
      "ID": 2,
      "Info": "Success",
      "Reasons": [
      {
        "Code": "17",
        "Info": "Payment is invalid - 3897941"
        }
      ]
    },
    "MethodTransactionID": null,
    "TokenLifetime": null,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": null
  }
}