gform_stripe_payment_intent_pre_create

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. 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.

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.