Authorize and capture transactions

Learn how to authorize and capture payments for settlement using the API

Applies to:Developers

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 documentation.

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

POST
/api/MoneyIn/authorize
1curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/authorize \
2 -H "requestToken: <apiKey>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "paymentDetails": {
6 "totalAmount": 100,
7 "serviceFee": 0
8 },
9 "paymentMethod": {
10 "cardcvv": "999",
11 "cardexp": "02/27",
12 "cardHolder": "John Cassian",
13 "cardnumber": "4111111111111111",
14 "cardzip": "12345",
15 "initiator": "payor",
16 "method": "card"
17 },
18 "customerData": {
19 "customerId": 4440
20 },
21 "entryPoint": "f743aed24a",
22 "ipaddress": "255.255.255.255"
23}'

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

Response
1{
2 "isSuccess": true,
3 "pageIdentifier": null,
4 "responseData": {
5 "authCode": "123456",
6 "avsResponseText": "No address or ZIP match only",
7 "customerId": 4440,
8 "cvvResponseText": "CVV2/CVC2 no match",
9 "methodReferenceId": null,
10 "referenceId": "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
11 "resultCode": 1,
12 "resultText": "Authorized"
13 },
14 "responseText": "Success"
15}

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

To complete an authorized transaction and start the settlement process, send a GET request to /api/MoneyIn/capture. See the API reference for full documentation.

Each example captures a card transaction for the transaction 10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13.

This example captures the full authorized amount of $100.00. Sending 0 as the amount captures the full authorized amount.

GET
/api/MoneyIn/capture/:transId/:amount
1curl https://api-sandbox.payabli.com/api/MoneyIn/capture/10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13/0 \
2 -H "requestToken: <apiKey>"

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

Response
1{
2 "isSuccess": true,
3 "responseData": {
4 "AuthCode": "123456",
5 "CustomerId": null,
6 "ReferenceId": "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
7 "ResultCode": 1,
8 "ResultText": "SUCCESS"
9 },
10 "responseText": "Success"
11}