How can I use WordPress hooks for payments in Amelia
Amelia provides several hooks related to payments, allowing you to modify payment data or run custom actions before payments are processed, updated, refunded, or sent to payment gateways and panels. These hooks help you extend Amelia safely without adjusting core plugin files.
Hooks require programming knowledge, and support is limited to general guidance.
Payment updated
How do I modify payment data before it is updated?
amelia_before_payment_updated_filter
Type: filter
Use this filter to modify payment data before it is updated from the back end.
function example($payment)
{
// change payment data
return $payment;
}
add_filter('amelia_before_payment_updated_filter', 'example', 10, 1);
How do I run code before a payment is updated?
amelia_before_payment_updated
Type: action
Runs before a payment is updated from the back end.
function example($payment)
{
// do action
}
add_action('amelia_before_payment_updated', 'example', 10, 1);
How do I run code after a payment is updated?
amelia_after_payment_updated
Type: action
Runs after a payment is updated from the back end.
function example($payment)
{
// do action
}
add_action('amelia_after_payment_updated', 'example', 10, 1);
Get payments
How do I modify payments before they are retrieved?
amelia_get_payments_filter
Type: filter
Use this filter to modify payments before they are retrieved for the back end.
function example($payments)
{
return $payments;
}
add_filter('amelia_get_payments_filter', 'example', 10, 1);
How do I run code before payments are retrieved?
amelia_get_payments
Type: action
Runs before payments are retrieved for the back end.
function example($payments)
{
// do action
}
add_action('amelia_get_payments', 'example', 10, 1);
Payment refunded
How do I run code before a payment is refunded?
amelia_before_payment_refunded
Type: action
Runs before a payment is refunded.
function example($payment, $amount)
{
// do action
}
add_action('amelia_before_payment_refunded', 'example', 10, 2);
How do I run code after a payment is refunded?
amelia_after_payment_refunded
Type: action
Runs after a payment is refunded.
function example($payment, $amount)
{
// do action
}
add_action('amelia_after_payment_refunded', 'example', 10, 2);
Payment processed
How do I modify payment data before it is processed?
amelia_before_payment_processed_filter
Type: filter
Use this filter to modify payment data before it is processed by the payment gateway. This hook is not applied for Mollie or WooCommerce.
function example($paymentData, $reservation)
{
return $paymentData;
}
add_filter('amelia_before_payment_processed_filter', 'example', 10, 2);
How do I run code before a payment is processed?
amelia_before_payment_processed
Type: action
Runs before a payment is processed by the payment gateway. This hook is not applied for Mollie or WooCommerce.
function example($paymentData, $reservation)
{
// do action
}
add_action('amelia_before_payment_processed', 'example', 10, 2);
Payment data saved
How do I modify payment data before it is saved?
amelia_before_payment
Type: filter
Use this filter to modify payment data before it is saved to the database.
function example($paymentData, $amount)
{
// change payment data
return $paymentData;
}
add_filter('amelia_before_payment', 'example', 10, 2);
How do I modify the final payment amount?
amelia_modify_payment_amount
Type: filter
Use this filter to modify the final calculated price for a booking.
function example($price, $booking)
{
// change price
return $price;
}
add_filter('amelia_modify_payment_amount', 'example', 10, 2);
Payment links and panel payments
How do I modify payment data before a payment link callback is executed?
amelia_before_payment_link_callback_filter
Type: filter
Use this filter to modify payment data before the payment link or panel payment callback is executed.
function example($payment, $data)
{
// change data
return $payment;
}
add_filter('amelia_before_payment_link_callback_filter', 'example', 10, 2);
How do I run code before a payment link callback is executed?
amelia_before_payment_link_callback
Type: action
Runs before the payment link or panel payment callback is executed.
function example($payment, $data)
{
// do action
}
add_action('amelia_before_payment_link_callback', 'example', 10, 2);
How do I run code after a payment link callback is executed?
amelia_after_payment_link_callback
Type: action
Runs after the payment link or panel payment callback is executed.
function example($payment, $data)
{
// do action
}
add_action('amelia_after_payment_link_callback', 'example', 10, 2);
Payment links created from the panel
How do I modify data before a payment link is created from the panel?
amelia_before_payment_from_panel_created_filter
Type: filter
Use this filter to modify data before the payment link is created from the panel.
function example($data)
{
// change data
return $data;
}
add_filter('amelia_before_payment_from_panel_created_filter', 'example', 10, 1);
How do I run code before a payment link is created from the panel?
amelia_before_payment_from_panel_created
Type: action
Runs before the payment link is created from the panel.
function example($data)
{
// do action
}
add_action('amelia_before_payment_from_panel_created', 'example', 10, 1);
How do I modify data after a payment link is created from the panel?
amelia_after_payment_from_panel_created_filter
Type: filter
Use this filter to modify payment link data after the payment link is created from the panel.
function example($paymentLinks, $data)
{
// change payment links
return $paymentLinks;
}
add_filter('amelia_after_payment_from_panel_created_filter', 'example', 10, 2);
How do I run code after a payment link is created from the panel?
amelia_after_payment_from_panel_created
Type: action
Runs after the payment link is created from the panel.
function example($data, $paymentLink)
{
// do action
}
add_action('amelia_after_payment_from_panel_created', 'example', 10, 2);
Payment links for emails and panels
How do I modify the payment amount before payment links are created?
amelia_payment_link_amount
Type: filter
Use this filter to modify the payment amount before payment links are created.
function example($amount, $data)
{
// change amount
return $amount;
}
add_filter('amelia_payment_link_amount', 'example', 10, 2);
How do I run code before payment links are created?
amelia_before_payment_links_created
Type: action
Runs before payment links are created for emails or the panel.
function example($methods, $data, $amount)
{
// do action
}
add_action('amelia_before_payment_links_created', 'example', 10, 3);
How do I modify payment links before they are used?
amelia_payment_links
Type: filter
Use this filter to modify payment links before they are used in emails or the panel. This filter is not applied for WooCommerce.
function example($paymentLinks, $amount, $data)
{
// change payment links
return $paymentLinks;
}
add_filter('amelia_payment_links', 'example', 10, 3);
How do I modify WooCommerce payment links?
amelia_wc_payment_link
Type: filter
Use this filter to modify WooCommerce payment links before they are used in emails or the panel.
function example($paymentLinks, $amount, $data)
{
// change payment links
return $paymentLinks;
}
add_filter('amelia_wc_payment_link', 'example', 10, 3);
How do I run code after payment links are created?
amelia_after_payment_links_created
Type: action
Runs after payment links are created for emails or the panel.
function example($paymentLinks, $data, $amount)
{
// do action
}
add_action('amelia_after_payment_links_created', 'example', 10, 3);