- Handle Custom Stripe Webhook Events
- suredonation_export_secret_option_keys Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- suredonation_enqueue_form_frontend_scripts Action Hook
- suredonation_after_form_duplicated Action Hook
- suredonation_email_sent Action Hook
- suredonation_donor_user_created Action Hook
- suredonation_donation_refunded Action Hook
- suredonation_donation_status_changed Action Hook
- suredonation_donation_completed Action Hook
- suredonation_new_donation Action Hook
- suredonation_donation_created Action Hook
- Validate Field Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_secret_option_keys Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- suredonation_enqueue_form_frontend_scripts Action Hook
- suredonation_after_form_duplicated Action Hook
- suredonation_email_sent Action Hook
- suredonation_donor_user_created Action Hook
- suredonation_donation_refunded Action Hook
- suredonation_donation_status_changed Action Hook
- suredonation_donation_completed Action Hook
- suredonation_new_donation Action Hook
- suredonation_donation_created Action Hook
Handle Custom Stripe Webhook Events
Overview
The suredonation_webhook_handle_event filter allows developers to process Stripe webhook events that are not handled by SureDonation’s core plugin.
This filter is executed from the default branch of the Stripe webhook event dispatcher. SureDonation Pro uses it to process subscription-related events such as customer.subscription.created and invoice.payment_succeeded, but you can also use it to handle your own custom Stripe webhook events.
When This Filter Runs
The filter runs whenever SureDonation receives a Stripe webhook event that does not have a native handler.
This allows you to extend SureDonation without modifying the plugin’s core files.
Filter Signature
apply_filters(
'suredonation_webhook_handle_event',
null,
$event_type,
$event_data,
$mode
);Parameters
| Parameter | Type | Description |
| $value | mixed | The current filter result. Starts as null, indicating the event has not yet been handled. |
| $event_type | string | The Stripe webhook event type. |
| $event_data | array | The Stripe event object data. |
| $mode | string | The Stripe payment mode. Possible values are live and test. |
Return Values
This filter uses a short-circuit pattern. Your callback should return one of the following values.
| Return Value | Description |
| null | Indicates that your callback did not handle the event. SureDonation continues processing normally and acknowledges the webhook to Stripe. |
| true | Indicates that the event was successfully handled. |
| WP_Error with code permanent_failure or invalid_event | Indicates an unrecoverable error. SureDonation acknowledges the webhook so Stripe stops retrying the event. |
| Any other WP_Error | Indicates a temporary failure. SureDonation returns the error so Stripe retries the webhook according to its retry schedule. |
Basic Usage
Register a callback using add_filter().
add_filter( 'suredonation_webhook_handle_event', 'your_custom_function', 10, 4 );
function your_custom_function( $result, $event_type, $event_data, $mode ) {
// Return null if you do not handle this event.
return $result;
}
Example
The following example handles the Stripe charge.dispute.created event.
add_filter( 'suredonation_webhook_handle_event', 'mysite_handle_dispute', 10, 4 );
function mysite_handle_dispute( $result, $event_type, $event_data, $mode ) {
if ( 'charge.dispute.created' === $event_type ) {
mysite_flag_dispute( $event_data );
return true;
}
return $result;
}
Best Practices
- Always return the original $result for events that your callback does not handle.
- Only return true after your custom logic completes successfully.
- Return an appropriate WP_Error when an error occurs so Stripe can determine whether the webhook should be retried.
- Avoid modifying or interrupting the processing of unrelated webhook events.
We don't respond to the article feedback, we use it to improve our support content.