By default Gravity Forms only sends notifications for the form submission event, however, it is possible to define you own custom events.
The first step is to list the event in the event drop down on the edit notification page. You can do this using the gform_notification_events filter.
add_filter( 'gform_notification_events', function ( $notification_events, $form ) { $has_stripe_feed = function_exists( 'gf_stripe' ) ? gf_stripe()->get_feeds( $form['id'] ) : false; $has_paypal_feed = function_exists( 'gf_paypal' ) ? gf_paypal()->get_feeds( $form['id'] ) : false; $has_paypalpaymentspro_feed = function_exists( 'gf_paypalpaymentspro' ) ? gf_paypalpaymentspro()->get_feeds( $form['id'] ) : false; $has_authorizenet_feed = function_exists( 'gf_authorizenet' ) ? gf_authorizenet()->get_feeds( $form['id'] ) : false; if ( $has_stripe_feed || $has_paypal_feed || $has_paypalpaymentspro_feed || $has_authorizenet_feed ) { $payment_events = array( 'complete_payment' => __( 'Payment Completed', 'gravityforms' ), 'refund_payment' => __( 'Payment Refunded', 'gravityforms' ), 'fail_payment' => __( 'Payment Failed', 'gravityforms' ), 'add_pending_payment' => __( 'Payment Pending', 'gravityforms' ), 'void_authorization' => __( 'Authorization Voided', 'gravityforms' ), 'create_subscription' => __( 'Subscription Created', 'gravityforms' ), 'cancel_subscription' => __( 'Subscription Canceled', 'gravityforms' ), 'expire_subscription' => __( 'Subscription Expired', 'gravityforms' ), 'add_subscription_payment' => __( 'Subscription Payment Added', 'gravityforms' ), 'fail_subscription_payment' => __( 'Subscription Payment Failed', 'gravityforms' ), ); return array_merge( $notification_events, $payment_events ); } return $notification_events; }, 10, 2 );
Once you have added the events to the drop down you can then go and edit your notifications (or create new notifications) and assign them to your new events.
The events drop down only appears on the edit notification page when multiple notification events exist for the form, it will appear between the notification name and send to settings.
Assigning a notification to a custom event will prevent it being sent during submission. You will need to manually trigger the sending of the event notifications at the appropriate time. For payment related events we can use the gform_post_payment_action action hook and the GFAPI::send_notifications method.
add_action( 'gform_post_payment_action', function ( $entry, $action ) { $form = GFAPI::get_form( $entry['form_id'] ); GFAPI::send_notifications( $form, $entry, rgar( $action, 'type' ) ); }, 10, 2 );
The above code snippets should be placed in the functions.php file of your active theme.