Hi Richard,
I agree that right now all I am sending is the metadata, and separately the email address. The customer does get created, but some of it’s account information is lacking, and manual entry is required every time to keep things straight.
Regarding the link to the gform_stripe_customer_id, I do have that implemented similarly (below).
Are you saying that there is a way to push the Name field to the Stripe dashboard, and also possibly the billing details there as well by making changes in the functions.php? Let me know if you have any feedback about below… Thanks.
//Gravity Forms - Capture card without charging => GF version 3.4
add_filter( 'gform_stripe_customer_id', function ( $customer_id, $feed, $entry, $form ) {
GFCommon::log_debug( __METHOD__ . '(): running.' );
if ( rgars( $feed, 'meta/transactionType' ) == 'product' && rgars( $feed, 'meta/feedName' ) == 'Credit Card Authorization' ) {
GFCommon::log_debug( __METHOD__ . '(): Working for feed ' . rgars( $feed, 'meta/feedName' ) );
$customer_meta = array();
$email_field = rgars( $feed, 'meta/receipt_field' );
if ( ! empty( $email_field ) && strtolower( $email_field ) !== 'do not send receipt' ) {
$customer_meta['email'] = gf_stripe()->get_field_value( $form, $entry, $email_field );
}
$metadata = gf_stripe()->get_stripe_meta_data( $feed, $entry, $form );
if ( ! empty( $metadata ) ) {
$customer_meta['metadata'] = $metadata;
}
$customer = gf_stripe()->create_customer( $customer_meta, $feed, $entry, $form );
GFCommon::log_debug( __METHOD__ . '(): Returning Customer ID ' . $customer->id );
return $customer->id;
}
return $customer_id;
}, 10, 4 );
add_filter( 'gform_stripe_charge_authorization_only', function ( $authorization_only, $feed ) {
if ( rgars( $feed, 'meta/feedName' ) == 'Credit Card Authorization' ) {
GFCommon::log_debug( __METHOD__ . '(): running for feed ' . rgars( $feed, 'meta/feedName' ) );
return true;
}
return $authorization_only;
}, 10, 2 );
add_filter( 'gform_stripe_charge_pre_create', function( $charge_meta, $feed, $submission_data, $form, $entry ) {
if ( rgars( $feed, 'meta/feedName' ) == 'Credit Card Authorization' ) {
GFCommon::log_debug( __METHOD__ . '(): running for feed ' . rgars( $feed, 'meta/feedName' ) );
$charge_meta['save_payment_method'] = true;
}
return $charge_meta;
}, 10, 5 );