gform_stripe_sca_success_pre_validation

Description

The gform_stripe_sca_success_pre_validation filter allows the modification of the validation result after a successful SCA challenge. After performing an SCA challenge, the form is resubmitted. Certain fields, notably spam fields, could fail validation a second time and need to be bypassed. This filter allows modification of the validation result on that second submission.

Usage

The following would apply to all forms.

add_filter( 'gform_stripe_sca_success_pre_validation', 'your_function_name', 10, 4 );

Parameters

  • $result array
    The validation result
  • $value array
    The field value being validated.
  • $form array
    The current form object.
  • $field array
    The current field being validated.

Example

add_filter( 'gform_stripe_sca_success_pre_validation', 'stop_second_recaptcha_validation', 10, 4 );
function stop_second_recaptcha_validation( $result, $value, $form, $field ) {
	if ( $field->type === 'captcha' ) {
		$result['is_valid'] = true;
		$result['message']  = '';
	}

	return $result;
}

Since

This filter was added in Gravity Forms Stripe 5.4

Source Code

This filter is located in GFStripe::pre_validation() in class-stripe.php

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?