EvilMindDevs / hms-unity-plugin

The HMS Unity Plugin makes it easy to include Huawei Mobile Services into Unity-based games. Authentication, in-app purchases, push alerts, ads, and interaction with gaming services are just a few of the basic capabilities that this formidable tool makes available to your applications.
https://evilminddevs.gitbook.io/hms-unity-plugin/
305 stars 40 forks source link

Issue with IAP #495

Open GauravUMX612 opened 3 weeks ago

GauravUMX612 commented 3 weeks ago

We have integrated the HMS Evil Minds Plugin in our game, and we are encountering a significant issue with the In-App Purchases (IAP) functionality. When we initiate the IAP process to purchase a product, we do not receive any callback from the IAP plugin. This issue causes our game to get stuck, preventing users from receiving their rewards and completing the purchase process.

Steps to Reproduce:

Step1 : Integrate the HMS Evil Minds Plugin into a Unity project. Step2 : Implement the IAP functionality as per the documentation. Step3 : Attempt to purchase any product within the game. Step4 : Observe that no callback is received from the IAP plugin.

Expected Behavior: Upon initiating a purchase, the IAP plugin should return a callback indicating the success or failure of the transaction, allowing the game to proceed and the user to receive their rewards.

Actual Behavior: No callback is received from the IAP plugin, causing the game to hang and preventing the user from receiving their purchased rewards.

Environment:

HMS Evil Minds Plugin Version: 2.3.7 Unity Version: 2021.3.4f1

Additional Information:

We have verified that the IAP configuration and setup are correct as per the documentation. No errors or logs are generated when the issue occurs, making it difficult to diagnose the problem. Please investigate this issue at your earliest convenience, as it is critically affecting our game's user experience. If you require any further information or logs, we would be happy to provide them.

Thank you for your assistance.

github-actions[bot] commented 3 weeks ago

Thank you for reporting this issue/advice.

We will get back to you as soon as possible.
Would you like to star our plugin to support us? :sparkles:

Andronovo-bit commented 3 weeks ago

Hi, @GauravUMX612 , thank you for sharing problem clearly.

We tested our demo scenes, and we didn't face any problems.

1) You should enable the IAP Kit in Unity and the AG Connect Panel.

2) You should be sure to add the correct item ID and type

3) You should revise our IAP scenario. You can look at our demo scenes and scenerio.

4) You should be sure to initialize the IAP kit and register your callbacks "OnBuyProductFailure" and "OnBuyProductSuccess". Also, users have to sign in to buy any product.

5) We keep a log record that starts "HMS" in all kits. You can search using this keyword.

If you don't mind could share the log record? We can analyze your log record.

GauravUMX612 commented 3 weeks ago

Hello @Andronovo-bit thank you for Quick Response

I will Check out all Details provided and also create an Demo Project rather than main Project will share further logs or details here

GauravUMX612 commented 2 weeks ago

Hello @Andronovo-bit

I Created one Demo Project and I am Getting [HMSIAPManager]: Order Payment Failed for 2 time before getting Purchase Success Callback

Checkout Full Logs HMSIAPLogs.txt

Andronovo-bit commented 2 weeks ago

@GauravUMX612 Hi,

  1. HMSIAPManager.Instance.GetProductsList()
  2. HMSIAPManager.Instance.isUserOwnThisProduct(productId)

Maybe, you can try purchase operation after these methods.

GauravUMX612 commented 2 weeks ago

@Andronovo-bit Hello,

Then also getting same results and Logs For this time i also sending Code we are using checkout that and let us know if any changes required

HMSIAPLogs 13-06-2024.txt DomeCode.txt

Andronovo-bit commented 2 weeks ago

Hi @GauravUMX612 thanks for sharing your demo code and log records,

Can you look at this IAP flowchart ? I try to explain basically IAP scenerio.

DiagramIAP

Can you try to purchase after these steps in diagram ?

And also, I know before I said below things but can you check again ?

  1. Enable Account kit - IAP from kit settings. https://evilminddevs.gitbook.io/hms-unity-plugin/getting-started/quick-start/connect-your-game-with-the-hms-kit-managers
  2. Make sure you enabled IAP and Account kit services in the AppGallery console. https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/config-agc-0000001050033072#section382112213818
  3. Add These products to your project. (with same productID) https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/config-product-0000001050033076
  4. Add these products to IAP tab. Unity > Huawei > Kit Settings > IAP. Then click create constant classes
GauravUMX612 commented 1 week ago

Hello @Andronovo-bit Please Check I followed all the steps mentioned above and still getting same results here are the screenshots and logs image image HWLogs 24-06-2024.txt DemoCode 24-06-2024.txt

Andronovo-bit commented 1 week ago

Hi @GauravUMX612 ,

I guess, we have a some problems about after purchase status control mecanism.

Can you try below code changes in HMSIAPManager.cs file ?

image

Also callback is working. You can add "Debug.Log" in success("OnBuyProductSuccess") and failure("OnBuyProductFailure") methods on your demo code and you can see it on the android logcat.

GauravUMX612 commented 1 week ago

Hello @Andronovo-bit

The Purchase Failed and then Purchase Success Issue Solved by Updating Code as you mentioned But I need to verify the Plugin issue where it was not giving any response to the game and plugin getting crashed I will test that with our QA team and Let you Know Thank you