Disable notification based on payment status

Hello!

I have been using this plugin for a long time, to integrate Gravity Form with the Gateway Mercado Pago in Argentina. For several days, the gateway has been duplicating IPN notifications on the same payment. Causing a lot of confusion to customers, because they receive duplicated notification of payment received, with a difference of some days.
Until Mercado Pago can resolve this.

I would like to be able to use it to deactivate a specific notification of a particular form, when the payment status is: Paid.

add_filter( 'gform_disable_notification', function( $is_disabled, $notification, $form, $entry, $data ) {
    if ( isset( $data['payment_action'] ) && empty( $data['payment_action']['amount'] ) ) {
        $is_disabled = true;
    }
     return $is_disabled;
}, 10, 5 );

Plugin: https://wpgateways.com/products/mercado-pago-gateway-gravity-forms/

Will I be able to use it to solve this?

Thanks for your help.

Best regards,
Obermedia

If your payment add-on follows Gravity Forms conventions, and the payment status is marked “Paid” in the wp_gf_entry table, then you can use that code with a slight change:

<?php
add_filter( 'gform_disable_notification', function( $is_disabled, $notification, $form, $entry, $data ) {
    if ( $data['payment_status'] == 'Paid' )  {
        $is_disabled = true;
    }
     return $is_disabled;
}, 10, 5 );

If they are not marking the entry Paid, you will need to modify the code to read whatever they are recording as Paid and disable the notification based on that.

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.