Description
The gform_stripe_api_mode
filter in the Gravity Forms Stripe Add-On allows the API mode to be set to โliveโ or โtestโ.
Usage
1 | add_filter( 'gform_stripe_api_mode', 'your_function_name', 10, 2); |
Parameters
- $api_mode string
The API mode. Possible values arelive
ortest
. - $feed_id int
Determines the context in which the API mode is applied. Whennull
, the global connection settings apply. When specified, the API mode applies to the feed-specific connection.
Examples
Set Live mode globally.
1 2 3 | add_filter( 'gform_stripe_api_mode' , function ( $api_mode , $feed_id ) { return 'live' ; }, 10, 2 ); |
Set Live mode for a specific feed_id.
1 2 3 4 5 6 | add_filter( 'gform_stripe_api_mode' , function ( $api_mode , $feed_id ) { if ( $feed_id === 521 ) { return 'live' ; } return $api_mode ; }, 10, 2 ); |
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This filter was added in Stripe version 2.0.
Source Code
This filter is located in GFStripe::get_api_mode() in gravityformsstripe/class-gf-stripe.php.