Created
January 28, 2019 23:54
-
-
Save chrispian/ecf7d6795dd1e96f9ea1af226fe3c157 to your computer and use it in GitHub Desktop.
Gravity Form Stripe Tweaks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'gform_stripe_customer_id', function ( $customer_id, $feed, $entry, $form ) { | |
if ( rgars( $feed, 'meta/transactionType' ) == 'product' && rgars( $feed, 'meta/feedName' ) == 'Auto Pay Feed' ) { | |
$customer_meta = array( | |
'metadata' => gf_stripe()->get_stripe_meta_data( $feed, $entry, $form ), | |
); | |
$customer = gf_stripe()->create_customer( $customer_meta, $feed, $entry, $form ); | |
return $customer->id; | |
} | |
return $customer_id; | |
}, 10, 4 ); | |
add_filter( 'gform_stripe_charge_authorization_only', function ( $authorization_only, $feed ) { | |
if ( rgars( $feed, 'meta/feedName' ) == 'Auto Pay Feed' ) { | |
return true; | |
} | |
return $authorization_only; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment