1. FetchInventory
Use UMyStoveSDKObject::StoveSDKFetchInventory 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 UMyStoveSDKObject::StoveSDKFetchInventory 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.
// input parameters
// FString TransactionMasterNo : Unique transaction master number (obtained through OnStartPurchase callback parameter FStovePCPurchase.transactionMasterNo)
FStoveResult UMyStoveSDKObject::StoveSDKConfirmPurchase(const FString& TransactionMasterNo)
{
/*Add the 'walkthrough' codes here.*/
FStoveResult ErrorResult = Super::StoveSDKConfirmPurchase(TransactionMasterNo);
if (ErrorResult.Result == StovePCResult::STOVE_PC_NO_ERROR)
{
// handle success
}
return ErrorResult;
}
C++
복사
When the UMyStoveSDKObject::StoveSDKFetchInventory function is successfully processed, the OnFetchInventory callback is called.
The FStoveInventoryItem structure passed to the callback contains meta information about the purchased product.
•
FStoveInventoryItem.TransactionMasterNo: Transaction unique master number
•
FStoveInventoryItem.TransactionDetailNo: transaction specific detail number
•
FStoveInventoryItem.ProductId: ProductID
•
FStoveInventoryItem.GameItemId: In-game item ID mapped to ProductID
•
FStoveInventoryItem.ProductName: product name
•
FStoveInventoryItem.Quantity: Quantity of individual product
•
FStoveInventoryItem.ThumbnailUrl: Representative product image
void UMyStoveSDKObject::OnFetchInventory(int Size, FStoveInventoryItem* InventoryItems)
{
/*Add the 'walkthrough' codes here.*/
OnLog("[OnFetchInventory]");
OnLog("InventoyItem size : %d", Size);
for (int i = 0; i < Size; i++, InventoryItems++)
{
OnLog(" -> Index: %d", i);
OnLog("---------------------------------------------- --------");
OnLog(" TransactionMasterNo : %I64d", InventoryItems->TransactionMasterNo);
OnLog(" TransactionDetailNo : %I64d", InventoryItems->TransactionDetailNo);
OnLog(" ProductId : %I64d", InventoryItems->ProductId);
OnLog(" GameItemId : %s", *(InventoryItems->GameItemId));
OnLog(" ProductName : %s", *(InventoryItems->ProductName));
OnLog(" Quantity : %d", InventoryItems->Quantity);
OnLog(" ThumnailUrl : %s", *(InventoryItems->ThumbnailUrl));
}
}
C++
복사
If an error occurs with UMyStoveSDKObject::StoveSDKFetchInventory, OnErrorcallback will be called. External errors can be checked through the ExternalError field of the FStoveError structure.
ExternalError | Description |
500 | Internal Server Error |
999999 | undefined error |