jhal
September 11, 2021, 5:04pm
1
Hello. I am getting the following error: “POST https://api.twitch.tv/v5/bits/extensions/is-eligible/0001 401” when trying to use twitch.bits.useBits. Here “0001” is the SKU of my first product.
I am doing local testing in the developer rig and my code is as follows:
twitch.onAuthorized(function (auth) {
twitch.bits.getProducts().then(function (products) {
twitch.rig.log(products);
$('#send').click(function () {
if (!twitch.features.isBitsEnabled) { return twitch.rig.log(" bits not enabled") };
twitch.bits.useBits(products[0].sku); //401 error
});
});
});
getProducts appears to be working perfectly well; the products are displayed as expected in the console. The bits enabled flag is passing. When I click on the “send” button the first time, the 401 error appears. On subsequent clicks, the error does not appear. In all cases (when the send button is pushed), no bits UI is popping up. As I understand it, a bits UI should pop up when I click the send button if everything is working correctly.
This would suggest that the channel you are testing on doesn’t allow bits to be used.
Or you are testing this in the rig (noting the presented of twitch.rig.log), and the rig doesn’t have a real user/balance to utilise useBits with
This post
We know how important having a high quality monetization experience is for your Twitch Extensions. To help you ship monetized Extensions with a higher degree of confidence, we’re making it easier to test Bits in Extensions on your own channel. Developers can now activate Bits-enabled Extension versions that are in a testing state on their own channel without needing Partner or Affiliate status and Bits used in the Extension won’t be deducted from their wallet. Please note that if you are trying …
has some guidance on testing bits in extensions.
1 Like
jhal
September 11, 2021, 5:12pm
3
ah, so usebits just flat out will not work in the rig? I am using the rig, so I guess this is the problem
In the rig you would need to use
setUseLoopBack
function
Extensions Reference
To “trigger” a success for test purposes when using useBits
in the rig
1 Like