gform_stripe_cancel_url

Description

Filters Stripe session’s cancel URL, which is the URL that users will be sent to after canceling the payment on Stripe.

Usage

add_filter( 'gform_stripe_cancel_url', 'your_function_name', 10, 2 );

Parameters

  • $url string

    The URL to be filtered.

  • $form_id int

    The ID of the form being submitted.

Example

add_filter( 'gform_stripe_cancel_url', function ($url, $form_id ) {
    GFCommon::log_debug( __METHOD__ . '(): Original URL: ' . $url );
    // Replace example.com with your site domain.
    $url = str_replace( 'localhost', 'example.com', $url );
    GFCommon::log_debug( __METHOD__ . '(): New URL: ' . $url );
    return $url;
}, 10, 2 );

Placement

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

Since

This filter was added in Stripe 3.0.

Source Code

This filter is located in class-gf-stripe.php.