Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Ask about Economy x IAP

Discussion in 'Economy' started by restush96, Jul 4, 2023.

  1. restush96

    restush96

    Joined:
    May 28, 2019
    Posts:
    130
    I want to make purchase from IAP then execute Real Money Purchase from Economy. I just confused how to handle error RedeemGooglePlayPurchaseAsync that make players not receiving purchased item.

    - So I use StoreController.InitiatePurchase(_id) code to purchase.
    - If purchase success it will have callback PurchaseProcessingResult IStoreListener.ProcessPurchase(PurchaseEventArgs purchaseEvent).
    - Where the default return value is PurchaseProcessingResult.Complete.
    - Then I need to send receipt to EconomyService.Instance.Purchases.RedeemGooglePlayPurchaseAsync(redeemArgs) based on this


    - In number 5, I need to change PurchaseProcessingResult.Pending. Then execute EconomyService.Instance.Purchases.RedeemGooglePlayPurchaseAsync(redeemArgs).
    - After task completed, then call StoreController.ConfirmPendingPurchase(args.purchasedProduct)

    However, if something bad happen when try to process RedeemGooglePlayPurchaseAsync like no internet, how to handle it? where I have StoreController.ConfirmPendingPurchase(args.purchasedProduct) in the end of line will make completed transaction. So maybe player not receiving items?

    Edit: It will automatically try purchase again when have internet! I try to make offline payment by enable air plane mode after successful payment from Google, then RedeemGooglePlayPurchaseAsync throw error because offline mode. So player already pay for the product, but not received it. After that I try restart my game and switch to online by disable air plane mode. Then it appears on initialized Google try automatically callback IStoreListener.ProcessPurchase for my last pending purchase. So it will automatically try purchase again when have internet.[/S]
     
    Last edited: Jul 7, 2023