IAP - "Already Purchased" but is consumable — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

IAP - "Already Purchased" but is consumable

TrevJTTrevJT Posts: 44
Brain Burst
Hi, I'm testing my app with a test user and the test Credit Card given, but it won't let me purchase twice... 

The item shows up in my platform settings as a consumable purchase, below is a copy from the TSV file I uploaded.

Has anyone else experienced this issue? Do I need to specify in the code that you are purchasing a consumable item?

TSV:
SKU Name Description Currency Amount Item Type
MILLION 1 Million dollars This will give you 1 Million dollars to spend on upgrades! USD 1.99 Consumable

using Unity 5.4.1f1 

code: 
        IAP.LaunchCheckoutFlow("MILLION").OnComplete(LaunchCheckoutFlowCallback);

    void LaunchCheckoutFlowCallback(Message msg)
    { // If the purchase was successful, this block of code will run 
        if (!msg.IsError)
        {
            gamedata.gdata.bank += 1000000;
}
}
Tagged:

Best Answer

Answers

  • juanoldinhojuanoldinho Posts: 131 Oculus Staff
    Hi,

    I am currently looking into this and will advise you on what information I find that is applicable to your situation.
    Please tag me, @juanoldinho, in your forum post/response if you need immediate assistance or want additional support or context on an issue you are having with our software or integrations.

    Having an issue with our platform, services, or integrations?

    Try using our new bug tool to report this and receive emailed updates as we proceed to address it internally.
  • TrevJTTrevJT Posts: 44
    Brain Burst
    @juanoldinho Thanks! I forgot to consume the purchase.

            IAP.ConsumePurchase("MILLION");

  • handsomeguoguohandsomeguoguo Posts: 15
    NerveGear
    @TrevJT

    Hi,
    I met the same problem currently.
    So Just Add this code  "" IAP.ConsumePurchase("MILLION");" just in the purchase method like this:

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~the code is added to a button~~~~~~~~~~~~~~~~~~~~~~~~~

        private void LaunchCheckoutFlowCallback(Message<Purchase> msg)
        {
            if (msg.IsError)
            {
                PlatformManager.TerminateWithError(msg);
                return;
            }

            Purchase p = msg.GetPurchase();
            IAP.ConsumePurchase(CONSUMABLE_1);  //这一句是后来加上来的。试试看
            Debug.Log("purchased " + p.Sku);
            m_gameController.AddPowerballs(3);
        }
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Am i right?

  • handsomeguoguohandsomeguoguo Posts: 15
    NerveGear
     public void BuyPowerBallsPressed()
        {
           
    #if UNITY_EDITOR
            m_gameController.AddPowerballs(1);
    #else
            IAP.LaunchCheckoutFlow(CONSUMABLE_1).OnComplete(LaunchCheckoutFlowCallback);
    #endif
        
            IAP.ConsumePurchase(CONSUMABLE_1);  //Added  the IAP.ConsumePurchase()  Method
        }
    
        private void LaunchCheckoutFlowCallback(Message<Purchase> msg)
        {
            if (msg.IsError)
            {
                PlatformManager.TerminateWithError(msg);
                return;
            }
    
            Purchase p = msg.GetPurchase();     
            Debug.Log("purchased " + p.Sku);
            m_gameController.AddPowerballs(3);        
        }
    
    Above is my new code. Finally it can buy the product multi-times.
    While the problem is:If I buy it again immediately after the last time buy action without doing anythings else, it still tell me that "You already own this item. You have purchased this item before.''  
    So do you met with this problem before and how to handle it?
Sign In or Register to comment.