Search Unity

User's purchase success, but OnPurchaseFailed() is called

Discussion in 'Unity IAP' started by YujenDev, Dec 27, 2018.

  1. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    On the chance that you are able to reproduce, can you provide the device logs? https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/
     
  2. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    Yes, in our tests we weren't able to reproduce it, it seems to be happening to players and it's not consistent for the players as well (thank god!)
     
  3. eladleb4

    eladleb4

    Joined:
    Apr 25, 2016
    Posts:
    57
    We had encountered yet another purchase failure, with the player stating he was using his home WiFi connected via fiber,
    selected the "1-tap buy", provided fingerprint for verification, then it confirmed. However, when the player got back to the game it said failed."

    It doesn't sound like it's a network issue...
    Could that be something with a different unity component in the process? Maybe a report to a Unity Analytics backend which returns an error?
    Or a transaction verification failure which isn't supposed to fail?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Have you tested using fingerprint verification? The stores may return User Cancelled in the purchase flow if anything interrupts or puts up a separate dialog (even during the native purchase flow)
     
  5. dmitry_k_playtika

    dmitry_k_playtika

    Joined:
    Jun 14, 2019
    Posts:
    2

    Hello

    faced the same problem: users gives us purchase receipts, BUT in our analytics and in logs we see that unity purchasing returns :

    iOS
    [ message: APPLE_Cannot connect to iTunes Store : SKErrorPaymentCancelled ],[ reason: UserCancelled ],[ productId: boardkings_special_package_2 ]


    Android
    [ message: GOOGLEPLAY_1:User Canceled (response: 1:User Canceled) : BILLING_RESPONSE_RESULT_USER_CANCELED ],[ reason: UserCancelled ],[ productId: boardkings_bundle_20 ]


    where
    message => failureDescription.message
    reason => failureDescription.reason
    productId => failureDescription.productId

    and failureDescription received from ITransactionHistoryExtensions.

    Do you have any progress in investigation of this issue?
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No updates yet, we haven't been able to reproduce. Can you confirm if these users are using fingerprint, faceID or other secure login? Our theory is that perhaps such a login dialog that pops up can cause the store API's to return UserCancelled, and we pass along the status.
     
  7. CybIam

    CybIam

    Joined:
    Nov 6, 2016
    Posts:
    57
    Hello,

    On iOS I recently hit similar(?) bug: if user account has no payments method selected the OS asks him to provide one. After completing all necessary steps a message box appear that purchase is successfull but returning to game I've got error message that purchase is failed and right away another message that purchase is successfull. Unfortunately this was an unlogged session so no logs are available. Tested on real device with real account.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Thanks for the tip! This is good information.
     
  9. matveev_nv

    matveev_nv

    Joined:
    Nov 7, 2018
    Posts:
    2
    Hi, I have same issue:

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:10.950 23842-23882/? I/Unity: IAP _ start initializing

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:10.968 23842-23882/? I/Unity: UnityIAP Version: 1.17.0

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:11.121 23842-23882/? I/UnityIAP: IAB helper created.
    2020-03-02 16:33:11.277 23842-23882/? I/UnityIAP: Starting in-app billing setup.
    2020-03-02 16:33:11.278 23842-23882/? I/Unity: IAP _ end initializing

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:11.288 23842-23842/? I/UnityIAP: Billing service connected.
    2020-03-02 16:33:11.289 23842-24079/? I/UnityIAP: invoking callback
    2020-03-02 16:33:11.290 23842-24079/? I/UnityIAP: Checking for in-app billing 3 support.
    2020-03-02 16:33:11.295 23842-24079/? I/UnityIAP: In-app billing version 3 supported for com.matveev_nv.SuperBlasterBall
    2020-03-02 16:33:11.297 23842-24079/? I/UnityIAP: Subscriptions AVAILABLE.
    2020-03-02 16:33:11.299 23842-24079/? I/UnityIAP: VR supported.
    2020-03-02 16:33:11.300 23842-24079/? I/UnityIAP: onIabSetupFinished: 0
    2020-03-02 16:33:11.300 23842-24079/? I/UnityIAP: Requesting 1 products
    2020-03-02 16:33:11.300 23842-24079/? I/UnityIAP: QueryInventory: 1
    2020-03-02 16:33:11.301 23842-24079/? I/UnityIAP: invoking callback
    2020-03-02 16:33:11.301 23842-24079/? I/UnityIAP: Querying owned items, item type: inapp
    2020-03-02 16:33:11.301 23842-24079/? I/UnityIAP: Package name: com.matveev_nv.SuperBlasterBall
    2020-03-02 16:33:11.301 23842-24079/? I/UnityIAP: Calling getPurchases with continuation token: null
    2020-03-02 16:33:11.306 23842-24079/? I/UnityIAP: Owned items response: 0
    2020-03-02 16:33:11.306 23842-24079/? I/UnityIAP: Continuation token: null
    2020-03-02 16:33:11.307 23842-24079/? I/UnityIAP: Querying SKU details.
    2020-03-02 16:33:11.321 23842-24079/? I/UnityIAP: Querying owned items, item type: subs
    2020-03-02 16:33:11.321 23842-24079/? I/UnityIAP: Package name: com.matveev_nv.SuperBlasterBall
    2020-03-02 16:33:11.321 23842-24079/? I/UnityIAP: Calling getPurchases with continuation token: null
    2020-03-02 16:33:11.325 23842-24079/? I/UnityIAP: Owned items response: 0
    2020-03-02 16:33:11.325 23842-24079/? I/UnityIAP: Continuation token: null
    2020-03-02 16:33:11.325 23842-24079/? I/UnityIAP: Querying SKU details.
    2020-03-02 16:33:11.337 23842-24079/? I/UnityIAP: onQueryInventoryFinished: true
    2020-03-02 16:33:11.337 23842-24079/? I/UnityIAP: Inventory refresh successful. (response: 0:OK)
    2020-03-02 16:33:11.393 23842-23882/? I/Unity: IAP OnInitialized: PASS

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:11.394 23842-23882/? I/Unity: IAP OnInitialized: PASS m_StoreController

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:11.411 23842-23882/? I/Unity: UnityIAP: Promo is ready

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:17.315 23842-23882/? I/Unity: IAP Purchasing product asychronously: '1000'

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:17.321 23842-23882/? I/UnityIAP: onPurchaseProduct: 1000
    2020-03-02 16:33:17.322 23842-23882/? I/UnityIAP: ITEM TYPE:inapp
    2020-03-02 16:33:17.337 23842-23882/? I/Unity: IAP _ BuyConsumable

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
    2020-03-02 16:33:17.342 23842-23882/? I/UnityIAP: isUnityVrEnabled = false
    2020-03-02 16:33:17.423 23842-23842/? I/UnityIAP: Creating purchase activity
    2020-03-02 16:33:17.424 23842-24079/? I/UnityIAP: invoking callback
    2020-03-02 16:33:17.424 23842-24079/? I/UnityIAP: Constructing buy intent for 1000, item type: inapp
    2020-03-02 16:33:17.435 23842-24079/? I/UnityIAP: Launching buy intent for 1000. Request code: 999
    2020-03-02 16:33:23.184 23842-23842/? I/UnityIAP: onActivityResult
    2020-03-02 16:33:23.184 23842-23842/? I/UnityIAP: Successful resultcode from purchase activity.
    2020-03-02 16:33:23.184 23842-23842/? I/UnityIAP: Purchase data: {"orderId":"GPA.3347-1427-3750-05461","packageName":"com.matveev_nv.SuperBlasterBall","productId":"1000","purchaseTime":1583155993157,"purchaseState":0,"purchaseToken":"pdoajbemndcbjphplnbgnamh.AO-J1OxMvEVm0Umc09WJjhgKCTMdocbfVkQhR_JnU_0bnHVHhJVlEAsgLj8tNb0v3CFuhs7Qpk69LD8G7wBnxivqqFPuqhdxi7ii6s0CMywD43wGUOtz9VzHGzB6AAH_L8k7V0GuF_xD"}
    2020-03-02 16:33:23.184 23842-23842/? I/UnityIAP: Data signature: ZnlxNk2aVbM8TPHabCe0e3keI1MzCcApY/1PqZjk9SkPVJhtPXnYXA+ooLrmaeI56roK2L6s9H4U/oh+GzW+fYtrMaMF1+zvo9aawidBs8aFwsfxQw1ZeX+rO9m0UA9hhyHBtje3Y4MwA8i2POjjudlJ5vR/bbbkz9qrFIM54gpj1sHD8Ajys8GDUc64hNoKfwsCdxG8vR0UPJ3QExkzRqBDntdSaVZtdZZvP8ibq//jT24MS3julFgFz5Q9FgWe/sRp7CxEw7/Dg/S5r+c/loRWIb9JReo7uaceKoAFDja9ioPXKOXUlNBmpEyudVZpin/Sa1fyGANDAhlXEKW6cQ==
    2020-03-02 16:33:23.184 23842-23842/? I/UnityIAP: Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"GPA.3347-1427-3750-05461","packageName":"com.matveev_nv.SuperBlasterBall","productId":"1000","purchaseTime":1583155993157,"purchaseState":0,"purchaseToken":"pdoajbemndcbjphplnbgnamh.AO-J1OxMvEVm0Umc09WJjhgKCTMdocbfVkQhR_JnU_0bnHVHhJVlEAsgLj8tNb0v3CFuhs7Qpk69LD8G7wBnxivqqFPuqhdxi7ii6s0CMywD43wGUOtz9VzHGzB6AAH_L8k7V0GuF_xD"}, INAPP_DATA_SIGNATURE=ZnlxNk2aVbM8TPHabCe0e3keI1MzCcApY/1PqZjk9SkPVJhtPXnYXA+ooLrmaeI56roK2L6s9H4U/oh+GzW+fYtrMaMF1+zvo9aawidBs8aFwsfxQw1ZeX+rO9m0UA9hhyHBtje3Y4MwA8i2POjjudlJ5vR/bbbkz9qrFIM54gpj1sHD8Ajys8GDUc64hNoKfwsCdxG8vR0UPJ3QExkzRqBDntdSaVZtdZZvP8ibq//jT24MS3julFgFz5Q9FgWe/sRp7CxEw7/Dg/S5r+c/loRWIb9JReo7uaceKoAFDja9ioPXKOXUlNBmpEyudVZpin/Sa1fyGANDAhlXEKW6cQ==, RESPONSE_CODE=0}]
    2020-03-02 16:33:23.185 23842-23842/? I/UnityIAP: Expected item type: inapp
    2020-03-02 16:33:23.185 23842-23842/? I/UnityIAP: onIabPurchaseFinished: true
    2020-03-02 16:33:23.185 23842-23842/? I/UnityIAP: Success (response: 0:OK)
    2020-03-02 16:33:23.185 23842-23842/? I/UnityIAP: Product purchased successfully!
    2020-03-02 16:33:23.185 23842-23842/? I/UnityIAP: NotifyUnityOfPurchase
    2020-03-02 16:33:23.292 17436-17483/? I/GameTools: DreamToolsEventMgr : onGameResume AppInfo loading completed. {com.matveev_nv.SuperBlasterBall:testIAP:23842:10738:0}
    2020-03-02 16:33:23.752 23842-23882/? I/Unity: IAP ProcessPurchase: FAIL. Unrecognized product: '1000'
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    That looks like code in your ProcessPurchase, not onPurchaseFailed. Can you share your code? Product is named "1000", could you compare to an alpha-only product name, as a test? And it shows your app resuming (onGameResume), not sure if relevant. And please test with IAP 1.23.1
     
  11. matveev_nv

    matveev_nv

    Joined:
    Nov 7, 2018
    Posts:
    2
    I checked with IAP 1.23.1 and with alpha-only product name - the same story.
    (In GP - purchase was done, and money was withdrawn from card).
    The same issue with Purchase of NonConsomuble item - after success purchase - Failed msg came, but CheckBuyState method for this item return "true"
     

    Attached Files:

  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You have additional delegate callbacks that I would not be familiar with. Please test with the Sample IAP project to compare, the issue looks limited to your code. Also, I suspect it may be due that you are calling Initialize during Awake, you should not do that. You want to initialize IAP only once in your game, as a singleton.
     
  13. Say-Chimp

    Say-Chimp

    Joined:
    Jul 16, 2019
    Posts:
    17
    Given the case that this might happen, are there any workaround or suggested ways to fix this?
    Recently ran into this issue where some user makes a purchase, and did not receive their stuff. They are billed.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are in discussions with Google regarding their Google Billing library on this issue. We are working on the next version of Unity IAP which should include an updated library
     
    Say-Chimp likes this.
  15. TJClifton_StickSports

    TJClifton_StickSports

    Joined:
    Aug 20, 2018
    Posts:
    6
    Hi @JeffDUnity3D, is there any information on when this update will be available (weeks, months, a year etc.)? I have previously made a similar post (https://forum.unity.com/threads/unable-to-test-google-play-slow-card-payments.782006/) and we struggle with slow payments and having no way to test the user flow without the updated Google Billing library.

    Due to the high volume of complaints in India, which has become a core market for us and makes heavy use of the slow payments, we may have to look at writing our own wrapper around the library for Android if the integration is still some time away (The comment in the thread i made was from January suggesting the same thing that the Billing library would be coming in an updated library...)
     
  16. carldevelopsforcoffee

    carldevelopsforcoffee

    Joined:
    Sep 20, 2017
    Posts:
    19
    Still getting the same issue on Unity 2019.4.21f1. On our case, a player does a purchase (for product A) successfully, and a few seconds later does the purchase again where it fails but the player has been charged. So basically unity called OnPurchaseFailed after repurchasing (product A).
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What version of IAP are you using? Please provide specific steps to reproduce with IAP 3.0.1