Weweb firing multiple API calls

I’ve added a POST API that i’ve created in Xano through Collections. Then created a Workflow for a button that will call this API when a button element is clicked. As you can see from below, user will then be navigated to Stripe’s checkout page. The problem i’m having from below workflow is that after the first workflow (i.e. calling the API to Xano), it sends another API call. How do i fix this?

I’ve asked claude and it said to make sure to switch off Fetch Xano automatically which i’ve done but issue persists.

Thanks

Hi @gbab48018 I would like to help, but I do not understand the problem at all. This second call you are seeing where is the call going to? The same API endpoint in Xano?

So are you saying the problem is that on the click of a button you are getting TWO api calls to Xano instead of one? So that navigation to stripe is happening twice? Instead of once?

If that is the problem, then what you can do is setup that button click defensively:

  1. Make a variable of boolean type call it disableCheckout (set default to false)
  2. So for the first action in your workflow make it a change variable value action which sets disableCheckout to `true`
  3. Then below that but above that API call action, add a '“pass through condition” action (so the second action inside your workflow will be this pass through condition)
  4. Set the pass through condition to disableCheckout variable = true
  5. Then your API call to xano
  6. Then your navigation
  7. Then after the navigation action reset variable action and reset disableCheckout
  8. Find the trigger button (in the UI), bind the disabled property to disableCheckout variable

That’s it.

So what now happens is that even if the UI button is clicked twice (which often happens) it will only fire once per run, so unless that run ends a new button click cannot trigger the workflow.

I hope this addresses your issue, if this is not the issue you are facing, then you will need to provide better explanation of what the issue is, as I really can’t understand it beyond what I could gather. If you the issue persists, please provide a clearer explanation, and I or someone else may be able to help further. Cheers

Thanks AgentD. This is much appreciated. And yes, you understood my issue correctly, but it doesn’t seem to be a double click issue.

Workflows for the button ‘upgrade’ is created under the name Calling Stripe sessions api.

The workflow looks like the following. The action ‘Call XanoStripe API’ calls Xano’s endpoint named ‘sessions’. (This endpoint in turn calls a Stripe endpoint, and returns the Stripe checkout url along with other information to Weweb).

The URL information is binded and makes the page to navigate to that stripe checkout session page.

After you make a payment in stripe from below….

…and if you check the datatable in Xano for this transaction, you see two multiple sessions. One is the one that went through and updated by the webhook, but there’s another redundant one. Can you help me why this might be happening?

And FYI - when running this from Xano, there;s no issue. Thanks again!

Has anybody else experienced something like this?

Hey @gbab48018 :waving_hand:

Can you check if the “Stripe session API” collection in your project has “Fetch this collection automatically” enabled and, if it is, try disabling it and see if the issue persists?

Forgot to thank you guys Joyce and AgentD. it worked so thank you!!

2 Likes