@JeffDUnity3D
4.1.0 Release notes
IGooglePlayConfiguration.SetFetchPurchasesAtInitialize(bool);
IGooglePlayExtensions.RestorePurchases(Action<bool>);
Hi there! Could you clarify in which cases this feature is used?
@JeffDUnity3D
4.1.0 Release notes
IGooglePlayConfiguration.SetFetchPurchasesAtInitialize(bool);
IGooglePlayExtensions.RestorePurchases(Action<bool>);
Hi there! Could you clarify in which cases this feature is used?
Previously restore would occur automatically on Google upon IAP initialization. Now you can specify the timing https://docs.unity3d.com/Manual/UnityIAPRestoringTransactions.html
If I don’t call SetFetchPurchasesAtInitialize, What is default setting for SetFetchPurchasesAtInitialize?
If I call SetFetchPurchasesAtInitialize(false) then, Unity IAP doesn’t call automatically ProcessPurchase for RestoreProduct on initialize timing. Is it right?
What about Pending Purchase? I think PendingPurchase need to specify the timing as well. It called automatically on initialize
Got it! I don’t think there is a way to distinguish the two.
So, Could you add an API to new version
Hope that I can get RestoreProducts and PendingProducts though other API instead of ProcessPurchase.
It must be uncomfortable to distinguish each other…
Plz we need some clarification!
There does not look to be an API. They always come through ProcessPurchase. However, you can manually inspect the receipt, and look at the purchaseState property. Restored products should have value of 1, Pending 2.
Yeah I already inspected receipt manually, but It’s wired that UnityIAP supports only RestoreProduct API.
And, Pending purchaseState is 0, not 2.
According to this, Pending = 2 Purchase.PurchaseState | Android Developers. We are a pass-through service for the Google Billing API v3. Which specific API are you referring to? And we do support Pending. If a product is in Pending state, ProcessPurchase will be called.
Thanks to share the link. I read the document. But, The PurchaseState I saw on test was 0.
(I pend the product then did not confirm it.)
What does exactly mean UNSPECIFIED_STATE ?
I know UnityIAP support Pending. But There is only way to inspect manually the receipt.
Otherwise, IGooglePlayExtensions.RestorePurchases can control the timing and doesn’t have to inspect something.
I suggest an API which is able to control PendingProducts.
For example IGooglePlayExtensions.HandlePendingPurchases.
And
IGooglePlayExtensions.GetPurchaseState(Product product) or IGooglePlayExtensions.IsPendingProduct(Product product) for distinguish product from ProcessPurchase
Here is my sample code.
At first, I pend the product. then reboot the app, I checked the product from ProcessPurchase after Initialize UnityIAP.
As you know, Google Document said pending is 2.
I expected 2 as well. But purchaseState still is 0.
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
ValidatePurchase(args.purchasedProduct); // Backend validation
return PurchaseProcessingResult.Pending;
}
I don’t think I’m following your issue. So you are saying purchaseState = 0 is behaving as Pending? What if you just make that assumption? And where are you calling ConfirmPendingPurchase? You are welcome to call those extension methods, this may help Google Play IAP Problem and Unity - Scripting API: Purchasing.IStoreController.ConfirmPendingPurchase
Plz answer it
You mean UNSPECIFIED_STATE? That is a Google status, we just pass it along. Hopefully they will make it more clear with Google Billing Library v4 coming out soon.
Thanks to your answer.
I read another document said like this.
The purchase state of the order. Possible values are: 0. Purchased 1. Canceled 2. Pending
So, I thought if the receipt string came from Google API Server, ‘0’ may mean ‘Purchased’.
What is the right thing? Here is the document link.
https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products
Agreed, Google has been a bit confusing. I have not seen this link.