we encountered the situation that we receive same bits payment transaction-ids for two different payments.
It happens if you do the following:
- open our extension for the same channel-id as a viewer in two separate browser tabs (two different browsers windows works as well)
- complete the process in the extension for paying one action until twitch payment confirmation. Don’t press “confirm”
- ensure that you completed above process in both browser tabs/ windows
- confirm payment in both browser tabs/ windows
our EBS then receives two payments with exactly the same transaction ids.
For research, here are some of them:
Is this a Twitch bug or is it in our extension?
This is an issue with how the
onTransactionComplete() function is used.
When a user completes a transaction, Twitch calls the callback you provide to that helper function on all browser tabs open by that specific user on the specific channel where the transaction happened. This will mean that if you have multiple tabs open on the same channel and one makes an in-extension bits transaction they will all receive that transaction receipt.
This does cause some potential problems, as tabs may not be able to differentiate if the
onTransactionComplete() was called because of a purchase in that tab, or some other tab. The best thing you could do is to send all transactions to your EBS and let your EBS drop duplicates. This still leaves some window for error if you use the same product SKU for multiple in-extension products.
In RFC 0011 Twitch propose some changes, and some very useful additions, to this process so hopefully once that is fully implemented this will no longer be an issue.