Step 5 - Update a Preauth Transaction

Update a Preauth Transaction

Now that you have created a preauthorized transaction, you may update the payment or tip amount if changes need to be made to the transaction before capture. Preauthorized transactions will expire after 72 hours if not captured with POST /capturePreauthTransaction, or can be cancelled by calling DELETE /preauthTransaction.

If necessary, time to expiration can be configured on a merchant by merchant basis.

This step will go over how to update the details of a preauthorized transaction.

You will need to retrieve the user to check for their linked bank account. Refer to the previous step to learn more.

Step 5A - Update the Preauth Transaction

HTTP request

Sandbox - PATCH https://staging-api.aeropay.com/preauthTransaction
Production - PATCH https://api.aeropay.com/preauthTransaction

Request parameters

ParameterRequired?TypeDescription
idYesStringThe id of the preauthorized transaction
amountNoStringThe updated transaction amount
attributesYesObjectSee Attributes Object

Attributes Object

ParameterRequired?TypeDescription
keyYesStringSee Key Object

Key Object

ParameterRequired?TypeDescription
valueYesStringtip if entering a tip
descriptionYesStringSee example request

Code Example - Request

curl --request PATCH \
     --url https://staging-api.aeropay.com/preauthTransaction \
     --header 'Content-Type: application/json' \
     --header 'accept: application/json' \
     --header 'authorizationToken: Bearer {{token}}' \
     --data '
{
  "id": "19215",
  "amount": "12.00",
}'

Code Example - Response

{
    "success": true,
    "error": null,
    "transaction": {
        "id": "19215",
        "transactionId": "None",
        "merchantId": "582",
        "merchantAccountId": "511",
        "merchantLocationId": "541",
        "userId": "12973",
        "userAccountId": "16838",
        "userName": "John Doe",
        "userEmail": "[email protected]",
        "amount": "1200",
        "dollarAmount": "12.00",
        "originalAmount": "1100",
        "description": "Online Transaction",
        "attributes": {
            "tip": {
                "selection": {
                    "tipAmount": "1.00",
                    "label": "$1.00",
                    "totalAmount": "11.00"
                }
            }
        },
        "createdDate": "1694105493",
        "expiryDate": "1694364693",
        "cancellationDate": null,
        "creditPartnerId": null,
        "status": "live"
    }
}

Step 5B - Cancel the Preauth Transaction (optional)

A preauth transaction may also be optionally canceled.

HTTP request

Sandbox - DELETE https://staging-api.aeropay.com/preauthTransaction
Production - DELETE https://api.aeropay.com/preauthTransaction

Request parameters

ParameterRequired?TypeDescription
idYesStringThe id of the preauthorized 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 accountAvailable balance does not meet requirement - contact [email protected] for more information.
200AP700Missing required parameterProvide 'id' parameterMissing Required Parameter 'id'

Code Example - Request

curl --request DELETE \
     --url 'https://staging-api.aeropay.com/preauthTransaction?id=1234' \
     --header 'Content-Type: application/json' \
     --header 'accept: application/json' \
     --header 'authorizationToken: Bearer {{token}}'

Code Example - Response

{
    "success": true,
    "error": null
}