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. Dismiss Notice

Question sandbox test hasReceipt alway false? but in testfight is working well?

Discussion in 'Unity IAP' started by nathanlin, Jul 16, 2023.

  1. nathanlin

    nathanlin

    Joined:
    Dec 4, 2021
    Posts:
    31
    i use this code to init the purchase in my game start, but it seen no work in sandbox(xcode run), and it work
    in testfight tester?
    IEnumerator waiuntilInit()

    {

    InitializePurchasing();

    yield return new WaitUntil(() => IsInitialized());

    UnityEngine.Purchasing.Product monthPurchased = m_StoreController.products.WithID(SUSidpermonth);

    UnityEngine.Purchasing.Product yearPurchased = m_StoreController.products.WithID(SUSidperyear);

    if (monthPurchased != null)

    {
    if (monthPurchased.hasReceipt)

    {

    isPurchased = true;

    }

    }}

    else

    {

    noPay();

    }

    any ideas?
     
  2. Unity_AndyP

    Unity_AndyP

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    65
    The receipt validation will always come back as false on sandbox. This is perfectly normal for the Sandbox environment and the return of false shows that the validation is working.
     
  3. nathanlin

    nathanlin

    Joined:
    Dec 4, 2021
    Posts:
    31
    So in Testfight is return true(if tester purchased)?also mean working
     
  4. Dennis_eA

    Dennis_eA

    Joined:
    Jan 17, 2011
    Posts:
    375
    Does that mean that it's (by design) not possible to purchase IAPs AND then deinstall app, reinstall, test Restore mechanism? Talking about iOS local builds / test flight.