Hi,
It seems that I sometimes receive a purchaseFailedEvent after a successful purchase.
I first receive the ProcessPurchase event, I return PurchaseProcessingResult.Pending, then I validate the purchase server side, the payment is validated server side then I confirm the pending purchase.
After that I receive a purchaseFailedEvent. the log just before is:
onPurchaseFailedEvent(productId:xxxxxx message:Service connection is disconnected. {code: -1, M: GPSFTS.HFT})
This seems to happens only on Android (Google Play Store).
I use the In App Purchasing package 4.5.2
1 Like
Hello @BBO_Lagoon .
The code -1 is :
SERVICE_DISCONNECTED
The app is not connected to the Play Store service via the Google Play Billing Library.
Examples where this error may occur:
Since this state is transient, your app should automatically retry (e.g. with exponential back off) to recover from this error. Be mindful of how long you retry if the retry is happening during a user interaction. The retry should lead to a call to BillingClient.startConnection(BillingClientStateListener) right after or in some time after you received this code.
Constant Value: -1 (0xffffffff).
info from : BillingClient.BillingResponseCode | Android Developers
This looks familiar to your other bug .
In our next major release (5.0.0) our product and purchase services will have a connection check before making any calls, for now it looks like some of your users are losing connection to the playstore.
1 Like
Thanks for the clarification of the error but why is the on PurchaseFailed called when the ProcessPurchase is already called and the payment confirmed with a m_StoreController.ConfirmPendingPurchase call ?
Is it the m_StoreController.ConfirmPendingPurchase that triggers the PurchaseFailed ?
The problem is that when PurchaseFailed is called I show a message to the user that says the payment is not successful, so in this case there is first the message that says payment successful then right after a message that says payment failed… it’s not really nice for our users
For the next release I added a check to ignore the fail if the success was called before. But it would be better to not call the PurchaseFailed if the payment is successful on your side.
It is hard to exactly tell you why this situation comes up, are you able to reproduce this issue “on demand”, or have you any logs of the incident ?
I’m glad you have find a temporary work around the issue, while we find the source of your problem.
Hi,
I just saw this in the cloud diagnostic logs. Never got this on one of my devices.
The only logs I have is:
1 - InitiatePurchase
2 - ProcessPurchase → PurchaseProcessingResult.Pending
3 - Validation OK from my server → ConfirmPendingPurchase
4 - OnPurchaseFailed
In the log, the transaction ID is the same in ProcessPurchase and OnPurchaseFailed.
Hello @BBO_Lagoon , thanks for your feedback,
Is your product a subscription ?
OnPurchaseFailed with code : M: GPSFTS.HFT is thrown when we handle "finish transaction"and the GoogleBillingResponseCode is not OK : (SERVICE_DISCONNECTED in your case). and the max retry attempt have been reached.
It seems like the connection to the Google Play Store was lost between the purchase and the validation. In your case, Google is never receiving the finish transaction signal, so it still thinks the purchase is pending which is why we return the OnPurchaseFailed.
Like mentioned earlier in the thread, the purchase service in our next major release (5.0.0) will include a store connection state check before making any calls, this should fix your issue.
Hi,
No the product is not a subscription, the is no subscription in my game.
When did you plan to release the new version ?
Hi @BBO_Lagoon ,
The next major release (5.0.0) is planned to be pre-released within Q1, stay tuned!
1 Like