-
Notifications
You must be signed in to change notification settings - Fork 17
Store API Integration
serdarakay edited this page Jun 17, 2025
·
1 revision
GameDistribution HTML5 SDK now includes powerful Store API features. This guide explains how to open the store UI, retrieve virtual products and currencies, manage the cart and inventory, and handle user authentication using the gdsdk.executeStoreAction()
method.
- UI Control
- Fetch Store Data
- Inventory Management
- Cart Operations
- Product Purchase & Consumption
- User Authentication
- Store-Related Events
// Open the store UI
gdsdk.executeStoreAction({ action: 'ui.open' });
// Close the store UI
gdsdk.executeStoreAction({ action: 'ui.close' });
## π¦ Fetch Store Data
// Get virtual items
const items = await gdsdk.executeStoreAction({ action: 'api.items' });
// Get bundles
const bundles = await gdsdk.executeStoreAction({ action: 'api.bundles' });
// Get virtual currencies
const currencies = await gdsdk.executeStoreAction({ action: 'api.virtualCurrencies' });
// Get currency packages
const currencyPackages = await gdsdk.executeStoreAction({ action: 'api.virtualCurrencyPackages' });
## π Inventory Management
// Get inventory items
const inventoryItems = await gdsdk.executeStoreAction({ action: 'api.inventoryItems' });
// Get inventory currencies
const inventoryCurrencies = await gdsdk.executeStoreAction({ action: 'api.inventoryCurrencies' });
## ποΈ Cart Operations
// Add product to cart
await gdsdk.executeStoreAction({
action: 'api.addToCart',
payload: { sku: 'your-sku', quantity: 1 }
});
// Remove product from cart
await gdsdk.executeStoreAction({
action: 'api.removeFromCart',
payload: { sku: 'your-sku' }
});
// Update item quantity
await gdsdk.executeStoreAction({
action: 'api.updateCartItem',
payload: { sku: 'your-sku', quantity: 3 }
});
// Get current cart contents
const cart = await gdsdk.executeStoreAction({ action: 'api.getCurrentCart' });
// Clear cart
await gdsdk.executeStoreAction({ action: 'api.clearCart' });
// Purchase cart
await gdsdk.executeStoreAction({ action: 'api.buyCart' });
## πΈ Product Purchase & Consumption
// Buy a single product
await gdsdk.executeStoreAction({
action: 'api.buyProduct',
payload: { sku: 'your-sku', quantity: 1 }
});
// Consume an item from inventory
await gdsdk.executeStoreAction({
action: 'api.consume',
payload: { sku: 'your-sku', quantity: 1 }
});
## π User Authentication
// Get login info
const loginInfo = await gdsdk.executeStoreAction({ action: 'api.loginInfo' });
// Check if user is logged in
const isLoggedIn = await gdsdk.executeStoreAction({ action: 'api.isLoggedIn' });
// Login
await gdsdk.executeStoreAction({ action: 'api.login' });
// Logout
await gdsdk.executeStoreAction({ action: 'api.logout' });
Gamedistribution.com offers a free service for developers and publishers. We help game developers monetize and distribute their games. We offer publishers a wide range of high quality cross platform games.