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, Paysafecard and UnionPay International Cards.

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

Request:

POST https://paytest.smart2pay.com/v1/payments/3005348/capture
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

Response:

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

{
  "Payment": {
    "ID": 3005348,
    "SkinID": null,
    "ClientIP": null,
    "Created": "20170802143125",
    "MerchantTransactionID": "s2ptest_g23",
    "OriginatorTransactionID": null,
    "Amount": 980,
    "Currency": "EUR",
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": null,
    "MethodID": 75,
    "MethodOptionID": null,
    "IncludeMethodIDs": null,
    "ExcludeMethodIDs": null,
    "PrioritizeMethodIDs": null,
    "SiteID": 30201,
    "NotificationDateTime": "20170802143816",
    "Customer": {
      "ID": 410,
      "MerchantCustomerID": "0125",
      "Email": "youremail@email.com",
      "FirstName": "Example",
      "LastName": "Test",
      "Gender": "1",
      "SocialSecurityNumber": "410321-9202",
      "Phone": "0765260000",
      "Company": "S2P",
      "DateOfBirth": null
    },
    "BillingAddress": {
      "ID": 896,
      "City": "Ankeborg",
      "ZipCode": "12345",
      "State": "Iasi",
      "Street": "Stargatan",
      "StreetNumber": "1",
      "HouseNumber": "22",
      "HouseExtension": "25",
      "Country": "SE"
    },
    "ShippingAddress": {
      "ID": 896,
      "City": "Ankeborg",
      "ZipCode": "12345",
      "State": "Iasi",
      "Street": "Stargatan",
      "StreetNumber": "1",
      "HouseNumber": "22",
      "HouseExtension": "25",
      "Country": "SE"
    },
    "Articles": [
      {
        "MerchantArticleID": "1231",
        "Name": "TEST",
        "Quantity": 1,
        "Price": 1000,
        "VAT": 1000,
        "Discount": 2,
        "Type": 1,
        "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=0F09F826DB585C0D546D98495C40FE9F.3005348"
  }
}

For Card payments the Authorized status can only be obtained when a payment is initiated with the Capture parameter set to false.

Once the payment has an Authorized status, you can capture either a partial amount or the full amount of the initial authorized amount for the transaction.

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

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.

You need to specify the captured amount parameter in the query string, in order to partially capture a payment.

Request:

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

Response:

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

{
  "Payment": {
    "ID": 202239,
    "ClientIP": null,
    "SkinID": null,
    "Created": "20161205091934",
    "MerchantTransactionID": "s2ptest_h10",
    "OriginatorTransactionID": null,
    "Amount": 2000,
    "Currency": "EUR",
    "CapturedAmount": 1000,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",
    "Description": "payment product",
    "StatementDescriptor": "bank statement message",
    "MethodID": 6,
    "MethodOptionID": null,
    "SiteID": 1010,
    "NotificationDateTime": null,
    "Customer": {
      "ID": 115,
      "MerchantCustomerID": "null",
      "Email": "customer@test.com",
      "FirstName": "John",
      "LastName": "Doe",
      "Gender": "1",
      "SocialSecurityNumber": "45908-28324",
      "Phone": "0744-783322",
      "Company": "S2P"
    },
    "BillingAddress": {
      "ID": 253,
      "City": "Iasi",
      "ZipCode": "7000-49",
      "State": "Iasi",
      "Street": "Sf Lazar",
      "StreetNumber": "37",
      "HouseNumber": "5A",
      "HouseExtension": "-",
      "Country": "RO"
    },
    "ShippingAddress": {
      "ID": 87,
      "City": "Iasi",
      "ZipCode": "700049",
      "State": "Iasi",
      "Street": "Sf Lazar",
      "StreetNumber": "37",
      "HouseNumber": "-",
      "HouseExtension": "-",
      "Country": "RO"
    },
    "Articles": null,
    "Card": null,
    "CreditCardToken": null,
    "Status": {
      "ID": 35,
      "Info": "PartiallyCaptured",
      "Reasons": []
    },
    "MethodTransactionID": null,
    "PaymentTokenLifetime": null,
    "Capture": false,
    "Retry": true,
    "RedirectURL": null,
    "3DSecure": 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/3005348/capture
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

Response:

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

{
  "Payment": {
    "ID": 3005348,
    "SkinID": null,
    "ClientIP": null,
    "Created": "20170802143125",
    "MerchantTransactionID": null,
    "OriginatorTransactionID": null,
    "Amount": null,
    "Currency": null,
    "ReturnURL": null,
    "Description": null,
    "MethodID": 75,
    "MethodOptionID": null,
    "IncludeMethodIDs": null,
    "ExcludeMethodIDs": null,
    "PrioritizeMethodIDs": null,
    "SiteID": 30201,
    "NotificationDateTime": "20170802143816",
    "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 - 3005348"
        }
      ]
    },
    "MethodTransactionID": null,
    "TokenLifetime": null,
    "Capture": null,
    "PreapprovalDetails": null,
    "RedirectURL": null
  }
}