Skip to content
Last updated

UpdateTransaction

Updates a transaction in the system

Request Parameters

ParameterTypeDescriptionRequired
actionstring"UpdateTransaction"Required
transactionidintThe unique ID of the transaction to update.Required
refundidintThe unique ID of the transaction that this transaction refunds.Optional
useridintThe ID of the user to apply the transaction to.Optional
invoiceidintThe ID of the invoice the transaction is for.Optional
transidstringThe unique transaction ID for this payment.Optional
datestringThe date of the transaction in the Y-m-d format.Optional
gatewaystringThe gateway of the transaction, in system format.Optional
currencyintThe currency ID for the transaction, if not associated with a user.Optional
descriptionstringThe description of the transaction.Optional
amountinfloatThe amount received by the payment.Optional
feesfloatThe amount of fee charged on the transaction by the merchant. This can be negative.Optional
amountoutfloatThe amount paid out by the payment.Optional
ratefloatThe exchange rate for the payment based on the default currency.Optional
creditboolWhether to apply the payment to credit on the client account. Invoice ID must not be provided.Optional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error
transactionidintThe ID of the updated transaction.

Example Request (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'UpdateTransaction',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'transactionid' => '1',
            'transid' => 'FJWEK32DWO329JFWUPDATE',
            'rate' => '1.00000',
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'UpdateTransaction';
$postData = array(
    'transactionid' => '1',
    'transid' => 'FJWEK32DWO329JFWUPDATE',
    'rate' => '1.00000',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

Example Response JSON

{
    "result": "success"
}

Version History

VersionChangelog
1.0Initial Version