This feature is used usually for situations when you need to restore purchased products for users.
1. FetchInventory
Use StovePC_FetchInventory to call inventory; inventory contain items that have been purchased. You can ship your product by using the purchased product list in the inventory.
Normally, games call the StovePC_ConfirmPurchase function to check the product purchase status and immediately ship the product, but if the information is lost due to an unexpected error or game reinstallation (or etc.), you can use inventory information for restoration.
StovePCResult result = StovePC_FetchInventory();
if(result == StovePCResult.NoError)
{
// handle success
}
C++
복사
If the StovePC_FetchInventory function is successfully processed, the OnFetchInventory callback is called.
The StovePCInventoryItem structure passed to the callback contains meta information about the purchased product.
•
StovePCInventoryItem.TransactionMasterNo: Transaction Master Number (Unique)
•
StovePCInventoryItem.TransactionDetailNo: Transaction Specific Detail Number
•
StovePCInventoryItem.ProductId: ProductID
•
StovePCInventoryItem.GameItemId: In-game item ID mapped to product ID
•
StovePCInventoryItem.ProductName: Product Name
•
StovePCInventoryItem.Quantity: Quantity of Individual Product
•
StovePCInventoryItem.ThumbnailUrl : Representative Product Image
void OnFetchInventory(const int size, StovePCInventoryItem* inventoryItems)
{
printf("OnFetchInventory");
printf(" - inventoryItem size = %d", size);
for (int i = 0; i < size; i++, inventoryItems++)
{
printf(" - inventoryItems[%d].transactionMasterNo: %lld", i, inventoryItems->transactionMasterNo);
printf(" - inventoryItems[%d].transactionDetailNo: %lld", i, inventoryItems->transactionDetailNo);
printf(" - inventoryItems[%d].productId: %lld", i, inventoryItems->productId);
printf(" - inventoryItems[%d].gameItemId: %s", i, inventoryItems->gameItemId);
wprintf(" - inventoryItems[%d].productName: %s", i, inventoryItems->productName);
printf(" - inventoryItems[%d].quantity: %d", i, inventoryItems->quantity);
printf(" - inventoryItems[%d].thumbnailUrl: %s", i, inventoryItems->thumbnailUrl);
}
}
C++
복사
If an error occurs while running the StovePC_FetchInventory function, the OnError callback is called.
External errors can be checked through the ExternalError field of the StovePCError structure.
ExternalError | Description |
500 | Internal Server Error |
999999 | undefined error |