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
Parameter | Required? | Type | Description |
---|---|---|---|
id | Yes | String | The id of the existing Preauth Transaction |
Error Codes
HTTP Status | Error Code | Meaning | Resolution | Message |
---|---|---|---|---|
200 | AP009 | Not authorized to update transaction | Check id parameter is accurate | Unauthorized |
200 | AP300 | Unable to connect to user bank account | Confirm bank connection was not removed. Reconnect bank if persists | We're having issues connecting to your bank. Please reconnect or contact [email protected]. |
200 | AP302 | User has insufficient funds for transaction | Add funds to account or reach out to [email protected] for more information. | Available balance does not meet requirement - contact [email protected] for more information. |
200 | AP312 | Preauth has already been captured | Transaction has already been captured. Nothing needs to be done | Preauth has already been captured by Transaction #{transactionId} |
200 | AP313 | Preauth capture ineligible. It has either expired or been canceled | Create a new preauth transaction or reach out to [email protected] for more information. | Preauthorized Transaction with status of {status} not eligible for capture |
200 | AP700 | Missing required parameter | Provide 'id' parameter | Missing 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
Updated 7 months ago