For some businesses, it makes sense to authorize a transaction first and then capture later. When you authorize, you verify that the customer has sufficient funds, and you place a hold on that amount without actually processing the transaction and taking the money. Authorizing a transaction gives merchants time to verify inventory, prepare shipments, or complete services before finalizing the charge. When you capture the transaction, it puts the transaction in a batch for settlement and starts the process of moving the funds from the customer to the merchant account.

Capturing an authorized transaction later also allows merchants to capture part of the authorized amount if the final total ends up being less than expected, avoiding the need for refunds.

This guide covers how to authorize and capture transactions through the API.

You must capture an authorized transaction to complete the transaction and move funds from the customer to merchant account. To authorize and capture a payment in one step, use the Make a transaction endpoint.

Considerations

Keep these considerations in mind when working with transactions:

  • Authorizing a transaction reserves funds for the merchant but doesn’t move them.
  • You must capture an authorized transaction to complete it and move the funds.
  • You can capture an amount equal to or less than the original authorization.
  • Authorized transactions aren’t flagged for settlement until they’re captured.
If aren’t using a stored payment method provided by an embedded component to run transactions, you must secure cardholder, bank account data, and customer IP address because your PCI scope is expanded.

Authorize a transaction

Send a POST request to /api/MoneyIn/authorize to authorize a payment transaction. This action reserves funds and returns an authorization code. See the API reference for this endpoint for full documentationm.

This example authorizes a card transaction for $100, with no service fee, for entrypoint f743aed24a. The customer ID is 224.

Authorize a Transaction
curl --request POST \
      --url 'https://api-sandbox.payabli.com/api/MoneyIn/authorize?forceCustomerCreation=false' \
      --header 'accept: application/json' \
      --header 'content-type: application/*+json' \
      --header 'requestToken: <API TOKEN>' \
      --data '
{
    "entryPoint": "f743aed24a",
    "paymentMethod": {
        "method": "card",
        "cardnumber": "4111111111111111",
        "cardexp": "0330",
        "cardcvv": "737",
        "cardzip": "33625",
        "cardHolder":"John Smith"
    },
    "paymentDetails": {
        "totalAmount"100.00,
        "serviceFee": 0.00
    },
    "customerData": {
        "customerId": 224
    }
}'

A successful request returns a 200 response with a JSON body containing a referenceId which you’ll need for the capture operation.

{
    "responseText": "Success",
    "isSuccess": true,
    "responseData": {
        "authCode": "123456",
        "referenceId": "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
        "resultCode": 1,
        "resultText": "Authorized",
        "avsResponseText": "No address or ZIP match only",
        "cvvResponseText": "CVV2/CVC2 no match",
        "customerId": 224,
        "methodReferenceId": null
    }
}

After authorizing a transaction, you can capture the transaction to complete it and move the funds from the customer to the merchant account.

Capture a transaction

Send a GET request to /api/MoneyIn/capture to complete an authorized transaction and move the funds from the customer to the merchant account. See the API reference for full documentation.

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.

curl --request GET \
      --url https://api-sandbox.payabli.com/api/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13/0 \
      --header 'accept: application/json' \
      --header 'requestToken:<API TOKEN>'

A successful capture request returns a 200 response with a JSON body containing the transaction details.

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

Was this page helpful?