Broadcasting Error after Bits Transaction

Hi there!

I have a problem with my extension and am not sure, whether it is a bug in Twitch Extension Helper, or if it is my responsibility to fix the behaviour in my extension.

On my channel, I’ve installed 3 versions of my panel extension: a private version, which is only available to me (left one in the picture); a private beta version, which is only available to beta testers (middle one in the picture); and a public (live) version, which is available to everyone (right one in the picture). Each of this version loads its own Twitch Extension Helper and registers a callback function when completing a Twitch Bits transaction.

The problem is, that after using Twitch Bits and completing a transaction in one of the versions, the callback function is called on all 3 of them. Resulting in getting the bought product 3 times instead of only once.

My final question would now be, whether this is indeed a bug in Twitch Extension Helper, calling the callback function in 3 different iframes for the same Twitch Bits transaction, even though it should only call it in the iframe, which triggered the Twitch Bits transaction; or if it is accepted behaviour and I must prevent this behaviour within my extension?


Broadcasting is for all of my Twitch Bits products deactivated (see second picture).


Extension Transactions happen externally to the Extensions iframe, so when a transaction happens the receipt is sent to ALL instances of that extension, on that channel, with that user (or all users if set to Broadcast).

This means that even if you only had 1 Extension installed, you’d still experience the same thing if you opened the channel in multiple tabs, as each tab on that same channel with the same user logged in will get a receipt.

This is just how Extensions work, and you’ll need to de-dupe accordingly. For example if you have an EBS you’d drop all duplicate transaction IDs. For the front-end you could set up a variable that is ‘true’ when a client uses useBits, and then when it receives onTransactionComplete it checks if that variable is true, and if it’s not it just discards it. This does unfortunately leave a very rare edge case where a user could open up multiple tabs (or have multiple of the same Extension running if they have access to an in-testing Extension as well as live) and opens up the useBits dialog on multiple instances of the extension, as there’s no way to know which instance was the one to actually complete the useBits flow.

1 Like

Thanks for your answer. That’s exactly what I wanted to know.

It’s sad this rare edge case exists. Is there any solution to it?

Unfortunately there’s no solution. All we as Extension developers will see is that user x on channel y made a transaction, but it’s impossible to know what specific instance completed the transaction if the user has multiple open.

It’s been an issue since monetization in Extensions went live, and the solution I’ve always suggested was to allow Extension devs to be able to optionally pass a state param to useBits as well as the SKU that would then be returned in the receipt. If that was ever to be implemented you could randomly generate a string to use as state, then compare it to the state in the receipt and if it doesn’t match it must be from a different instance. I’ve not heard of any movement on this issue though so for now it’s just a case of mitigating it as much as possible (such as flipping a boolean variable when useBits is used, which will at least let you rule out any instances that haven’t ran useBits)

1 Like

Depending on what you are doing. You could wait for the transaction with eventsub then push that out to the extension instance instead of the other way around if that works. That way you only get the transaction once then react to it.