Step 6 - Capture a Preauth Transaction

Execute the Preauth Transaction to move funds

In the previous step, we created a Preauth Transaction to store the details of a future transaction.

In this step, we will now capture a preauthorized transaction, creating an Aeropay Transaction where funds will be moved.

The id of the Preauthorized Transaction object is included in the body to specify the preauthorizedTransaction being captured. Once captured, you will receive the id of the Aeropay Transaction object.

👍

Point of Sale (POS) Integrations

If you're using Aeropay preauthorized transactions for purchases with an point of sale (POS), we recommend listening to a callback from the POS that the order has been completed to trigger the call to Aeropay's POST /capturePreauthTransaction

Step 6A - Capture the Preauth Transaction

HTTP request

Sandbox - POST https://staging-api.aeropay.com/capturePreauthTransaction
Production - POST https://api.aeropay.com/capturePreauthTransaction

Request parameters

ParameterRequired?TypeDescription
idYesStringThe id of the existing Preauth Transaction

Error Codes

HTTP StatusError CodeMeaningResolutionMessage
200AP009Not authorized to update transactionCheck id parameter is accurateUnauthorized
200AP300Unable to connect to user bank accountConfirm bank connection was not removed. Reconnect bank if persistsWe're having issues connecting to your bank. Please reconnect or contact [email protected].
200AP302User has insufficient funds for transactionAdd funds to account or reach out to [email protected] for more information.Available balance does not meet requirement - contact [email protected] for more information.
200AP312Preauth has already been capturedTransaction has already been captured. Nothing needs to be donePreauth has already been captured by Transaction #{transactionId}
200AP313Preauth capture ineligible. It has either expired or been canceledCreate a new preauth transaction or reach out to [email protected] for more information.Preauthorized Transaction with status of {status} not eligible for capture
200AP700Missing required parameterProvide 'id' parameterMissing Required Parameter 'id'

Code Example - Request

curl --request POST \
     --url https://staging-api.aeropay.com/capturePreauthTransaction \
     --header 'Content-Type: application/json' \
     --header 'accept: application/json' \
     --header 'authorizationToken: Bearer {{token}}' \
     --data '{"id":"1234"}'

Code Example - Response

{
    "success": true,
    "error": null,
    "amount": 1100,
    "merchantId": "582",
    "attributes": [],
    "uuid": "994e327c-4573-4ad6-b3d7-b873cda7f82a",
    "transactionId": "231634",
    "customerName": "John Doe",
    "status": "pending",
    "merchantName": "Aeropay"
}

👍

This creates an Aeropay transaction with a new, separate id, to the merchant and with the amount specified in the preauth.

This mirrors the outcome of the /transaction POST endpoint

Step 6B - Handle Webhooks

If you have an active webhook subscription, you will receive the transaction_completed webhook immediately after the resource has been created.

📘

To create a webhook subscription, visit our API Reference

Refer to this page