Using Gravity Forms ‘gform_stripe_payment_intent_pre_create’ PHP filter

The gform_stripe_payment_intent_pre_create filter allows you to modify the payment intent data before creating it.

Usage

To use the filter for all Stripe product and service feeds:

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.

More information

See Gravity Forms Docs: gform_stripe_payment_intent_pre_create

Note: This filter is only applicable to Products and Services feeds. Subscription feeds do not utilize Payment Intents, so this filter cannot be used. Please use the gform_stripe_subscription_params_pre_update_customer filter to target subscription feeds.

Examples

Add statement_descriptor property

This example demonstrates how to add a 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;
}

Place your code snippet in the functions.php file of your active theme.

Since: This hook was added in Stripe version 3.5.

Source Code: The hook is located in GFStripe::create_payment_intent() in class-gf-stripe.php.