Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Identifying Store accounts with subscriptions

Discussion in 'Unity IAP' started by HART_SB, Jul 11, 2022.

  1. HART_SB

    HART_SB

    Joined:
    Nov 27, 2018
    Posts:
    16
    When Unity IAP initialises and gets the StoreController data, it recognises the Google/Apple account that is logged in the device (specifically, what subscription purchases that account currently has).

    How does this occur exactly? Is it possible to access the devices's Google/Apple account data (or some sort of unique account reference)?

    We're looking for a way to identify the correct Store account with the correct app account.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    On Google, you can use IGooglePlayConfiguration.SetObfuscatedAccountId
     
  3. HART_SB

    HART_SB

    Joined:
    Nov 27, 2018
    Posts:
    16
    Isn't the IGooglePlayConfiguration.SetObfuscatedAccountId(id) for adding our own reference? Our backend guy is asking how Unity IAP knows what Google/Apple account to reference when it requests subscriptions from the relative Store. I'm assuming there's some sort of communication with the device's OS API to see whatever account currently logged into that device.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, I thought you meant a reference to associate a purchase with an in-game login with the Google Play or Apple ID user of the phone profile. We have no APIs to get the user credentials, the Google Play API and StoreKit API handle all of that internally and securely. Unity IAP is a pass-through service for those APIs. A phone user who has previously purchased a subscription will automatically get a ProcessPurchase call upon first IAP initialization after install. You can also check for the receipt.