Store API Integration - GameDistribution/gd-sdk-construct-3 GitHub Wiki
π§© Using GameDistribution Store API in Construct 3
You can integrate the GameDistribution Store API directly in your Construct 3 projects using the JavaScript scripting system. This allows you to access virtual items, currencies, cart actions, and inventory management seamlessly.
β 1. Enable JavaScript Scripting
To begin, make sure your project has JavaScript scripting enabled.
- Open your Construct 3 project.
- Go to the Scripts section in the Project panel.
- Create a new script file (e.g.,
store.js
).
π·
βοΈ 2. Using Store API in Your Script
After adding the script, you can use the GameDistribution Store API just like in a standard HTML5 project.
Hereβs an example of fetching store items:
const items = await gdsdk.executeStoreAction({ action: "api.items" });
console.log("Store items:", items);
To purchase a virtual product:
await gdsdk.executeStoreAction({
action: "api.buyProduct",
payload: {
sku: "ss-enhance-shield-5",
quantity: 1
}
});
π·
π Related Documentation
To see the full list of store API methods and usage patterns, visit the main HTML5 SDK documentation: