Using Gravity Forms ‘gform_stripe_subscription_params_pre_update_customer’ PHP filter

The gform_stripe_subscription_params_pre_update_customer Gravity Forms PHP filter allows you to modify the subscription parameters before the customer is subscribed to the plan.


add_filter( 'gform_stripe_subscription_params_pre_update_customer', 'your_function_name', 10, 7 );


  • $subscription_params (array) – The subscription parameters. Check out Stripe’s documentation to see what parameters subscriptions can accept.
  • $customer (object) – The Stripe customer object.
  • $plan (object) – The Stripe plan object.
  • $feed (Feed Object) – The feed currently being processed.
  • $entry (Entry Object) – The entry currently being processed.
  • $form (Form Object) – The form which created the current entry.
  • $trial_period_days (int) – The number of days the trial should last.

More information

See Gravity Forms Docs: gform_stripe_subscription_params_pre_update_customer


Cancel at period end

The example below sets the subscription to be cancelled at the end of the current period.

add_filter( 'gform_stripe_subscription_params_pre_update_customer', 'change_details', 10, 7 );

function change_details( $subscription_params, $customer, $plan, $feed, $entry, $form, $trial_period_days ) {
    $subscription_params['cancel_at_period_end'] = true;

    return $subscription_params;

Cancel at specified date/time

This example shows how you can provide a timestamp at which the subscription should cancel.

add_filter( 'gform_stripe_subscription_params_pre_update_customer', 'stripe_subscription_cancel_at', 10, 7 );

function stripe_subscription_cancel_at( $subscription_params, $customer, $plan, $feed, $entry, $form, $trial_period_days ) {
    // Get the feed that processed the entry.
    $feed = gf_stripe()->get_payment_feed( $entry );
    $feed_name = rgars( $feed, 'meta/feedName' );

    // Define the names of the feeds you want to target here.
    $feed_names = array( 'feed name one', 'feed name two' );

    if ( ! in_array( $feed_name, $feed_names ) ) {
        // Abort if the entry was processed by a different feed.

    // Set your desired cancellation date here.
    $subscription_params['cancel_at'] = strtotime( '2020-12-31' );

    return $subscription_params;

This code should be placed in the functions.php file of your active theme.

This filter was added in Stripe version 2.3.4.

Source Code
This filter is located in GFStripe::update_subscription() in gravityformsstripe/class-gf-stripe.php.