Jump to content

Want to send billing address, shipping address to the formbuilderstripe checkout via hook


NFT
 Share

Recommended Posts

Hi Team
I am trying to send billing address and shipping address to the formbuilder stripe checkout via hook but it is not working.
Here's the code I am trying for setting billing address but on the stripe checkout page it is again showing the dropdown to select the billing address. 
Any suggestions!

  $wire->addHookAfter('FormBuilderProcessorStripe::getSessionOptions', function($e) {
            // Get the existing session options
            $sessionOptions = $e->return;
       
            // Add billing address collection to the session options
            $sessionOptions['billing_address_collection'] = 'required';
       
            // You can also specify allowed countries for billing address collection
            $sessionOptions['shipping_address_collection']['allowed_countries'] = ['US', 'CA'];
       
            // Set the modified session options
            $e->return = $sessionOptions;
        });

I also tried setting the line items with getLineItems hook and it is working fine. Here's the code for that as well.
In $stripeProductsArr I have stored the details of all the line items.

$wire->addHookAfter('FormBuilderProcessorStripe::getLineItems', function($e) use ($stripeProductsArr) {
                $e->return = $stripeProductsArr;
               });
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...