This guide explains how to capture a payment transaction with the Payabli API. Authorizing a transaction returns an authorization code and reserves funds for the merchant. You must then capture a transaction to complete the transaction and move funds from the customer to merchant account.

You can only capture authorizations. To authorize and capture a payment in one step, use the Make a transaction endpoint instead.

Build the request

First, choose an endpoint. If you’re testing, use the Sandbox endpoint. for your target environment.

Authenticate

Authenticate by sending your API token in the request header with the key requestToken:
--header 'requestToken: API TOKEN'

Path parameters

This request has two required path parameters that tell Payabli which transaction to capture, and how much of the original authorization amount to capture.

transId
string
required

ID for the transaction. This is returned in the authorization response as ReferenceId.

amount
double
required

Amount to capture. The amount provided can’t be more than the original total amount of the transaction. An amount equal to zero captures the total amount authorized in the transaction.

You can capture an amount equal to or less than the original authorization. For example, a card was authorized for $100 to cover incidental charges, but $99.86 was the final total. You can capture only the $99.86 and release the hold on the remainder of the authorized amount.

Example request

Each example captures a card transaction for the transaction 10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13. The first example captures the total authorized amount. The second example captures $99.86 of the authorized amount.

Response

A successful request returns a 200 response with a JSON body with a referenceId of 10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13. If the payment is declined, the responseText reads Declined.

Success
{
  "isSuccess": true,
  "responseText": "Success",
  "responseCode": 1,
  "responseData": {
    "authCode": "123456",
    "referenceId":"10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
    "resultCode": 1,
    "resultText": "SUCCESS",
    "avsResponseText": null,
    "cvvResponseText": null,
    "customerId": null
  }
}

Capturing transactions in the web app

You can view transactions in the UI in your PayHub or PartnerHub account. You can also capture a transaction in the web app by clicking the Actions menu for the transaction and selecting Capture.