1. Home
  2. Advanced
  3. Action & Filter Hooks

Action & Filter Hooks

WP Simple Pay Pro provides many ways for developers to tap into the code and add their own customizations. We use the native WordPress hook system for both actions and filters to allow for these modifications.

If you need help adding custom code you can read our article about adding custom functions.

You can also see specific examples we have created in our code snippet library.

Jump to Filter Hooks.

Action Hooks

You can read about action hooks if you are not familiar with how to add them into your code. The following is a complete list of the actions available, what the name of the hook is, and a description of where it gets fired off at.

simpay_form_loadedEarliest hook where the form object is available.
simpay_activatedFires at the end of the plugin activation hook.
simpay_deactivatedFires at the end of the plugin deactivation hook
simpay_loadedFires after plugin has been loaded.
simpay_load_objectsFires in the constructor of the Object factory class
simpay_register_post_typesFires right before the simple-pay post type is set up and created.
simpay_add_shortcodesFires in the register shortcodes function after the shortcodes for the plugin have been added.
simpay_add_menu_itemsFires after the submenu page for Settings has been added.
simpay_save_form_settingsFires when saving form settings.
simpay_admin_pagesFires on each Simple Pay admin page.
simpay_admin_page_{$page}_tabsFires on the settings page tab.

$page = the name of the settings page
simpay_admin_page_{$page}_{$current_tab}_startFires before the tab content output.

$page = The settings page ID

$current_tab = The current settings tab ID (i.e. general)
simpay_admin_page_{$page}_{$current_tab}_endFires after the tab content output.

$page = The settings page ID

$current_tab = The current settings tab ID (i.e. general)
simpay_custom_field_panelFires at the end of the custom field panel in the form settings.
simpay_after_{$key}_metaFires at the bottom of the $key custom metabox fields.
simpay_form_settings_meta_payment_options_panelFires after the payment options tab output in the form settings.
simpay_form_settings_meta_form_display_panelFires after the form display tab output in the form settings.
simpay_form_settings_meta_overlay_display_panelFires after the overlay display tab output in the form settings.
simpay_form_settings_meta_subscription_display_panelFires after the subscription display tab output in the form settings.
simpay_form_settings_meta_options_panelFires after all form settings options (tabs & content) have been rendered. Used to add additional tabs & content.
simpay_charge_createdFires when a Stripe one-time charge has successfully been created.
simpay_subscription_createdFires when a Stripe subscription has successfully been created. Includes initial charge.
simpay_before_form_closeFires before the closing of the HTML form tag on the frontend.
simpay_before_form_displayFires right before the form HTML is output.
simpay_after_form_displayFires right after the form HTML is output.
simpay_webhook_invoice_payment_succeededFires right as soon as the subscription invoice.payment_succeeded webhook is hit.
simpay_webhook_after_installment_increaseFires in the webhook when an installment plan max charge is increased.
simpay_webhook_after_subscription_cancelFires right after an installment plan subscription is cancelled.
simpay_webhook_eventHook that allows you to add your own webhook logic. Passes in the event data for the webhook.

Filter Hooks

You can read about filter hooks if you are not familiar with how to add them into your code. The following is a complete list of the filter hooks available, what the name of the hook is, and a description of what it modifies.

simpay_fee_percentFilter to tack on an additional percentage fee to the transactions. Global change only and use at your own risk - i.e. make sure it works on all your forms as you intend.
simpay_fee_amountSame as simpay_fee_percent except for adding dollar/cents amounts. Must return the value IN CENTS (i.e. $3.00 fee would be 300)
simpay_editor_templateFilter the default template for details editors.
simpay_system_status_report_panelsFor system status page panels.
simpay_system_status_report_sectionsFor system status page sections.
simpay_before_register_public_stylesFires before registering the public CSS files.
simpay_before_register_public_scriptsFires before registering the public JS files.
plugin_localeThe locale of the plugin. Defaults to the WP locale, so you really shouldn’t need to modify this in most cases.
simpay_get_admin_pagesSets the admin pages.$pages
simpay_get_{$option}_{$id}Modify the settings of a specific option group of the main settings.
simpay_{$option}_{$id}_sections_callbackModify the settings section callback of a specific option group.
simpay_form_{$id}_*Form-specific settings filters. See snippet library example for available options.
simpay_stripe_script_variablesThe Stripe settings that will be passed to the front-end for the overlay functionality.
simpay_before_register_admin_stylesFires before registering the admin CSS files.
simpay_before_register_admin_scriptsFires before registering the admin JS files.
simpay_plugin_action_linksThe action links underneath the plugin name on the plugins page.
simpay_admin_{$key}_field_templateTemplate file location for admin custom field output. $key is the key of the custom field you want to add a template for.
simpay_admin_page_{$page}_{$current_tab}_submitFires before outputting the submit button on the admin pages (tabs). If it is returned as true then it will show the submit button otherwise it will not show one.
simpay_custom_field_optionsArray of all the custom field types and their label.
simpay_custom_field_htmlFilter to hook into the custom field output process and provide your own custom field HTML.
simpay_form_settings_meta_tabs_liArray holding the information for the form settings tabs.
simpay_add_{$option}_{$id}_sectionsThis is for each global settings tab
simpay_add_{$option}_{$id}_fieldsThis is for each global settings tab
simpay_form_script_variablesData set in PHP to localize the formData used to control actions on the frontend.
simpay_secret_keyFilter to change the secret key.
simpay_publishable_keyFilter to change the publishable key.
simpay_zero_decimal_currenciesArray of zero-decimal currencies.
simpay_thousand_separatorChange the thousand separator.
simpay_decimal_separatorChange the decimal separator.
simpay_decimal_placesChange the default number of decimal places.
simpay_stripe_minimum_amountChange the default Stripe minimum amount.
simpay_formatted_amountFilter to change the formatting of the amount. NOTE: This is just the amount and happens before the currency symbol is added.
simpay_currency_symbolsArray holding all of the currency codes and symbols.
simpay_currency_symbolFilter the currency symbol.
simpay_customer_idFilter to change the customer ID used in making a Stripe charge. Defaults to empty.
simpay_details_order_dateFilter to modify the payment charge date returned from Stripe.
simpay_payment_details_template_tagsArray of the possible template tags and their functions for payment details screens.
simpay_before_payment_detailsHTML output before the payment details content.
simpay_after_payment_detailsHTML output after the payment details content.
simpay_payment_descriptionFilter to modify the payment description.
simpay_payment_metadataArray of the metadata that will be sent to Stripe when a charge is created.
simpay_list_separatorAllows you to change the admin fields that use a separator. The default is a comma, but you can change it with this filter.
simpay_cache_exclusion_urisSet up additional URLs for cache exclusion.
simpay_use_php_sessionsOverride the use of native PHP sessions.
simpay_custom_amount_field_typeSet custom amount field input type to something other than "tel". Set to "number" to allow decimal entry on mobile browsers.
simpay_payment_button_classAdd or remove CSS classes for the on-page form payment button.
simpay_charge_error_messageUsed to change output of the message: "An error occurred, but your charge may have gone through. Please contact the site admin."
simpay_stripe_customer_argsFilter to modify the Stripe customer args when create.
simpay_stripe_subscription_argsFilter to modify the Stripe subscription args when created.
Updated on July 23, 2017

Was this article helpful?

Related Articles