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

[Solved] What if the network disconnected while waiting response from 'Initiating Purchase'

Discussion in 'Unity IAP' started by theolovesyou, Jul 7, 2017.

Thread Status:
Not open for further replies.
  1. theolovesyou

    theolovesyou

    Joined:
    May 22, 2017
    Posts:
    5
    Actually Not 'InitiatePurchase',
    What if the network disconnected while waiting response after pushing the 'Purchase' Button.

    The document says my application will be notified asynchronously of the result, so what will be invoked? 'ProcessPurchase'? or 'OnPurchaseFailed' ?

    And what happened next if i try to buy same product again?
    Store will return 'PurchaseFailureReason.DuplicateTransaction'.
    Because store get a request and send a response to me,
    but i didn't get the response.

    What shall user do if he want to buy a product in this situation?
     
    Last edited: Jul 7, 2017
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @theolovesyou,

    If the network connection is lost before the request is sent to the store, then OnPurchaseFailed will be used.

    If the network connection is lost after the request is sent to the store and the purchase went through, then the Purchasing system will still have a record of the transaction and the next time the user starts the app, ProcessPurchase will be called.

    Yes, that will happen if they try to purchase the product again while there is an unfinished transaction for the same product. Users should be able to restart the app and that will allow the original purchase to go through correctly.
     
Thread Status:
Not open for further replies.