# Needing a snippet that activates Switch with a transaction

**URL:** <https://forums.unrealengine.com/t/needing-a-snippet-that-activates-switch-with-a-transaction/2720666>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [May 7, 2026, 7:16pm UTC](https://forums.unrealengine.com/t/needing-a-snippet-that-activates-switch-with-a-transaction/2720666 "2026-05-07T19:16:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WPG-Hero](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/wpg-hero/32/1194603_2.png) [@WPG-Hero](https://forums.unrealengine.com/u/WPG-Hero)\
**Post date:** [May 7, 2026, 7:16pm UTC](https://forums.unrealengine.com/t/needing-a-snippet-that-activates-switch-with-a-transaction/2720666/1 "2026-05-07T19:16:45Z")

</div>

I am VERY inexperienced with Verse. So, I was wondering if I could have some assistance.

I’m looking for a device that contains an In-Island Transaction that keeps a Switch on when owned, and off when unowned.  
I can probably change metadata for the transaction itself without help (e.g. name, description, price), but I need a base to go off of.

Thanks!

---

<div class="post-metadata">

**Author:** ![Abrizzer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abrizzer](https://forums.unrealengine.com/u/Abrizzer)\
**Post date:** [May 8, 2026, 1:54am UTC](https://forums.unrealengine.com/t/needing-a-snippet-that-activates-switch-with-a-transaction/2720666/2 "2026-05-08T01:54:36Z")

</div>

Hello! I have not worked with entitlements, but based on the API and a quick test, this seems to work. You can purchase something and return it with the debug commands to test.

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Fortnite.com/Marketplace } 
using { /Verse.org/Assets }

#This will be the base entitlement for all in the island.
my_island_entitlement := class<abstract><castable>(entitlement){}

entitlement_switch_device := class(creative_device):

    @editable
    Switch : switch_device = switch_device{}
    @editable
    EntitlementType : subtype(my_island_entitlement) = false

    OnBegin<override>():void=
        Playspace := GetPlayspace()
        Playspace.PlayerAddedEvent().Subscribe(OnPlayerAdded)
        for(Player : Playspace.GetPlayers()):
            OnPlayerAdded(Player)

    OnPlayerAdded(Player:player):void=
        GetEntitlementsChangedEvent(Player, EntitlementType).Subscribe(OnEntitlementChange)
        spawn. CheckEntitlement(Player)

    CheckEntitlement(Player:player)<suspends>:void=
        EntitlementsPurchased := GetPurchasedEntitlements(Player,EntitlementType)
        for(EntitlementTuple : EntitlementsPurchased, CastResult := EntitlementType[EntitlementTuple(0)], Amount := EntitlementTuple(1) > 0):
            Switch.TurnOn(Player)#Cast was successful and player has 1 or more.
            return
        Switch.TurnOff(Player)#No match turn off

    OnEntitlementChange(Player:player, EntitlementsChanged:[]entitlement_change(my_island_entitlement)):void=
        for(EntitlementChanged : EntitlementsChanged, CastResult := EntitlementType[EntitlementChanged.Entitlement]):
            #We have a match, now Check quantity
            if(EntitlementChanged.Quantity > 0):
                Switch.TurnOn(Player)
            else:
                Switch.TurnOff(Player)
            return #No need to keep going.

```

I will leave 2 extra links I used for this:  
Best Practices:  
[In Island Transactions Best Practices and Debugging in Fortnite | Fortnite Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/fortnite/in-island-transactions-best-practices-and-debugging-in-fortnite#testinganddebuggingyourentitlements)  
Creating Items:  
[Creating Items and Offers in Fortnite | Fortnite Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/fortnite/creating-items-and-offers-in-fortnite#creating-a-consumable-entitlement-in-verse)

Hope it helps!
