gform_stripe_post_include_api

gform_stripe_post_include_api

DescriptionsUsageParametersExamplesPlacementSinceSource Code

Descriptions
The 「gform_stripe_post_include_api」 action in the Gravity Forms Stripe Add-On allows further actions to be performed after the Stripe API is initialized.
Usage
add_action( 'gform_stripe_post_include_api', 'your_function_name' );

Parameters
There are no parameters.
Examples
This example writes to a log after the API is initialized.
add_action( 'gform_stripe_post_include_api', 'log_it' );
function log_it(){
GFLogging::log_message( 'gravityformsstripe', __METHOD__ . '(): Stripe API Initialized. Performing further actions.', 1 );
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe version 2.0.10.
Source Code
This filter is located in GFStripe::include_stripe_api() in gravityformsstripe/class-gf-stripe.php.

gform_stripe_payment_intent_pre_create

gform_stripe_payment_intent_pre_create

DescriptionUsageParametersExamples1. Add the statement_descriptor propertyPlacementSinceSource Code

Note: Use the gform_stripe_session_data filter instead if using Stripe Checkout.
Description
The gform_stripe_payment_intent_pre_create filter allows for the changing of the payment intent data before creating it.
Note: This filter is applicable only to Products and Services feeds.
Usage
The hook which would run for all Stripe product and service feeds can be used like so:
add_filter( 'gform_stripe_payment_intent_pre_create', 'your_function_name', 10, 2 );

Parameters

$data array
The payment intent data.

$feed Feed Object
The feed object currently being processed.

Examples
1. Add the statement_descriptor property
The following example shows how you can add the statement_descriptor property to the payment intent data.
add_filter( 'gform_stripe_payment_intent_pre_create', 'add_statement_descriptor', 10, 2 );
function add_statement_descriptor( $data, $feed ) {
$data['statement_descriptor'] = 'STATEMENTDESC';

return $data;
}

Placement
Your code snippet should be placed in the functions.php file of your active theme.
Since
This hook was added in Stripe version 3.5.
Source Code
$data = apply_filters( 'gform_stripe_payment_intent_pre_create', $data, $feed );

This hook is located in GFStripe::create_payment_intent() in class-gf-stripe.php.

gform_stripe_object

gform_stripe_object

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
Allows the arguments used to create the Stripe object to be modified.
Usage
add_filter( 'gform_stripe_object', 'your_function_name', 10, 2 );

Parameters

$args array
An array of the various arguments used to create the Stripe object.

$form_id int
The ID of the form.

Examples
add_filter( 'gform_stripe_object', 'set_stripe_args', 10, 2 );
function set_stripe_args( $args, $form_id ){
$args['ccFieldId'] = 8;
return $args;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe version 2.6.
Source Code
This filter is located in GFStripe::register_init_scripts() in gravityformsstripe/class-gf-stripe.php.

gform_stripe_fulfillment

gform_stripe_fulfillment

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows custom actions to be performed after a checkout session is completed.
Usage
do_action( 'gform_stripe_fulfillment', $session, $entry, $feed, $form );

Parameters

$session array
The session object.

$entry array
The entry object.

$feed array
The feed object.

$form array
The form object.

Example
This example shows how to notify the site admin when a Stripe Checkout session has been completed successfully.
add_action( 'gform_stripe_fulfillment', 'notify_on_checkout_success', 10, 4 );
function notify_on_checkout_success( $session, $entry, $feed, $form ) {

$admin_email = get_bloginfo( 'admin_email' );
wp_mail( $admin_email, 'Payment via Stripe Checkout successful!', 'Message about the successful payment' );

}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe v3.1.
Source Code
This filter is located in class-gf-stripe.php.

gform_stripe_field_value

gform_stripe_field_value

DescriptionUsageParametersExamples1. Change value of specific custom meta keyPlacementSinceSource Code

Description
This filter can be used to modify a value before it is sent to Stripe. If you want to filter the value for any add-on you can use gform_addon_field_value.
Usage
The base filter which would run for all forms and all fields would be used like so:
add_filter( 'gform_stripe_field_value', 'your_function_name', 10, 5 );

To target a specific form append the form id to the hook name. (format: gform_stripe_field_value_FORMID)
add_filter( 'gform_stripe_field_value_10', 'your_function_name', 10, 4 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_stripe_field_value_FORMID_FIELDID)
add_filter( 'gform_stripe_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
The value to be modified.

$form Form Object
The Form currently being processed.

$entry Entry Object
The Entry currently being processed.

$field_id string
The ID of the Field currently being processed.

$meta_key string
The custom meta key currently being processed. Since version 2.1.1.

Examples
1. Change value of specific custom meta key
add_filter( 'gform_stripe_field_value', function ( $field_value, $form, $entry, $field_id, $meta_key ) {
if ( $meta_key == 'my custom key' ) {
$field_value = 'my custom value';
}

return $field_value;
}, 10, 5 );

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 1.9.10.11.
Source Code
This filter is located in GFStripe::maybe_override_field_value() in class-gf-stripe.php.

gform_stripe_entry_not_found_status_code

gform_stripe_entry_not_found_status_code

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_stripe_entry_not_found_status_code」 filter in Gravity Forms Stripe Add-On allows the status code for the entry not found WP_Error to be overridden.
Usage
add_filter( 'gform_stripe_entry_not_found_status_code', 'your_function_name', 10, 3 );

Parameters

$status_code int
The status code. Default is 200.

$action array
An associative array containing the event details.

$event Stripe Event Object
The Stripe event object for the webhook which was received.

Examples
add_filter( 'gform_stripe_entry_not_found_status_code', 'change_status_code', 10, 3 );
function change_status_code( $status_code, $action, $event ){
return "205";
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Stripe version 2.5.1.
Source Code
This filter is located in GFStripe::callback() in gravityformsstripe/class-gf-stripe.php.

gform_stripe_enable_rate_limits

gform_stripe_enable_rate_limits

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Enables the ability to disable or specifically enable error rate limiting when a Stripe feed is processed. Error rate limiting is enabled by default.
Do not use this filter to disable error rate limiting in a production environment with the Stripe add-on set to 「Live」 mode on the Forms > Settings > Stripe page outside of a temporary basis for testing purposes. This filter should only be used while testing your forms.

Error rate limiting is implemented to prevent your forms using the Stripe add-on from being used to perform fraudulent card testing. If you disable error rate limiting in a production environment you leave yourself open to processing transactions to fraudulent persons testing stolen credit cards leading to more potential card disputes if one of the cards being tested is valid.
Usage
add_filter( 'gform_stripe_enable_rate_limits', 'your_function_name' );

Parameters

$has_error bool
Indicates whether error rate limiting is enabled. Defaults to false (error rate limiting enabled).

$form_id int
The ID of the form being submitted.

Example
The following would disable error rate limiting for all forms:
add_filter( 'gform_stripe_enable_rate_limits', '__return_false' );

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe 3.4.
Source Code
This filter is located in class-gf-stripe.php.

gform_stripe_elements_style

gform_stripe_elements_style

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows styles to be used with Stripe Elements to control the look of the Credit Card field.
For more information about which styles may be applied, check out the style reference in Stripe』s documentation.
Usage
add_filter( 'gform_stripe_elements_style', 'your_function_name', 10, 2);

Parameters

$cardStyles array
Array of the current styles applied.

$formId int
The current form id.

Examples
Check out Stripe』s documentation to see what options are available for the styles.
add_filter( 'gform_stripe_elements_style', 'set_stripe_styles', 10, 2 );
function set_stripe_styles( $cardStyles, $formId){
$cardStyles['base'] = array(
'color' => 'purple',
'fontSize' => '20px',
'fontFamily' => 'Comic Sans, fantasy',
'fontSmoothing' => 'antialiased'
);
$cardStyles['invalid'] = array(
'color' => '#e5424d',
':focus' => array( 'color' => 'red' )
);
return $cardStyles;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe version 2.6.
Source Code
This filter is located in GFStripe::register_init_scripts() in gravityformsstripe/class-gf-stripe.php.

gform_stripe_elements_classes

gform_stripe_elements_classes

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows classes to be used with Stripe Elements to control the look of the Credit Card field.
For more information about which classes may be applied, check out the classes reference in Stripe』s documentation.
Usage
1add_filter( 'gform_stripe_elements_classes', 'your_function_name', 10, 2);

Parameters

$cardClasses array
Array of the current classes applied.

$formId int
The current form id.

Examples
Check out Stripe』s documentation to see what options are available for the classes.
123456789add_filter( 'gform_stripe_elements_classes', 'set_stripe_classes', 10, 2);function set_stripe_classes( $cardClasses, $formId ){    $cardClasses = array(                    'base' => 'TestElement',                    'complete' => 'TestComplete',                    'invalid' => 'TestInvalid'    );    return $cardClasses;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe version 2.6.
Source Code
This filter is located in GFStripe::register_init_scripts() in gravityformsstripe/class-gf-stripe.php.

gform_stripe_discounted_line_items_name

gform_stripe_discounted_line_items_name

DescriptionUsageParametersPlacementSinceSource Code

Description
Filter line item name when there are coupon discounts applied to the payment.
Usage
$line_items_name = apply_filters( 'gform_stripe_discounted_line_items_name', esc_html__( 'Payment with Discounts', 'gravityformsstripe' ), $feed, $submission_data, $form, $entry );

Parameters

$name string
The line item name of the discounted order.

$feed array
The feed object currently being processed.

$submission_data array
The customer and transaction data.

$form array
The form object currently being processed.

$entry array
The entry object currently being processed.

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe v3.0.3.
Source Code
This filter is located in class-gf-stripe.php.