Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to restore canceled purchase by disconnected? (Android)

Discussion in 'Unity IAP' started by Daisuke19283, Jan 27, 2020.

  1. Daisuke19283

    Daisuke19283

    Joined:
    Aug 22, 2018
    Posts:
    5
    Hello.
    I have a question.

    The purchase fails if the network is disconnected at the moment of purchase.
    The reason for the failure seems to be User Canceled.
    But the fee will be paid money (I used test mode).

    1. Tap to purchase consumable product in game app.
    2. Tap the Google Play Billing's 1-TAP Buy button.
    3. Then, disconnect the network quickly.
    4. Purchase canceled. but paid money on google play purchase's order history...

    Is there a way to restore purchased items?


    Log

    // Purchasing some item...
    01-27 10:28:23.132 9144 9200 I UnityIAP: isUnityVrEnabled = false
    01-27 10:28:23.132 9144 9200 I UnityIAP: onPurchaseProduct: my_comsumable_product_1
    01-27 10:28:23.133 9144 9200 I UnityIAP: ITEM TYPE:inapp

    01-27 10:28:23.278 9144 9144 I UnityIAP: Creating purchase activity
    01-27 10:28:23.278 9144 9144 I UnityIAP: oldSkuMetadata is null
    01-27 10:28:23.279 9144 12647 I UnityIAP: invoking callback
    01-27 10:28:23.279 9144 12647 I UnityIAP: Constructing buy intent for my_comsumable_product_1, item type: inapp
    01-27 10:28:23.279 9144 12647 I UnityIAP: accountId is: ***
    01-27 10:28:23.279 9144 12647 I UnityIAP: pass accountId to GooglePlay for fraud detection, and accountId is: ***
    01-27 10:28:23.288 9144 12647 I UnityIAP: Launching buy intent for my_comsumable_product_1. Request code: 999

    // Disconect network quickly from google play purchasing process...
    01-27 10:28:52.937 9144 9144 I UnityIAP: onActivityResult
    01-27 10:28:52.938 9144 9144 I UnityIAP: Purchase data: null
    01-27 10:28:52.938 9144 9144 I UnityIAP: Data signature: null
    01-27 10:28:52.938 9144 9144 I UnityIAP: Purchase canceled - Response: 1:User Canceled
    01-27 10:28:52.938 9144 9144 I UnityIAP: onIabPurchaseFinished: false
    01-27 10:28:52.939 9144 9144 I UnityIAP: 1:User Canceled (response: 1:User Canceled)
    01-27 10:28:52.939 9144 9144 I UnityIAP: Purchase response code:1

    // Then call Initialize again.
    01-27 10:37:56.266 9144 9200 I UnityIAP: Requesting 6 products
    01-27 10:37:56.266 9144 9200 I UnityIAP: QueryInventory: 6
    01-27 10:37:56.266 9144 12647 I UnityIAP: invoking callback
    01-27 10:37:56.266 9144 12647 I UnityIAP: Querying owned items, item type: inapp
    01-27 10:37:56.266 9144 12647 I UnityIAP: Package name: com.mytest.company
    01-27 10:37:56.266 9144 12647 I UnityIAP: Calling getPurchases with continuation token: null
    01-27 10:37:56.272 9144 12647 I UnityIAP: Owned items response: 0
    01-27 10:37:56.273 9144 12647 I UnityIAP: Continuation token: null
    01-27 10:37:56.273 9144 12647 I UnityIAP: Querying SKU details.
    01-27 10:37:56.289 9144 12647 I UnityIAP: Querying owned items, item type: subs
    01-27 10:37:56.289 9144 12647 I UnityIAP: Package name: com.mytest.company
    01-27 10:37:56.289 9144 12647 I UnityIAP: Calling getPurchases with continuation token: null
    01-27 10:37:56.339 9144 12647 I UnityIAP: Owned items response: 0
    01-27 10:37:56.339 9144 12647 I UnityIAP: Continuation token: null
    01-27 10:37:56.339 9144 12647 I UnityIAP: Querying SKU details.

    01-27 10:37:56.362 9144 12647 I UnityIAP: Querying owned items' purchase history, item type: subs
    01-27 10:37:56.362 9144 12647 I UnityIAP: Package name: com.mytest.company
    01-27 10:37:56.362 9144 12647 I UnityIAP: Calling getPurchaseHistory with continuation token: null
    01-27 10:37:56.565 9144 12647 I UnityIAP: Purchase history response: 0
    01-27 10:37:56.565 9144 12647 I UnityIAP: Continuation token: null
    01-27 10:37:56.565 9144 12647 I UnityIAP: Querying owned items' purchase history, item type: inapp
    01-27 10:37:56.565 9144 12647 I UnityIAP: Package name: com.mytest.company
    01-27 10:37:56.565 9144 12647 I UnityIAP: Calling getPurchaseHistory with continuation token: null
    01-27 10:37:56.802 9144 12647 I UnityIAP: Purchase history response: 0
    01-27 10:37:56.805 9144 12647 I UnityIAP: Continuation token: null
    01-27 10:37:56.806 9144 12647 I UnityIAP: onQueryInventoryFinished: true
    01-27 10:37:56.806 9144 12647 I UnityIAP: Inventory refresh successful. (response: 0:OK)
    01-27 10:37:56.809 9144 12647 I UnityIAP: invoking callback[/code]


    -----------
    Unity IAP version = 1.23.1
    Unity version = 2018.4.0.f1
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Restore would happen when the user reinstalls the app. Is the product in the receipt in the store controller list of products?
     
  3. Daisuke19283

    Daisuke19283

    Joined:
    Aug 22, 2018
    Posts:
    5
    Thank you for reply.

    > Restore would happen when the user reinstalls the app.

    I tried it but did not get the expected result.
    It was not restored.

    > Is the product in the receipt in the store controller list of products?

    The receipt of product list is empty.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are investigating this behavior.
     
  5. Daisuke19283

    Daisuke19283

    Joined:
    Aug 22, 2018
    Posts:
    5
    Thank you very much for investigation.
    Any update about this?
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are hoping to include this update in the next release, hopefully in a few weeks.
     
  7. Daisuke19283

    Daisuke19283

    Joined:
    Aug 22, 2018
    Posts:
    5
    Thank you very much.
    I will be waiting for update.