Facepunch.Steamworks Wiki

Item Store Cart

image.png
// // Our cart item // public List<InventoryDef> Cart = new List<InventoryDef>(); public void Start() { // // Tell this callback to tell us when something has been purchased // SteamUser.OnMicroTxnAuthorizationResponse += OnPurchaseFinished; } // // Add an item to our cart // public void AddToCart( InventoryDef item ) { Cart.Add( item ); } // // Called when they want to check out // public async Task CheckoutAsync() { ShowPurchaseInProgressScreen(); // This tries to open the steam overlay to commence the checkout var result = await Steamworks.SteamInventory.StartPurchaseAsync( Cart.ToArray() ); Log( $"Result: {r.Value.Result}" ); Log( $"TransID: {r.Value.TransID}" ); Log( $"OrderID: {r.Value.OrderID}" ); } // // Called from the callback SteamUser.OnMicroTxnAuthorizationResponse // private void OnPurchaseFinished( AppId appid, ulong orderid, bool success ) { HidePurchaseInProgressScreen(); if ( success ) { // Purchase was successful } else { // They probably pressed cancel or something } }

Page Links


Special Pages


Wikis

?

Render Time: 20ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 9
Render Body 0
Render Sidebar 1