Search Unity

IAP restore issues (Android)

Discussion in 'Unity IAP' started by DanWeston, Mar 31, 2019.

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

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You don't want to be changing the product type between builds, it's likely not finding the corresponding receipt. Please test with the same APK across devices.
     
  2. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    77
    I'm not sure what you mean "changing the product type"? It is always set to ProductType.NonConsumable.
    These are my steps to reproduce
    A) Create a managed product IAP in the google play console
    B) Add the ID to my Purchaser script and define it as ProductType.NonConsumable
    C) Build the app from Unity to device and purchase the product
    D) Build the app from Unity to another device. App thinks I haven't purchased the product so purchase it again
    E) Confirm 2 purchases by viewing receipts from Google for same product with two different order numbers
    E) View log files from 2 devices and confirm different GPA order numbers from receipt returned by store controller.
    F) Wait until the next morning
    G) Build app to third device and notice the product has been purchased.
    H) View receipt logs from all 3 devices and notice receipt now is using same GPA Order number. Which is the one from the second purchase from the say before.

    I mean it is the middle of the night in the US when I'm testing (I'm in Australia) but that shouldn't matter should it?
     
    Last edited: Oct 31, 2019
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You had mentioned previously you had changed product type between device builds. Anyway, it sounds like an issue with the Google receipt process/timing, might you agree? Are you testing in Beta/Alpha test, using specified testers, downloading via Google Play?
     
  4. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    It's another user (Nananaaa) who said that, not him (prawn-star).

    Regarding multiple purchases of NonConsumable, I can confirm I am having these issues as well for months, with several players complaining. In some situations I even searched the player email myself and found 2 purchases of the same product. I even mentioned on this thread already if I recall correctly, I thought it was related to the bug of this thread, but it seems it still isnt fixed. If it's unrelated to this thread maybe we should start a new thread about this?

    In any case, as mentioned by prawn-star, in Google Play you dont set the product as Consumable or not, this is a Unity concept. All managed products in Google Play are consumable. In my code I never written not even once a line to consume the purchase (I dont even know how to do that to be honest, as all my IAPs are supposed to be permanent), so I know for sure I never consumed any purchase not even as a test, so if a player has 2 purchases it's either a bug in Google Play for accepting 2 purchases without consuming one, or a bug in Unity for consuming my players purchases without my consent/command. Any ideas on how could we find out the culprit to get this fixed?
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It is fixed in IAP 1.23. I'm aware how Google manages their products, I'm referring to the product type as set for the product during initialization in the script.
     
  6. Nananaaa

    Nananaaa

    Joined:
    Jul 24, 2016
    Posts:
    31
    Dear @JeffDUnity3D ,

    Thank you for your help in that matter. Much appreciated!

    You're right, it's not a real world scenario to change a NonConsumable IAP to a Consumeable. This is for testing only. How else would you test the purchase of a NonConsumable in app product multiple times? Also, this approach is recommended here and here.

    ---

    Thanks for the clarification.

    ---

    Here's you are. Please let me know if you see anything that could be improved:

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEngine.Purchasing;
    4.  
    5. public class InAppPurchase : MonoBehaviour, IStoreListener {
    6.     private static IStoreController storeController;
    7.     private static IExtensionProvider storeExtensionProvider;
    8.     private InitializationFailureReason initError;
    9.     private ConfigurationBuilder builder;
    10.  
    11.     public static string PRODUCT_KEY_PRO = "Pro";
    12.     private static string PRO_ANDROID = "com.whatevercompany.someapp.pro_android";
    13.     private Action<string, string> OnPurchaseCallback;     // Notifies the GUI if a purchase succeeded/failed.
    14.  
    15.  
    16.     void Start() {
    17.         if (storeController == null) {
    18.             InitializePurchasing();
    19.         }
    20.     }
    21.  
    22.     public void InitializePurchasing() {
    23.         if (IsInitialized()) {
    24.             return;
    25.         }
    26.  
    27.         builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    28.         builder.AddProduct(PRODUCT_KEY_PRO, ProductType.NonConsumable, new IDs() {
    29.             {PRO_ANDROID, GooglePlay.Name}
    30.         });
    31.         UnityPurchasing.Initialize(this, builder);
    32.     }
    33.  
    34.     public bool IsInitialized() {
    35.         return storeController != null && storeExtensionProvider != null; // both references are mandatory!
    36.     }
    37.  
    38.     public string GetInitError() {
    39.         return initError.ToString();
    40.     }
    41.  
    42.     public string GetLocalizedPriceString(string productId) {
    43.         try {
    44.             return storeController.products.WithID(productId).metadata.localizedPriceString;
    45.         } catch (Exception e) {
    46.             Debug.Log("Invalid product id: " + productId + " This is a BUG!" + e.Message);
    47.             return "";
    48.         }
    49.     }
    50.  
    51.     public void SetOnPurchaseCallback(Action<string, string> callback) {
    52.         Debug.Log("SetOnPurchaseCallback");
    53.         OnPurchaseCallback = callback;
    54.     }
    55.  
    56.     public void BuyProductID(string productId) {
    57.         if (IsInitialized()) {
    58.             Product product = storeController.products.WithID(productId);
    59.  
    60.             if (product != null && product.availableToPurchase) {
    61.                 Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
    62.                 storeController.InitiatePurchase(product);
    63.             } else {
    64.                 Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
    65.             }
    66.         } else {
    67.             Debug.Log("BuyProductID FAIL. Not initialized.");
    68.         }
    69.     }
    70.  
    71.     public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {
    72.         Debug.Log("OnInitialized: PASS!");
    73.         storeController = controller;
    74.         storeExtensionProvider = extensions;
    75.     }
    76.  
    77.     public void OnInitializeFailed(InitializationFailureReason error) {
    78.         Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
    79.         initError = error;
    80.     }
    81.  
    82.     public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) {
    83.         Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.storeSpecificId));
    84.  
    85.         if (null != OnPurchaseCallback) {
    86.             OnPurchaseCallback(args.purchasedProduct.definition.id, null);
    87.         }
    88.  
    89.         return PurchaseProcessingResult.Complete;
    90.     }
    91.  
    92.     public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) {
    93.         Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
    94.         OnPurchaseCallback(product.definition.id, failureReason.ToString());
    95.     }
    96. }
    97.  

    And here are the device logs. Please note:
    1. They are from after the product has been bought. Hence the line: "Sku is owned: ..."
    2. Company, app and product names have been replaced.

    0001/01/01 00:00:00.000 -1 -1 Info : --------- beginning of main
    2019/10/30 22:33:03.522 15744 15744 Info zygote64: Late-enabling -Xcheck:jni
    2019/10/30 22:33:03.728 15744 15744 Debug Unity: CommandLine:
    2019/10/30 22:33:03.758 15744 15744 Info Unity: onResume
    2019/10/30 22:33:03.807 15744 15744 Debug OpenGLRenderer: HWUI GL Pipeline
    2019/10/30 22:33:03.848 15744 15765 Debug Unity: SetWindow 0 0x74df59e010
    2019/10/30 22:33:03.849 15744 15765 Debug Unity: SetWindow 0 0x74df59e010
    2019/10/30 22:33:03.868 15744 15744 Debug vndksupport: Loading /vendor/lib64/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
    2019/10/30 22:33:03.869 15744 15744 Debug vndksupport: Loading /vendor/lib64/hw/gralloc.msm8992.so from current namespace instead of sphal namespace.
    2019/10/30 22:33:03.892 15744 15744 Info Unity: windowFocusChanged: true
    2019/10/30 22:33:03.906 15744 15765 Debug Unity: Enabling Unity systrace
    2019/10/30 22:33:03.918 15744 15765 Debug Unity: [VFS] Mount /data/app/com.company.appname-3_qyuulHThkn-3VElRRXUQ==/base.apk
    2019/10/30 22:33:03.921 15744 15765 Debug Unity: [VFS] Mount /data/app/com.company.appname-3_qyuulHThkn-3VElRRXUQ==/split_config.arm64_v8a.apk
    2019/10/30 22:33:03.943 15744 15765 Info Unity: SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 6, Memory = 1814mb
    2019/10/30 22:33:03.943 15744 15765 Info Unity: SystemInfo ARM big.LITTLE configuration: 2 big (mask: 0x30), 4 little (mask: 0xf)
    2019/10/30 22:33:03.944 15744 15765 Info Unity: ApplicationInfo com.company.appname version 5.3.2 build cb8d12ed-8cdc-4208-95d1-20e854368b89
    2019/10/30 22:33:03.944 15744 15765 Info Unity: Built from '2019.2/release' branch, Version '2019.2.10f1 (923acd2d43aa)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a', Stripping 'Enabled'
    2019/10/30 22:33:03.952 15744 15765 Debug Unity: Script Patching: Patch files are not available, '/storage/emulated/0/Android/data/com.company.appname/cache/ScriptOnly/2019.2.10f1/il2cpp/patch.config' is missing.
    2019/10/30 22:33:03.980 15744 15765 Debug Unity: Unity build is different than extracted il2cpp resources. Re-extracting.
    2019/10/30 22:33:04.094 15744 15765 Debug Unity: PlayerConnection initialized from /data/app/com.company.appname-3_qyuulHThkn-3VElRRXUQ==/split_config.arm64_v8a.apk/assets/bin/Data (debug = 0)
    2019/10/30 22:33:04.095 15744 15765 Debug Unity: PlayerConnection initialized network socket : 0.0.0.0 55081
    2019/10/30 22:33:04.095 15744 15765 Debug Unity: PlayerConnection initialized unix socket : Unity-com.company.appname
    2019/10/30 22:33:04.096 15744 15765 Debug Unity: Multi-casting "[IP] 192.168.1.102 [Port] 55081 [Flags] 2 [Guid] 2572573606 [EditorId] 3562968715 [Version] 1048832 [Id] AndroidPlayer(LGE_Nexus_5X@192.168.1.102) [Debug] 0 [PackageName] AndroidPlayer" to [225.0.0.222:54997]...
    2019/10/30 22:33:04.096 15744 15765 Debug Unity: Started listening to [0.0.0.0:55081]
    2019/10/30 22:33:04.186 15744 15765 Debug Unity: [EGL] Attaching window :0x74df59e010
    2019/10/30 22:33:04.186 15744 15765 Debug Unity: InitializeScriptEngine OK (0x74deaacfc0)
    2019/10/30 22:33:04.187 15744 15765 Debug Unity: PlayerConnection already initialized - listening to [0.0.0.0:55081]
    2019/10/30 22:33:04.207 15744 15765 Debug Unity: PlayerInitEngineNoGraphics OK
    2019/10/30 22:33:04.207 15744 15765 Debug Unity: AndroidGraphics::Startup window = 0x74df59e010
    2019/10/30 22:33:04.207 15744 15765 Debug Unity: [EGL] Attaching window :0x74df59e010
    2019/10/30 22:33:04.210 15744 15765 Debug Unity: [XR] Discovering subsystems at path assets/bin/Data/UnitySubsystems
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: QUALCOMM build : 8e59954, I0be83d0d26
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: Build Date : 09/22/17
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: OpenGL ES Shader Compiler Version: EV031.21.02.00
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: Local Branch : O17A
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: Remote Branch :
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: Remote Branch :
    2019/10/30 22:33:04.210 15744 15765 Info Adreno: Reconstruct Branch :
    2019/10/30 22:33:04.211 15744 15765 Debug vndksupport: Loading /vendor/lib64/hw/gralloc.msm8992.so from current namespace instead of sphal namespace.
    2019/10/30 22:33:04.212 15744 15765 Info Adreno: PFP: 0x00000000, ME: 0x00000000
    2019/10/30 22:33:04.227 15744 15765 Info zygote64: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
    2019/10/30 22:33:04.227 15744 15765 Debug Unity: [EGL] Request: ES 3.2 RGB0 000 0/0
    2019/10/30 22:33:04.228 15744 15765 Debug Unity: [EGL] Checking ES 3.2 support...
    2019/10/30 22:33:04.230 15744 15765 Debug Unity: [EGL] ES 3.2 support detected
    2019/10/30 22:33:04.230 15744 15765 Debug Unity: [EGL] Found: ID[1] ES 3.2 RGB16 565 0/0
    2019/10/30 22:33:04.230 15744 15765 Debug Unity: [EGL] Request: ES 3.2 RGB0 000 0/0
    2019/10/30 22:33:04.230 15744 15765 Debug Unity: [EGL] Found: ID[1] ES 3.2 RGB16 565 0/0
    2019/10/30 22:33:04.231 15744 15765 Debug Unity: [EGL] Request: ES 3.0 RGB24 888 24/8
    2019/10/30 22:33:04.232 15744 15765 Debug Unity: [EGL] Found: ID[7] ES 3.0 RGB24 888 24/8
    2019/10/30 22:33:04.232 15744 15765 Debug Unity: extension is supported with value 0
    2019/10/30 22:33:04.232 15744 15765 Debug Unity: extension is supported with value 1
    2019/10/30 22:33:04.232 15744 15765 Debug Unity: extension is supported with value 2
    2019/10/30 22:33:04.232 15744 15765 Debug Unity: extension is supported with value 5
    2019/10/30 22:33:04.235 15744 15765 Debug Unity: ANativeWindow: (1080/1920) RequestedResolution: (0/0) RenderingResolution: (0/0) EGLSurface: (1080/1920)
    2019/10/30 22:33:04.241 15744 15765 Debug Unity: Renderer: Adreno (TM) 418
    2019/10/30 22:33:04.241 15744 15765 Debug Unity: Vendor: Qualcomm
    2019/10/30 22:33:04.241 15744 15765 Debug Unity: Version: OpenGL ES 3.2 V@258.0 (GIT@8e59954, I0be83d0d26) (Date:09/22/17)
    2019/10/30 22:33:04.241 15744 15765 Debug Unity: GLES: 3
    2019/10/30 22:33:04.241 15744 15765 Debug Unity: GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_half_float GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_compressed_ETC1_RGB8_texture GL_AMD_compressed_ATC_texture GL_KHR_texture_compression_astc_ldr GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_OES_texture_3D GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_QCOM_alpha_test GL_OES_depth24 GL_OES_packed_depth_stencil GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_EXT_sRGB GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_sRGB_decode GL_OES_element_index_uint GL_EXT_copy_image GL_EXT_geometry_shader GL_EXT_tessellation_shader GL_OES_texture_stencil8 GL_EXT_shader_io_blocks GL_OES_shader_image_atomic GL_OES_sample_variables GL_EXT_texture_border_clamp GL_EXT_multisampled_render_to_texture GL_EXT_multisampled_render_to_texture2 GL_OES_shader_multisample_interpolation
    2019/10/30 22:33:04.241 15744 15765 Debug Unity: GL_EXT_texture_cube_map_array GL_EXT_draw_buffers_indexed GL_EXT_gpu_shader5 GL_EXT_robustness GL_EXT_texture_buffer GL_OES_texture_storage_multisample_2d_array GL_OES_sample_shading GL_OES_get_program_binary GL_EXT_debug_label GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_QCOM_tiled_rendering GL_ANDROID_extension_pack_es31a GL_EXT_primitive_bounding_box GL_OES_standard_derivatives GL_OES_vertex_array_object GL_EXT_disjoint_timer_query GL_KHR_debug GL_EXT_YUV_target GL_EXT_sRGB_write_control GL_EXT_texture_norm16 GL_EXT_discard_framebuffer GL_OES_surfaceless_context GL_OVR_multiview GL_OVR_multiview2 GL_EXT_texture_sRGB_R8 GL_KHR_no_error GL_EXT_debug_marker GL_OES_EGL_image_external_essl3 GL_OVR_multiview_multisampled_render_to_texture GL_EXT_buffer_storage GL_EXT_external_buffer GL_EXT_blit_framebuffer_params GL_EXT_shader_non_constant_global_initializers GL_QCOM_shader_framebuffer_fetch_noncoherent GL_EXT_EGL_image_array GL_NV_shader_noperspective_interpolation
    2019/10/30 22:33:04.243 15744 15765 Debug Unity: OPENGL LOG: Creating OpenGL ES 3.2 graphics device ; Context level <OpenGL ES 3.2> ; Context handle -870886016
    2019/10/30 22:33:04.244 15744 15765 Debug Unity: [EGL] Attaching window :0x74df59e010
    2019/10/30 22:33:04.244 15744 15765 Debug Unity: [EGL] Attaching window :0x74df59e010
    2019/10/30 22:33:04.244 15744 15765 Debug Unity: Initialize engine version: 2019.2.10f1 (923acd2d43aa)
    0001/01/01 00:00:00.000 -1 -1 Info : 2019-10-30 22:33:04.274 15744 15765 D : PlayerBase::playerBase()
    0001/01/01 00:00:00.000 -1 -1 Info : 2019-10-30 22:33:04.274 15744 15765 D : TrackPlayerBase::TrackPlayerBase()
    2019/10/30 22:33:04.274 15744 15765 Info libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
    2019/10/30 22:33:04.275 15744 15765 Warn AudioTrack: notificationFrames=-10 clamped to the range -1 to -8
    2019/10/30 22:33:04.276 15744 15765 Info AudioTrack: AUDIO_OUTPUT_FLAG_FAST successful; frameCount 1536 -> 1536
    2019/10/30 22:33:04.276 15744 15765 Debug AudioTrack: Client defaulted notificationFrames to 192 for frameCount 1536
    2019/10/30 22:33:04.375 15744 15765 Debug Unity: PlayerInitEngineGraphics OK
    2019/10/30 22:33:04.381 15744 15765 Debug Unity: Found 25 native sensors
    2019/10/30 22:33:04.389 15744 15765 Debug Unity: Sensor : Accelerometer ( 1) ; 0.004788 / 0.00s ; BMI160 accelerometer / Bosch
    2019/10/30 22:33:04.391 15744 15765 Debug Unity: Sensor : Accelerometer ( 1) ; 0.004788 / 0.00s ; BMI160 accelerometer / Bosch
    2019/10/30 22:33:04.400 15744 15765 Debug Unity: SetWindow 0 0x74df59e010
    2019/10/30 22:33:04.401 15744 15765 Debug Unity: [EGL] Attaching window :0x74df59e010
    2019/10/30 22:33:04.416 15744 15765 Verbose MediaRouter: Adding route: RouteInfo{ name=Telefon, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
    2019/10/30 22:33:04.421 15744 15765 Verbose MediaRouter: Selecting route: RouteInfo{ name=Telefon, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
    2019/10/30 22:33:04.453 15744 15808 Warn Unity: The referenced script on this Behaviour (Game Object 'Main Camera') is missing!
    2019/10/30 22:33:04.453 15744 15808 Warn Unity:
    2019/10/30 22:33:04.453 15744 15808 Warn Unity: (Filename: ./Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 334)
    2019/10/30 22:33:04.453 15744 15808 Warn Unity:
    2019/10/30 22:33:04.473 15744 15765 Debug Unity: UnloadTime: 0.690729 ms
    2019/10/30 22:33:04.478 15744 15765 Debug Unity: UUID: df9312ff5c691da6 => d9a8f7bae3118f09c7848f351c8890ea
    2019/10/30 22:33:04.522 15744 15765 Debug Unity: Sensor : Accelerometer ( 1) ; 0.004788 / 0.00s ; BMI160 accelerometer / Bosch
    2019/10/30 22:33:04.526 15744 15765 Debug Unity: Choreographer available: Enabling VSYNC timing
    2019/10/30 22:33:04.586 15744 15817 Debug Unity: Setting up 1 worker threads for Enlighten.
    2019/10/30 22:33:04.592 15744 15818 Debug Unity: Thread -> id: 74c8efa4f0 -> priority: 1
    2019/10/30 22:33:04.652 15744 15785 Debug NetworkSecurityConfig: No Network Security Config specified, using platform default
    2019/10/30 22:33:06.112 15744 15808 Warn Unity: The referenced script (ScreenshotGenerator) on this Behaviour is missing!
    2019/10/30 22:33:06.112 15744 15808 Warn Unity:
    2019/10/30 22:33:06.112 15744 15808 Warn Unity: (Filename: ./Runtime/Scripting/ManagedReference/SerializableManagedRef.cpp Line: 199)
    2019/10/30 22:33:06.112 15744 15808 Warn Unity:
    2019/10/30 22:33:06.158 15744 15808 Warn Unity: The referenced script on this Behaviour (Game Object 'CaptureScreenshotsPanel') is missing!
    2019/10/30 22:33:06.158 15744 15808 Warn Unity:
    2019/10/30 22:33:06.158 15744 15808 Warn Unity: (Filename: ./Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 334)
    2019/10/30 22:33:06.158 15744 15808 Warn Unity:
    2019/10/30 22:33:06.159 15744 15808 Error Unity: A scripted object (probably ScreenshotGenerator?) has a different serialization layout when loading. (Read 32 bytes but expected 532 bytes)
    2019/10/30 22:33:06.159 15744 15808 Error Unity: Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    2019/10/30 22:33:06.159 15744 15808 Error Unity:
    2019/10/30 22:33:06.159 15744 15808 Error Unity: (Filename: ./Runtime/Serialize/SerializedFile.cpp Line: 2135)
    2019/10/30 22:33:06.159 15744 15808 Error Unity:
    2019/10/30 22:33:06.179 15744 15808 Debug Unity: Unloading 7 Unused Serialized files (Serialized files now loaded: 0)
    2019/10/30 22:33:06.533 15744 15765 Debug Unity: UnloadTime: 8.177293 ms
    2019/10/30 22:33:06.852 15744 15765 Info Unity: UnityIAP Version: 1.23.0
    2019/10/30 22:33:06.852 15744 15765 Info Unity: UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)
    2019/10/30 22:33:06.852 15744 15765 Info Unity: InAppPurchase:InitializePurchasing()
    2019/10/30 22:33:06.852 15744 15765 Info Unity:
    2019/10/30 22:33:06.852 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:06.852 15744 15765 Info Unity:
    2019/10/30 22:33:06.866 15744 15765 Info UnityIAP: IAB helper created.
    2019/10/30 22:33:07.020 15744 15765 Debug Unity: System memory in use before: 17.1 MB.
    2019/10/30 22:33:07.046 15744 15765 Debug Unity: System memory in use after: 17.4 MB.
    2019/10/30 22:33:07.046 15744 15765 Debug Unity:
    2019/10/30 22:33:07.046 15744 15765 Debug Unity: Unloading 24 unused Assets to reduce memory usage. Loaded Objects now: 4503.
    2019/10/30 22:33:07.046 15744 15765 Debug Unity: Total: 25.341929 ms (FindLiveObjects: 1.752969 ms CreateObjectMapping: 0.462500 ms MarkObjects: 13.141668 ms DeleteObjects: 9.971668 ms)
    2019/10/30 22:33:07.046 15744 15765 Debug Unity:
    2019/10/30 22:33:07.270 15744 15765 Info Unity: Using configuration builder objects
    2019/10/30 22:33:07.270 15744 15765 Info Unity: UnityEngine.Purchasing.StoreCatalogImpl:handleCachedCatalog(Action`1)
    2019/10/30 22:33:07.270 15744 15765 Info Unity: System.Action`1:Invoke(T)
    2019/10/30 22:33:07.270 15744 15765 Info Unity: UnityEngine.Purchasing.<Process>d__4:MoveNext()
    2019/10/30 22:33:07.270 15744 15765 Info Unity: UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    2019/10/30 22:33:07.270 15744 15765 Info Unity:
    2019/10/30 22:33:07.270 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:07.270 15744 15765 Info Unity:
    2019/10/30 22:33:07.280 15744 15765 Info UnityIAP: Starting in-app billing setup.
    2019/10/30 22:33:07.305 15744 15744 Info UnityIAP: Billing service connected.
    2019/10/30 22:33:07.307 15744 15850 Info UnityIAP: invoking callback
    2019/10/30 22:33:07.307 15744 15850 Info UnityIAP: Checking for in-app billing 3 support.
    2019/10/30 22:33:07.317 15744 15850 Info UnityIAP: In-app billing version 3 supported for com.company.appname
    2019/10/30 22:33:07.324 15744 15850 Info UnityIAP: Subscriptions AVAILABLE.
    2019/10/30 22:33:07.331 15744 15850 Info UnityIAP: Subscription upgrade and downgrade are AVAILABLE.
    2019/10/30 22:33:07.336 15744 15850 Info UnityIAP: Subscriptions information parse AVAILABLE.
    2019/10/30 22:33:07.344 15744 15850 Info UnityIAP: VR supported.
    2019/10/30 22:33:07.345 15744 15850 Info UnityIAP: onIabSetupFinished: 0
    2019/10/30 22:33:07.345 15744 15850 Info UnityIAP: Requesting 4 products
    2019/10/30 22:33:07.346 15744 15850 Info UnityIAP: QueryInventory: 4
    2019/10/30 22:33:07.346 15744 15850 Info UnityIAP: invoking callback
    2019/10/30 22:33:07.346 15744 15850 Info UnityIAP: Querying owned items, item type: inapp
    2019/10/30 22:33:07.346 15744 15850 Info UnityIAP: Package name: com.company.appname
    2019/10/30 22:33:07.346 15744 15850 Info UnityIAP: Calling getPurchases with continuation token: null
    2019/10/30 22:33:07.352 15744 15850 Info UnityIAP: Owned items response: 0
    2019/10/30 22:33:07.352 15744 15850 Info UnityIAP: Sku is owned: com.whatevercompany.someapp.pro_android
    2019/10/30 22:33:07.354 15744 15850 Info UnityIAP: Continuation token: null
    2019/10/30 22:33:07.354 15744 15850 Info UnityIAP: Querying SKU details.
    2019/10/30 22:33:07.420 15744 15850 Info UnityIAP: Querying owned items, item type: subs
    2019/10/30 22:33:07.420 15744 15850 Info UnityIAP: Package name: com.company.appname
    2019/10/30 22:33:07.420 15744 15850 Info UnityIAP: Calling getPurchases with continuation token: null
    2019/10/30 22:33:07.426 15744 15850 Info UnityIAP: Owned items response: 0
    2019/10/30 22:33:07.427 15744 15850 Info UnityIAP: Continuation token: null
    2019/10/30 22:33:07.427 15744 15850 Info UnityIAP: Querying SKU details.
    2019/10/30 22:33:07.453 15744 15850 Info UnityIAP: Querying owned items' purchase history, item type: subs
    2019/10/30 22:33:07.453 15744 15850 Info UnityIAP: Package name: com.company.appname
    2019/10/30 22:33:07.453 15744 15850 Info UnityIAP: Calling getPurchaseHistory with continuation token: null
    2019/10/30 22:33:07.827 15744 15850 Info UnityIAP: Purchase history response: 0
    2019/10/30 22:33:07.827 15744 15850 Info UnityIAP: Continuation token: null
    2019/10/30 22:33:07.828 15744 15850 Info UnityIAP: Querying owned items' purchase history, item type: inapp
    2019/10/30 22:33:07.828 15744 15850 Info UnityIAP: Package name: com.company.appname
    2019/10/30 22:33:07.828 15744 15850 Info UnityIAP: Calling getPurchaseHistory with continuation token: null
    2019/10/30 22:33:07.981 15744 15850 Info UnityIAP: Purchase history response: 0
    2019/10/30 22:33:07.983 15744 15850 Info UnityIAP: Continuation token: null
    2019/10/30 22:33:07.984 15744 15850 Info UnityIAP: onQueryInventoryFinished: true
    2019/10/30 22:33:07.984 15744 15850 Info UnityIAP: Inventory refresh successful. (response: 0:OK)
    2019/10/30 22:33:08.017 15744 15749 Info zygote64: Do partial code cache collection, code=29KB, data=27KB
    2019/10/30 22:33:08.017 15744 15749 Info zygote64: After code cache collection, code=29KB, data=27KB
    2019/10/30 22:33:08.017 15744 15749 Info zygote64: Increasing code cache capacity to 128KB
    2019/10/30 22:33:08.065 15744 15765 Info Unity: OnInitialized: PASS!
    2019/10/30 22:33:08.065 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.065 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.065 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.065 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.065 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.065 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.065 15744 15765 Info Unity:
    2019/10/30 22:33:08.065 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.065 15744 15765 Info Unity:
    2019/10/30 22:33:08.100 15744 15765 Info Unity: com.company.appname.productname
    2019/10/30 22:33:08.100 15744 15765 Info Unity: InAppPurchase:ValidateReceipt(String)
    2019/10/30 22:33:08.100 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.100 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.100 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.100 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.100 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.100 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.100 15744 15765 Info Unity:
    2019/10/30 22:33:08.100 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.100 15744 15765 Info Unity:
    2019/10/30 22:33:08.109 15744 15765 Info Unity: 10/30/2019 18:50:54
    2019/10/30 22:33:08.109 15744 15765 Info Unity: InAppPurchase:ValidateReceipt(String)
    2019/10/30 22:33:08.109 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.109 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.109 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.109 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.109 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.109 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.109 15744 15765 Info Unity:
    2019/10/30 22:33:08.109 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.109 15744 15765 Info Unity:
    2019/10/30 22:33:08.116 15744 15765 Info Unity: GPA.3314-3315-6781-45310
    2019/10/30 22:33:08.116 15744 15765 Info Unity: InAppPurchase:ValidateReceipt(String)
    2019/10/30 22:33:08.116 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.116 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.116 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.116 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.116 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.116 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.116 15744 15765 Info Unity:
    2019/10/30 22:33:08.116 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.116 15744 15765 Info Unity:
    2019/10/30 22:33:08.123 15744 15765 Info Unity: GPA.3314-3315-6781-45310
    2019/10/30 22:33:08.123 15744 15765 Info Unity: InAppPurchase:ValidateReceipt(String)
    2019/10/30 22:33:08.123 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.123 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.123 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.123 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.123 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.123 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.123 15744 15765 Info Unity:
    2019/10/30 22:33:08.123 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.123 15744 15765 Info Unity:
    2019/10/30 22:33:08.130 15744 15765 Info Unity: Purchased
    2019/10/30 22:33:08.130 15744 15765 Info Unity: InAppPurchase:ValidateReceipt(String)
    2019/10/30 22:33:08.130 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.130 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.130 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.130 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.130 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.130 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.130 15744 15765 Info Unity:
    2019/10/30 22:33:08.130 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.130 15744 15765 Info Unity:
    2019/10/30 22:33:08.138 15744 15765 Info Unity: gnpoaaedjcmfaahijoimimpi.AO-J1OzmBrvDKA8MabRYw42ZCdkNJ7ZYCJ8A0r6UOt0BtLq4UtE3wxSHjww1IBGz04KXGLm1a43xKMF4pl8_QA0-kiZF54v5S7wZC8dVlDsUBd61ehbIX0Vg0xTyURw-3ajcvngrcVgC89Ms5Yc9umzkxXxRL4PLK2I3HRYOzC8pgjmqcA8qUrI
    2019/10/30 22:33:08.138 15744 15765 Info Unity: InAppPurchase:ValidateReceipt(String)
    2019/10/30 22:33:08.138 15744 15765 Info Unity: InAppPurchase:OnInitialized(IStoreController, IExtensionProvider)
    2019/10/30 22:33:08.138 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    2019/10/30 22:33:08.138 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.138 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.138 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.138 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.138 15744 15765 Info Unity:
    2019/10/30 22:33:08.138 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.138 15744 15765 Info Unity:
    2019/10/30 22:33:08.165 15744 15765 Info Unity: Already recorded transaction GPA.3314-3315-6781-45310
    2019/10/30 22:33:08.165 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:processPurchaseIfNew(Product)
    2019/10/30 22:33:08.165 15744 15765 Info Unity: UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    2019/10/30 22:33:08.165 15744 15765 Info Unity: UnityEngine.Purchasing.JSONStore:OnProductsRetrieved(String)
    2019/10/30 22:33:08.165 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.165 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.165 15744 15765 Info Unity:
    2019/10/30 22:33:08.165 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2019/10/30 22:33:08.165 15744 15765 Info Unity:
    2019/10/30 22:33:08.167 15744 15765 Info UnityIAP: Finish transaction:GPA.3314-3315-6781-45310
    2019/10/30 22:33:08.173 15744 15765 Info Unity: UnityIAP: Promo interface is available for 3 items
    2019/10/30 22:33:08.173 15744 15765 Info Unity: UnityEngine.Purchasing.Promo:provideProductsToAds(HashSet`1)
    2019/10/30 22:33:08.173 15744 15765 Info Unity: System.Action:Invoke()
    2019/10/30 22:33:08.173 15744 15765 Info Unity: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    2019/10/30 22:33:08.173 15744 15765 Info Unity:
    2019/10/30 22:33:08.173 15744 15765 Info Unity: (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)


    Do you see anything that's obviously wrong? Any ideas?

    Thank you,
    Michael.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Nananaaa I'm seeing multiple IAP intializations in the logs but no mention of the IAP version. Why are you initializing so often? I would expect to see the version string 1.23 in your logs but I do not. The last version of IAP that didn't output the version is 1.16, a very old version of IAP. Can you compare to the Sample IAP project here https://forum.unity.com/threads/sample-iap-project.529555/ . We are having several engineers separately test IAP restore across devices over the next few days and we will post our results.
     
    Nananaaa and prawn-star like this.
  8. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    77
    Yes I think there is definitely an issue with Google receipt process/timing. Hopefully it's just isolated to test cards.
    I am just building straight to device but would normally use the Alpha Track in the Google play Console.
    It just takes so long now to build the 64b version required by Google. Almost as long as iOS now :)
    The test account is added under Settings>Devleoper Account>Account Details>License Testing

    Cheers
     
  9. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    77
    Hi Nananaa

    I agree it is a bit of pain to test Non Consumables.
    What I do is export the product from Google Play Console as a CSV file.
    I then edit this CSV file adding an "_x" onto the end of the product ID.
    I then import this CSV back into Google Play Console to get a new product to test with in Unity.
    This way I don't have to fluff around with changing NonConsumable to Consumables
     
    Nananaaa likes this.
  10. Nananaaa

    Nananaaa

    Joined:
    Jul 24, 2016
    Posts:
    31
    That's a nice solution. Thanks for sharing it!
    Michael.
     
  11. Nananaaa

    Nananaaa

    Joined:
    Jul 24, 2016
    Posts:
    31
    Thanks for pointing that out! It's odd: The script is only attached to a single GameObject that's part of the scene. It isn't instantiated on demand. Also, although InitializePurchasing() is public, it isn't called nowhere else than in Start(). So it should be initialized only once. I'll take a closer look at it.

    ---

    It's quite a long log. Somewhere buried in it is the following line:
    2019/10/30 22:33:06.852 15744 15765 Info Unity: UnityIAP Version: 1.23.0

    ---

    Sure.


    Thank you,
    Michael.
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I always test non-consumables by configuring a few test users.
     
    DanWeston and Nananaaa like this.
  13. Nananaaa

    Nananaaa

    Joined:
    Jul 24, 2016
    Posts:
    31
    Also a very nice solution. Thank you!
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We could be looking at multiple sessions in the logs. It's best to only capture the logs for the current session to avoid confusion. I would also encourage you to filter for IAP logs only, like "adb logcat | grep -i unityiap" (use findstr on Windows)
     
  15. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    Thanks for confirming it's fixed, but can you detail a bit more what changed? If the purchases were consumed by older/bugged Unity IAP versions then it's good it won't happen for new purchases, but in this case it would happen to all my past purchases (dozens of thousands), right?

    Or the fix was on something else? I cant see another option for it to be fixed on Unity side other than an auto-consumption bug, but I might be wrong.
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Unrelated. Not sure what you mean by consumed in this context, we are discussing restore across devices. You purchase a subscription on one device, and expect it to show up in ProcessPurchase on initialization on a second device. This is now working. You need to ensure that you are installing the app from Google Play, and not side loading, for the receipts to be in sync. And "dozens of thousands of purchases", you mean you've purchased the same product thousands of times in your testing?
     
  17. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    77
    Thanks Jeff.

    So building and running from Unity would be considered side loading?
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, that is correct. For a new tester, I always first install via Google Play, then I side load after that. I'm continuing to test here too. One thing I noticed but unconfirmed, I created a build with a different version of Unity (2019) and used a different signing key but the same package name. That build didn't get the receipts. Then I created a build (2018) making sure the signing key was the same one that was used on the original purchase, and I see the receipts. So unconfirmed if it is 2019 vs 2018 related or signing key related. I will post more info as I continue to test.
     
  19. DanWeston

    DanWeston

    Joined:
    Sep 9, 2014
    Posts:
    32
    @JeffDUnity3D I've finally had a slot of time available to test 1.23.0 on my build and unfortunately the Restore issue hasn't been resolved.

    Following my steps outlined in my OP I still can't restore across devices. I've tested this on a live build and internal testing build with a Test account and a "Real" account. Same results :(
     
    nemeth-regime likes this.
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It is working for us here in our testing. Does it Restore on the same device?
     
  21. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    I have rolled 1.23.0 to production but I dont know yet if it's working or not, I will know for sure in a couple weeks.

    But in any case, what really puzzles me, as I already mentioned on a previous post, and @DanWeston mentioned on OP, is: how can the same Google account own 2 instances of the same product, without one being consumed? Is that a Google bug, or a Unity IAP bug?

    In case it's a Unity bug, the only possible bug I can think of is that Unity is automatically consuming the purchases, which would be awesomely severe and we should be informed ASAP, so we can contact Google to try to get some kind of backup of the purchases.

    In case it's not a Unity bug we should know as well, so we can contact Google to get that multiple-purchase bug fixed.

    EDIT: and this problem, being a bug on Google's side (which is more likely in my opinion), could very well be another source of the problem of this thread. For example Google might be using the device as key on some of its internal process, therefore the purchases arent restored on different devices, and also multiple purchases can be made on different devices. But this bug must be happening only on some specific situations, maybe introduced uniquely by Unity IAP, otherwise we would have had seen it before, and other devs using other engines would be seeing it as well.
     
    Last edited: Nov 14, 2019
  22. DanWeston

    DanWeston

    Joined:
    Sep 9, 2014
    Posts:
    32
    Restore is working as expected when performed on a single device.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you installing via Google Play or side loading? Restore across multiple devices works for me and the other people testing here. Try purchasing the same subscription on the second device, it should not let you.
     
    Last edited: Nov 14, 2019
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    In a couple of weeks? Was it working in your testing prior to release?
     
  25. DanWeston

    DanWeston

    Joined:
    Sep 9, 2014
    Posts:
    32
    I've not tried a side loaded build, only a store build. I was able to purchase the other IAP on the second device.
     
    DarekRusin likes this.
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you are able to purchase a second subscription, then it is a different user. Otherwise, I'm sure Apple/Google would be most interested in how you purchased duplicate subscriptions.
     
  27. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    106
    Jeff, as I stated on a previous post, I have seen the same thing @DanWeston described happen to my users as well. A couple months ago a player complained to me he had purchased twice and I searched his email on the purchases and found 2 active purchases of the same product on the same email (in my case it's not a subscription, it's a regular managed product). But both purchases were active (ie, not cancelled). This is what I tried explaining on a couple posts on this thread, I think it's either a Google bug (certainly very rare/specific, otherwise everybody would be suffering from this and complaining), or something caused by Unity (for example consuming the purchases due to some kind of bug).

    EDIT: oh, forgot to mention, I dont remember seeing this happen or hearing complains of this kind of problem until a few months ago, that's why I thought it's related to the bug of this thread
     
    DarekRusin likes this.
  28. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it! We have heard of similar reports. We believe we may have found a recent change that we made that we will need to undo in an upcoming release. It appears that some purchases are not properly consumed.
     
    DarekRusin likes this.
  29. nemeth-regime

    nemeth-regime

    Joined:
    Feb 13, 2017
    Posts:
    40
    Having the same problem here. Users are able to purchase the same non-consumable product on the same account using different devices. Restore not working across devices using the same google account. This has been happening since the app was released in September.

    I have now ran out of things to say to buyers except "Hey come and join the beta" just to appease them whilst somebody at Unity works out what is going on.
     
  30. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are not able to reproduce, it is working in our testing here using IAP 1.23. Please show the code that you are using to add the product during initialization and confirm that you are using version 1.23 (which wasn't available in September)
     
  31. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Restore across devices was specifically fixed in 1.23. We should have the next release available in a week or so hopefully, in case you want to wait.
     
  32. nemeth-regime

    nemeth-regime

    Joined:
    Feb 13, 2017
    Posts:
    40
    OK thanks I will wait.
     
  33. gui_dev

    gui_dev

    Joined:
    Mar 20, 2015
    Posts:
    15
    Some users still are reporting to not be able to restore purchases across devices in 1.23

    One of my users found a workaround: If he performs a factory reset to the new device, the restore works as intended. I don't know if maybe Unity IAP is storing some kind of cache that got corrupted in any of the updates and is preventing users to restore purchases unless they perform a factory reset

    I've not found any way to reproduce the issue myself, but I've got a few users with this issue. I just wanted to let you know it in case the IAP team is still working on this.
     
  34. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are not actively working on this issue. If you have steps to reproduce, we could investigate. It's working in our testing.
     
  35. Luchunpen_0

    Luchunpen_0

    Joined:
    Aug 7, 2014
    Posts:
    58
    In our case we have the same problem and unfortunally it is not solved for us only by updating IAP plugin. It was our first paid application, and we didn't know all features of payment system.
    We start to receive same messages and began to test the application. First of all we maked a real purchase (IAP plugin v 1.22), and install application on second device and in this device was no purchases. Then we update plugin to v1.23, compiled new version and install on both devices - same result. Then we clear GooglePlayMarket cashe and our purchase is disappeared in first device. So then we start to debug purchase process and found out that this one (as well as all purchases by customers I think) has no receipt in answer and I suppose that it was processed as consumable.
    Then we make one more real purchase of this itemId (IAP plugin v1.23) - it was purchased second time and now it return receipt and can be shared to other devices.
    When creating a product in the google play store there is no option consumable or nonconsumable, and type of product detected by callback type. In AppStore everything works great, maybe because this option is selected in the store directly.

    So we have next problem - how to restore completed purchase. Can we receive purchases list from google play market or we need to send promo codes for all our customers ?
     
    Last edited: Dec 3, 2019
  36. Slawomir-Sokol

    Slawomir-Sokol

    Joined:
    Dec 10, 2013
    Posts:
    12
    We seem to be having a similliar issue. Some products have been bought in our application, but they do not show on other devices and, after clearing the google play shop cache data, on the same device as well. They do not appear even when restoring purchases.

    We are using Unity IAP 1.23.1.

    I've checked the game-store communication and found something interesting.
    The inAppPurchaseHistory call returns all the products correctly.
    After that a consumePurchase call is made for each of the products that in the end are missing in the app. All those products are set as non-consumables in the shop (or at least that's what I've been told, since I'm in no position to check that myself).
    The response to each of the consumePurchases is "Item is not owned by the user."

    Is it normal for the Unity IAP to try to consume a non-consumable product?

    @JeffDUnity3D - is this the same issue that was soppoused to be fixed, something different, or a proper behaviour and the problem lies elsewhere?
     
  37. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sounds like a different issue, we have tested restore across devices. So some products restore, and others do not? Is this in a production app, or in testing?
     
  38. Slawomir-Sokol

    Slawomir-Sokol

    Joined:
    Dec 10, 2013
    Posts:
    12
    Yes. The app history returnes a list of purchases but for some of them ProcessPurchase is not called and they do not have receipt. However we've noticed a consumePurchase call is made for them on every start.

    We are teting on production app, however the purchases where test purchases. (We are getting reports of regular issues having issues as well).

    Why would the Unity IAP decide to consume a product on its own?

    Additionaly, when the game starts for the first time ProcessPurchase is called for every product (except the 'consumed' ones). When on subsequent start we make the Restore Transactions call, Porcess Purchase is not called anymore for the products. Is that correct?

    If you'd like to see this in action I don't mind doing a call for a work sessios with screen sharing to show you the issue.
     
  39. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Is this iOS or Google? Are your testers downloading from Google Play after confirming the tester URL on each device on Android, or using TestFlight on Apple? Please provide the device logs, and the purchasing script (that shows the product type) that you are using. For the logs, these should help https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/ and https://forum.unity.com/threads/how-to-capturing-device-logs-on-ios.529920/
     
  40. Slawomir-Sokol

    Slawomir-Sokol

    Joined:
    Dec 10, 2013
    Posts:
    12
    @JeffDUnity3D

    I've sent you a private message with the logs, code snippets and addtional information.
     
  41. Luchunpen_0

    Luchunpen_0

    Joined:
    Aug 7, 2014
    Posts:
    58
    This problem only on Android devices. On IOS all works well.
     
  42. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Your logs are filled with Unavailable Product errors, you'll want to address that first. Also please test and compare with the Sample IAP project. I wrote it and several of us here have tested it, and restore happens as expected across devices. You need to have the user opt-in to the test program from their browser on each device, and then download the app from Google Play. There is no "Restore" button on Android, it happens automatically for subscriptions on Android. Consumables like "Gold Coins" would not be expected to restore and you would not see a ProcessPurchase on reinstall. https://forum.unity.com/threads/sample-iap-project.529555/
     
  43. Slawomir-Sokol

    Slawomir-Sokol

    Joined:
    Dec 10, 2013
    Posts:
    12
    Yes. I'm aware of those errors, however at this point I can't quickly adress this issue. Long story short, the config is shared with the iOS version not done in Unity which fallows a different purchasing process and has forced us to ask for all the products even if they are not configured for Android. While being unoptimal I do not belive this is a cause of the problem we are experiencing - some products not appearing for users after being bought.

    I've compared our algorithm with the test application and see no differences in the purchasing process. At the start of the app we add all the products to the builder as ProductType.NonConsumable , when product is to be bought we call the method m_StoreController.InitiatePurchase with the product instance as parameter and when product is purchased we handle the process in ProcessPurchase method, returning m_StoreController.InitiatePurchase.Complete as a method return value.

    What I'm not seing in the linked example is how you are detecing if no adds has been already bought once the application restarts. We do it by checking if the product has a recipt by calling a product.hasReceipt getter.

    Our QA team is able to do test purchases and most of the products work, so I'm quite certain they've already opted in

    IGooglePlayStoreExtensions interface has a RestoreTransactions method and we've succesfully called it on Android device. When the OnTransactionsRestored callback is called products which have been bought and are not subject to the bug are added to the stores product list even if they were not added to the builder on initialziation. So I think I can safely say that the restore works for Non-Consumables.

    Let me clarify my issue once more:

    We have around 50 products in the shop, all which are defined in builder as Non-Consumable. We use a hasRecipt afer UnityIAP initializes to determine if a product has been bought by the user. For some players (and one of our test devices) some products (at thi point we belive random ones, and different for different players) do not have a receipt even if they were bought and are listed in that accounts purchase history. We are able to see the comunication between the app and the google store and we see that the products (including those which according to UnityIAP do not have the recipt) are listed in the response of the https://android.clients.google.com/fdfe/inAppPurchaseHistory?bav=6&shpn=<name of the app>&iabt=inapp call. However for some of them (those which are missing) a call https://android.clients.google.com/fdfe/consumePurchase is being made afterwards. This call is not triggered by us so we assume the UnityIAP makes it automaticly. What is even stranger the call end with an error stating Item is not owned by the user.

    The restore purchases is not done by the code at this point (this is a new feature that has not been set live yet) so should have nothing to do with the problem. That being said, even if we do call the restore purchases the products do nt 'regain' the receipt as we would maybe hope.

    At this point, based on the games communication with the store, we are hazarding a guess that for some reason UnityIAP when initializing is deciding that the purchased product is a consumable and tries to auto-consume it and then removes the receipt so that it can be purchased once more.

    Please let me know if this is of any help or what else besides the logcat logs and charles logs of the comunication process we could provide you to help figure out what is happening.
     
  44. Slawomir-Sokol

    Slawomir-Sokol

    Joined:
    Dec 10, 2013
    Posts:
    12
    According to google documentation at https://developer.android.com/google/play/billing/billing_library_overview:

    queryPurchaseHistoryAsync() returns a PurchaseHistory object that contains info about the most recent purchase made by the user for each product ID, even if that purchase is expired, cancelled, or consumed.

    I guess that the product has already been consumed for those users, and is still trying to be consumed on each start. I do not see any consume method in the IStoreController so it's not called by us. I've also checked the product adding process and double checked - no product should ever be added as Consumable in our app since we do not have such products at all. What are the use cases that UnityIAP would consume a product are there any other beside purchasing a product marked as consumable?
     
    DarekRusin likes this.
  45. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Good research, I'm checking with the team here and will follow up.
     
  46. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi there! Some users are still complaining, that on the new phone with same account they can't access purchased non-consumable items.
    Unity 2019.2.15f, IAP 1.23.1
     
    Last edited: Dec 19, 2019
  47. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    iOS or Android?
     
  48. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Android, Google Play
     
  49. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    228
    We're seeing the same restore issues as @justtime and @Slawomir-Sokol on Android.

    Since we're sitting on 2019.2.0, we were also trying to confirm whether the App.Quit bug was resolved on Android which led us to an interesting test scenario:
    1. Buy a non-consumable on Device A
    2. leave that device open to the game
    3. Install on Device B with same user account to see if Restore works (it doesn't)
    Wanted to ask if having the same user simultaneously on multiple devices was a valid test, or whether GooglePlay or UnityIAP might reject the receipts for other reasons than the bug above.
     
  50. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    On the second device, are you browsing first to the testing opt-in link, then downloading via Google Play? Or is this with a live game. Be sure to be using IAP 1.23.1 as it contains an update for restore. The quit behavior on the first device would not make a difference here, the purchase is already completed by that time.
     
Thread Status:
Not open for further replies.