Title: Prevent payment redirect gravityforms
Last modified: November 6, 2019

---

# Prevent payment redirect gravityforms

 *  Resolved Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/)
 * Hey,
 * Is there a way to prevent the payment redirect from happening through a wp hook?
 * For example:
    prevent the redirect if field 2 has value ‘hello’ in gform_confirmation
   hook or any other hook?
 *     ```
       add_filter( 'gform_confirmation', 'block_redirect', 10, 4);
       function block_redirect( $confirmation, $form, $entry ) {
           if( $form['id'] == 1 && rgar($entry, '48') == 'pin-betaald' || rgar($entry, '48') == 'achteraf') {
       		//TBD prevent payment redirect
           } 
           return $confirmation;
       }
       ```
   

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12106720)
 * I’m not sure why you would want to prevent the redirect, payments usually have
   a limited time after which they will expire automatically. Starting a payment,
   but not redirecting to let the customer complete the payment doesn’t seem logical(
   or are you somehow going to redirect the customer after the confirmation text
   is shown?).
 * Aside of that, our confirmation hooks into `gform_confirmation` with priority
   10. If you use a higher priority (e.g. “11”) you should be able to override the
   confirmation. See the Gravity Forms docs at [https://docs.gravityforms.com/gform_confirmation/](https://docs.gravityforms.com/gform_confirmation/)
   for further details.
 *  Thread Starter Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12106784)
 * Thanks for your response.
 * We have a field in the form that is only shown for admin users. This field has
   a checkbox which should skip the payment and directly go to a ‘thank you page'(
   anything but the payment page) because the payment is done in real life. (does
   not matter if payment was successful or not in the gf entry)
 * Changing priority of the `gform_confirmation` hook would skip the payment in 
   all cases. But we want a sort of exception in the hook itself. (as in the code
   sample I provided)
 * I hope you understand what I am trying to do.
 *  Plugin Author [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12106840)
 * If it’s just one checkbox, I’d suggest to set the condition for that field on
   the **Advanced** tab in the payment feed settings of the form.
 *  Thread Starter Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12106909)
 * This is an almost working solution.
    But it is actually a radio button with multiple
   options. My mistake for saying it was a checkbox.
 * So I need 2 condition:
    ‘field’ > ‘is not’ > ‘value1 to skip payment’ OR ‘field’
   > ‘is not’ > ‘value2 to skip payment’
 * But I am only able to add 1 condition through the Advanced tab.
    -  This reply was modified 6 years, 7 months ago by Anonymous User 17646384.
 *  Plugin Author [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12106949)
 * There’s no option 3 by chance which you can use in the condition to only process
   the feed if that option has been chosen? (instead of the other way around) Maybe
   with multiple similar feeds?
 * Also, another suggestion (I’m not sure if it suits your case) would be to only
   show the product field if you want to process the payment. If the total amount
   of the form entry is 0, it won’t get processed by our plugin too.
 *  Thread Starter Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12107011)
 * There isn’t a third option, but I just added a third option which is ‘default’.
 * This solved the issue, thank you 🙂
 *  Thread Starter Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12107120)
 * One more problem I found after testing.
 * When enabling the condition it skips the payment page as expected, but It redirects
   me to the ‘payment error’ page. But in this case it isn’t an error.
 * Is there a way to go to a different page for conditions?
 *  Thread Starter Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12155120)
 * ^ Anyone able to help me with this?
 *  Plugin Author [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12212433)
 * Has this payment error page been set as the default confirmation in the settings
   of the form (Forms » [ Choose form ] » Settings » Confirmations)?
 * If there’s no payment started after submitting an entry (see WordPress admin »
   Pay » Payments), our plugin won’t redirect to a payment error page.
 *  Thread Starter Anonymous User 17646384
 * (@anonymized-17646384)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12218824)
 * There indeed was no payment started so your plugin did not make the redirect.
   
   it was the condition i put on the error message which was wrong
 *  Plugin Author [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12218857)
 * Thank you for your update. Glad the issue has been resolved.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Prevent payment redirect gravityforms’ is closed to new replies.

 * ![](https://ps.w.org/pronamic-ideal/assets/icon.svg?rev=3062720)
 * [Pronamic Pay](https://wordpress.org/plugins/pronamic-ideal/)
 * [Support Threads](https://wordpress.org/support/plugin/pronamic-ideal/)
 * [Active Topics](https://wordpress.org/support/plugin/pronamic-ideal/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pronamic-ideal/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pronamic-ideal/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/prevent-payment-redirect-gravityforms/#post-12218857)
 * Status: resolved