Bits Transaction API

I also added a idea https://twitch.uservoice.com/forums/310213-developers/suggestions/38056873-add-functionality-to-add-client-reference-id-in-th

It would be cool to have a option to add a client reference id when creating the transaction. This would allow me to link a transaction (before create the transaction flow) to a specific item by just using the method useBits() and the new webhook.

Currently I still have to use the onTransactionComplete. To link the item to the transaction. However, if the developer’s EBS experiences an outage, it is difficult to retroactively fulfill the benefits to viewers who have already spent Bits.

Example:

Here is an example using an item shop with virtual items & a SKU (because the price is always the same).

The EBS creates a transaction and stores it [Client Reference ID, SKU, Item ID, Twitch Transaction ID (nullable)].
The extension calls the useBits() method and passes there the SKU + created client reference ID from EBS.
3. user pays with bits.
4. the webhook is sent to EBS and the purchase process will be finished.

Cases that occur when a transaction is cancelled (this would be a refund case or cancellation of the transaction):

  • The SKU + Client Reference ID do not match. If the EBS checks them together.
  • The SKU + Client Reference ID has already stored a Twitch Transaction ID and does not match (double purchase).

Cases If they are OK:

  • SKU + Client Reference ID match. Twitch Transaction ID is still null in our DB, then the transaction can be assigned and the Twitch Transaction ID can be stored.

-> Item can be given to the player.