WP SmartPay fires action hooks and filter hooks at every major point in the payment and subscription lifecycle. Third-party plugins, themes, and custom code can hook into these to extend behavior without modifying SmartPay's source files.

Payment Lifecycle Hooks

Actions

Hook When it fires Parameters
smartpay_payment_created New payment record inserted $payment (Payment model)
smartpay_payment_completed Payment status changes to completed $payment_id, $payment
smartpay_payment_failed Payment status changes to failed $payment_id, $payment
smartpay_payment_refunded A refund is issued on a payment $payment_id, $amount
smartpay_update_payment_status Any payment status change $payment_id, $new_status, $old_status

Filters

Hook What it filters Parameters
smartpay_prepare_payment_data Payment data array before insert $payment_data, $raw_data
smartpay_payment_success_redirect_url URL to redirect to after successful payment $url, $payment_id
smartpay_payment_failure_message Error message shown on payment failure $message, $payment_data

Subscription Lifecycle Hooks

Actions

Hook When it fires Parameters
smartpay_pro_subscription_created New subscription created $subscription
smartpay_pro_subscription_renewed Renewal payment succeeds $subscription, $payment
smartpay_pro_subscription_cancelled Subscription cancelled $subscription
smartpay_pro_subscription_completed Fixed-term subscription finishes all installments $subscription
smartpay_pro_subscription_failing Renewal payment fails $subscription

Donation & Campaign Hooks

Actions

HookWhen it firesParameters
smartpay_campaign_updatedAfter a campaign is saved via REST$campaign_id, $request
smartpay_campaign_page_after_formsOn the campaign page, after the form$campaign, $progress
smartpay_dashboard_giving_monthly_actionsIn the Giving tab, per recurring-gift row$subscription
smartpay_dashboard_giving_receipt_actionsIn the Giving tab, per donation-history row$gift

Filters

HookWhat it filtersParameters
smartpay_donation_receipt_noteThe "no goods or services" note on donation receipts$note, $payment
smartpay_campaign_wall_is_publicWhether a campaign's donor list is public (default false)$is_public, $campaign
smartpay_campaign_wall_shows_namesWhether donor names are shown (default true)$show, $campaign
smartpay_campaign_rest_dataCampaign data returned by REST$campaign
smartpay_campaign_donors_responseCampaign donors REST response$donors, $campaign
smartpay_donors_responseDonors list REST response$donors, $request
smartpay_donor_responseSingle donor REST response$response, $donor_id

Example: Change the Donation Receipt Note

add_filter( 'smartpay_donation_receipt_note', function ( $note, $payment ) {
    return 'Registered charity no. 123456. No goods or services were provided in exchange for this gift.';
}, 10, 2 );

Gateway Hooks

Each gateway follows a consistent naming pattern:

Hook pattern Gateway slug examples Purpose
smartpay_{gateway}_ajax_process_payment stripe, paypal, razorpay Handles AJAX form submission for that gateway
smartpay_{gateway}_process_payment Same as above Direct payment processing (non-AJAX)
smartpay_gateways — Filter to register a new gateway

Form / Checkout Hooks

Hook When it fires
smartpay_checkout_before_form Before the payment form renders
smartpay_checkout_after_form After the payment form renders
smartpay_checkout_validate On form submission, before gateway processing — add custom validation here
smartpay_form_fields Filter to add or remove fields from the checkout form

Example: Run Custom Code on Payment Completion

add_action( 'smartpay_payment_completed', function( $payment_id, $payment ) {
    $customer_email = $payment->email;
    $amount         = $payment->amount; // in smallest currency unit

    // Custom logic here — e.g., add to custom DB table, send third-party API call
    my_plugin_handle_payment( $customer_email, $amount );
}, 10, 2 );

Example: Customize the Success Redirect URL

add_filter( 'smartpay_payment_success_redirect_url', function( $url, $payment_id ) {
    // Redirect VIP customers to a different thank-you page
    $payment = smartpay_get_payment( $payment_id );
    if ( $payment && $payment->amount >= 19900 ) {
        return home_url( '/vip-thank-you/' );
    }
    return $url;
}, 10, 2 );

Finding All Available Hooks

  • Free plugin hooks: search do_action( and apply_filters( in ../smartpay/app/
  • Pro plugin hooks: search in app/ — all Pro-specific hooks use the smartpay_pro_ prefix
  • Gateway-specific hooks: check each gateway's class file in app/Gateways/