Capture a Payment

Definition: POST /v1/payments/{id}/capture

Where:
  • {id} – GlobalPay Payment ID

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 and Paysafecard payment methods.

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

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

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",
      "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
  }
}