1. Call Product Purchase Status
Use UMyStoveSDKObject::StoveSDKConfirmPurchase function. to call product purchase status
// 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::StoveSDKConfirmPurchase is successfully processed, the OnConfirmPurchase callback is called.
The FStovePurchaseProduct structure passed to the callback contains meta information about the purchased product, and the callback status parameter delivers the purchase status of the product.
•
FStovePurchaseProduct.TotalQuantity: Total Product sales quantity
•
FStovePurchaseProduct.MemberQuantity: Member purchase quantity
•
FStovePurchaseProduct.GuidQuantity: Guid purchase quantity (purchase quantity of product purchase subject [CharacterNo/Guid/MemberNo])
In the case of a game without a separate game server, if the purchase result is successful, the game may provide an item.
In the case of a game with a game server, the game server can receive a notification about the purchase and can provide the item at this time.
(To find more about purchase notification, click here)
void UMyStoveSDKObject::OnConfirmPurchase(int Size, FStovePurchaseProduct* PurchaseProducts, bool Status, FString ShopKey)
{
/*Add the 'walkthrough' codes here.*/
OnLog("[OnConfirmPurchase]");
OnLog(" Status : %s", Status ? TEXT("true") : TEXT("false"));
OnLog(" ShopKey : %s", *(ShopKey));
OnLog(" PurchaseProduct size : %d", Size);
for (int i = 0; i < Size; i++, PurchaseProducts++)
{
OnLog(" -> Index: %d", i);
OnLog("---------------------------------------------- --------");
OnLog(" CategoryId : %s", *(PurchaseProducts->CategoryId));
OnLog(" ProductId : %I64d", PurchaseProducts->ProductId);
OnLog(" TotalQuantity : %d", PurchaseProducts->TotalQuantity);
OnLog(" MemberQuantity : %d", PurchaseProducts->MemberQuantity);
OnLog(" GuidQuantity : %d", PurchaseProducts->GuidQuantity);
}
}
C++
복사
Reference
In the above sample code, FString shopKey in the function is the same value as YOUR_SHOP_KEY called by StoveSDKIAPInit function.
You need to send YOUR_SHOP_KEY with shopKey as an input parameter.
If an error occurs while executing UMyStoveSDKObject::OnConfirmPurchase function, OnError callback will be called.
External errors can be checked through the ExternalError field of the FStoveError structure.