Skip to content

Instantly share code, notes, and snippets.

@chrispian
Created January 28, 2019 23:54
Show Gist options
  • Save chrispian/ecf7d6795dd1e96f9ea1af226fe3c157 to your computer and use it in GitHub Desktop.
Save chrispian/ecf7d6795dd1e96f9ea1af226fe3c157 to your computer and use it in GitHub Desktop.
Gravity Form Stripe Tweaks
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