Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change Stripe API mode for targeted form.
<?php
/**
* Filters the API mode for a specific form to 'test'.
*
* @param $api_mode string Either 'test' or 'live'
*
* @return string Returns 'test' for targeted form. Otherwise,
* will return the value for the $api_mode setting.
*/
add_filter( 'gform_stripe_api_mode', function ( $api_mode ) {
// Change $form_id to the id of the form your targeting.
$form_id = 1;
$form = GFAPI::get_form( $form_id );
if ( $form ) {
return 'test';
}
return $api_mode;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.