In my Stripe feed settings, I’m mapping the billing information fields to an Address field used to collect the billing address.
Because the client home address can be different, I have a second field to collect the home address. So I decided to use the GF functionnality for Address field that can copy values from the home address field to the billing one. Unfortunately, some elements are not working.
1- When I check “Activated by default” in the address field options, it doesn’t work. The “Same as home address” checkbox remains unchecked and the fields are displayed in the form.
2- When I’m testing the form submission and I check “Same as home address” checkbox to tell GF that home address has to be the billing address, Stripe receives empty billing details values. It seems like GF is not filling the billing address field with the home address values on submit.
So I’ve discovered the gform_stripe_charge_pre_create filter that could possibly solve my problems by forcing Stripe to pick the home address values. So I’ve came with this piece of code, that unfortunately doesn’t work :
function stripe_charge_pre_create( $charge_meta, $feed, $submission_data, $form, $entry ) {
if(rgar($entry, '33.1') == "1") {
$charge_meta['billing_details']['address']['city'] = rgar($entry, '5.3');
$charge_meta['billing_details']['address']['country'] = rgar($entry, '5.6');
$charge_meta['billing_details']['address']['line1'] = rgar($entry, '5.1');
$charge_meta['billing_details']['address']['line2'] = rgar($entry, '5.2');
$charge_meta['billing_details']['address']['postal_code'] = rgar($entry, '5.5');
$charge_meta['billing_details']['address']['state'] = rgar($entry, '5.4');
}
return $charge_meta;
}
Can you help me to solve this please?