Using an EBS and Processing bits


#1

Hi everyone,

Our team is building a fairly complex extension which definitely requires a backend / EBS. We’re also going to be allowing the spending of bits in our extension. I completely understand that we cannot process bits on the backend, but what has my team concerned is this paragraph from the Twitch Bits in Extensions Guide and Reference PDF (sorry cannot find a link)

The operations described in this document take place exclusively in your extension’s front end. The initiation of
the purchase flow and the callback of a completed transaction form a complete flow of exchanging bits for
experiences. Currently, bits cannot be exchanged for actions or state changes that require backend support. If
you have an idea that requires interaction with your backend, please talk to your Integration Success Engineer.

This has been interpreted as “We cannot have an EBS (period) if we’re also processing Bits”.

Our plan is to give viewers the opportunity to cheer / donate their way into elevated positions within the extension. The front end of the extension will process the bits and then notify our EBS of which product SKU was purchased.

Can someone please help me confirm that we can both process Bits on the front end of the extension and also have an EBS?

Thank you


#2

Yes


#3

The basic workflow is:

  • You trigger a payment request in your front-end JS when the user does some interaction
  • User approves payment
  • Front-end JS gets a transaction complete message with verifiable payload
  • Send the payload to your EBS along with any other data that might be relevant to the event
  • Verify the transaction is legit on your EBS
  • Do the thing

#4

Perfect. Thank you.


#5

I couldn’t remember which parts of the docs where still under NDA or not. So I gave the safest answer. :stuck_out_tongue:


#6

:sweat_smile:


#7

The confirmation of bits contains a jwt which can be validated on the EBS with all relevant data, so so not worry it is very easy to confirm if it is a legit transaction.


#8

Hi @Seravy , thanks for your reply. I’m having a hard time finding any documentation on this. Is the bits payment / transaction information encoded within the JWT payload? Do I just decode it and use that info for verification? Are there any other steps or calls I can use for the EBS to verify the transaction was legit? Or is decoding the JWT and inspecting it all I need to do?
I appreciate your help :slight_smile:


#9

The Bits in Extensions program is still in closed beta and the documentation isn’t publicly available yet. You’ll need to get in touch with Twitch to request access.

See also:


#10

Appreciate that.


#11

As xzion says, It is not public yet but once it is i am happy to help.


#12

Hi !
Where can I get the jwt for the transaction ? It does not seem to be in the callback variable of onTransactionComplete.


#13

You have necro’ed a post from OVER a year ago.

You should of started a new issue.

You don’t get a JWT in onTransactionComplete in test purchases, only in a real purchase.


#14

This post seems to have some google visibility that’s why :wink:
How can I test a real purchase using developer rig ?
(My channel is not in Affiliate program)


#15

It is bad forum practice to necro a old post. as then it triggers notifications for everyone on the post

Testing is covered here

But you CANNOT test the JWT in onTransactionComplete as you only get it on a LIVE extension running on the Twitch Website. The JWT itself cannot be tested in the Developer rig.

As per the docs

you should use the setUseLoopBack function to test the compleition of a checkout flow. But you still won’t get a JWT in the onTransactionComplete as that on occurs for “live”


#16

Thank you.
I read the documentation and this post and I am indeed using useLoopBack but was hopping to get a test transaction jwt.
If I can not get a transaction jwt in a testing environment, how should I proceed to test my code which verifies a transaction jwt ?
I am sorry if I am still confused !


#17

To verify a JWT you send it from your Client code to your EBS and process it there. You can mock this yourself using the docs as a guide.


#18

Okay so I will mock a jwt myself and send it to my EBS, I get it. :slight_smile: Thanks.