Getting Started with Moonshine Labs API
Moonshine Labs API - Getting Started Guide
Welcome to the Moonshine Labs API Getting Started Guide! In this tutorial, we will walk you through setting up your platform, creating and managing items, generating QR codes for purchasing, and checking order statuses. By the end of this guide, you should have a basic understanding of how to use the Moonshine Labs API for Solana Play.
1. Set up your platform
To create a new Solana Play platform, you'll need to make a POST request to the /platforms
endpoint. Make sure to fill in the required fields in the request body.
Request body:
Check here for the response examples: [response_example_link]
You will receive a platformId
, platCustPub
, and platformRefId
in the response. Make sure you keep them in a safe place, as you will need them later.
2. Create and manage items
Next, you'll need to create items that can be purchased on your platform. To do this, make a POST request to the /items/{platformId}
endpoint with your platformId
.
Request body:
Check here for the response examples: [response_example_link]
You can also update and delete items using the /items/{id}
endpoint with the respective HTTP methods (PUT, DELETE).
3. Generate QR codes for purchasing
To generate a QR code for purchasing an item, make a GET request to the /qr/{platformId}/{itemId}/{playerId}
endpoint with your platformId
, itemId
, and playerId
. Optionally, you can also include quantity
and payToken
parameters.
Check here for the response examples: [response_example_link]
The response will include a qrUrl
, qrRefId
, label
, image
, and link
. You can display the qrUrl
as a QR code on your platform, allowing users to easily purchase the item.
4. Check order status
After a user has scanned the QR code and completed the purchase, you can check the order status using the /orders/status/{id}
endpoint with the qrRefId
you received earlier.
Check here for the response examples: [response_example_link]
If the order is confirmed, you will receive a confirmed: true
value in the response, along with a message and transaction signature.
That's it! You now have a basic understanding of how to use the Moonshine Labs API for Solana Play. For more details, please refer to the complete API documentation.