#### `vtupress_before_credit` & `vtupress_after_credit`
Fires right before and immediately after a user’s wallet is credited.
**Args:** `$user_id`, `$amount`, `$type`
**Hook Example:**
```php
add_action('vtupress_after_credit', function($user_id, $amount, $type) {
if ($amount > 10000) {
// Send a celebratory email for huge deposits
$user = get_userdata($user_id);
wp_mail($user->user_email, 'Huge Deposit!', "You just funded NGN $amount!");
}
}, 10, 3);
```#### `vtupress_before_debit` & `vtupress_after_debit`
Fires right before and immediately after a user’s wallet is debited.
**Args:** `$user_id`, `$amount`, `$type`
**Hook Example:**
```php
add_action('vtupress_after_debit', function($user_id, $amount, $type) {
// Log debits to a custom external analytics server
my_custom_api_logger($user_id, 'debit', $amount, $type);
}, 10, 3);
```#### `vtupress_before_refund` & `vtupress_after_refund`
Fires when a transaction fails and the system is refunding the user.
**Args:** `$user_id`, `$amount`, `$originalRef`
**Hook Example:**
```php
add_action('vtupress_after_refund', function($user_id, $amount, $originalRef) {
// Notify the user their refund was processed
send_sms_to_user($user_id, "Your refund for transaction $originalRef has been processed.");
}, 10, 3);
```#### `vtupress_transaction_success`
Fires immediately after a transaction is successfully completed and logged.
**Args:** `$debited_txn_id`, `$service_id`, `$response_data`
**Hook Example:**
```php
add_action('vtupress_transaction_success', function($debited_txn_id, $service_id, $response_data) {
if ($service_id === 'data') {
// Award user a badge using a custom gamification plugin
my_custom_badge_awarder($response_data['user_id'], 'Data Buyer');
}
}, 10, 3);
```#### `vtupress_transaction_failed`
Fires when a transaction is confirmed as failed.
**Args:** `$debited_txn_id`, `$service_id`, `$error_message`
**Hook Example:**
```php
add_action('vtupress_transaction_failed', function($debited_txn_id, $service_id, $error_message) {
if (strpos($error_message, 'Insufficient API Balance') !== false) {
// Alert admin immediately via Slack
send_slack_alert("CRITICAL: API out of funds for: " . $service_id);
}
}, 10, 3);
```