gform_stripe_success_url

gform_stripe_success_url

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Filters Stripe session』s success URL, which is the URL that users will be sent to after completing the payment on Stripe.
Usage
add_filter( 'gform_stripe_success_url', function ($url, $form_id, $query ) {
// Your code here.
}, 10, 3 );

Parameters

$url string
The URL to be filtered.

$form_id int
The ID of the form being submitted.

$query string
The query string portion of the URL.

Example
The following example will change the URL to use a domain of your choice if for any reason the site is provide localhost as domain.
add_filter( 'gform_stripe_success_url', function ($url, $form_id, $query ) {
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, 3 );

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.

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註