Help understanding Sub Apps and how API calls work

I’m building an application that will eventually make use of Sub Apps. I’m using Stripe for payment subscriptions and also using Stripe connect for each company customer connected to my main account in Stripe. Each one of these connected accounts will be connected to it’s own sub app in Bubble. This should work fine, however, Webhooks in Stripe sends everything to a single endpoint for all accounts including connected accounts. That means that my main/parent application will receive the API calls that I need to have run backend flows in sub apps, or I need to run the API’s all in the main/parent app and update data in the databases of the connected accounts. Any idea how either of these would work? The webhook would have the specific connected accounts account number so I should know what sub app the call is intended for.

Also, when creating the sub apps, does all the API calls copy over and they just have a unique URL specific to the sub app that triggers them?

Sub apps are separate applications for all effects and purpose. They share logic but the dB_entries are different.

You could either have separate Stripe accounts that send pulses within their connected accounts … of you could have a common endpoint for your app-subapps constellation that cascades down the pulses to the respective subApps.

Hope the above makes sense :smiley:

Some of it makes sense. On the Stripe end, I don’t have any options to send Webhooks to URL’s specific to the Connected Sub Apps, they all just go to one Webhook URL. The issue is, how do I receive the Webhook to my main account URL and have it do the necessary DB updates in the Bubble Sub App databases? I either have to dynamically call API’s from the Main Bubble app to the Sub Apps or I have to dynamically redirect the DB updates from the Main Bubble app to the DB records in the Sub App’s. Not sure the latter is possible.

I guess I will have to wait until I get the first Bubble Sub app created to figure out the best method. Right now I’m thinking if I create a database with a cross reference of the Stripe Connect account and the URL of the Bubble Sub App, I can get the Webhook call, extract the valid parameters and then using the cross reference table, call the API in the Sub App, passing the Webhook parameter’s and update the DB records that way.

1 Like