none
windows phone 8 in-app purchase product license is not active RRS feed

  • 常规讨论

  • Hi, Recently, Our windows phone 8 game in-app purchase get a lot of problem from our user. People told me that when they play our game and paid for the virsual product with in-app purchase,yet got nothing.

    I debug our game and found that when people had paid for the bill, the code will check the product license, if the license is active, then the programme will give the visual product to who had paid for it.

    Our game was develop with pure C++, base on open source game engine cocos2d-x.

    code as follow:

      std::string diamondId = getProductIdByItemId(itemid);

             if (diamondId.length() == 0 || remark == NULL)

             {

                       return;

             }

             productid_ = stdStringToPlatformString(diamondId);

             remark_ = remark;

             IAsyncOperation<Platform::String^>^ receipt = CurrentApp::RequestProductPurchaseAsync(productid_, true);

             auto receiptTask = create_task(receipt);

             // run to here, the game will check in to in-app purchase view

             receiptTask.then([this](Platform::String^ xml)

             {

                       // people had paid for the bill and begin to come back to game view

                       IMapView<Platform::String^, ProductLicense^>^ product = CurrentApp::LicenseInformation->ProductLicenses;

                       ProductLicense^ license = product->Lookup(productid_)

                       // PROBLEM:people had paid for the bill, but the product license is still not active,yet code couldn't run sendAddGood()

                       if (license->IsActive)

                       {

                                // PROBLEM: can not run here

                                if(license->IsConsumable)

                                {

                                        // PROBLEM: can not run here

                                         sendAddGoods(productid_, xml);

                                }

                       }

             }).then([this](task<void> t)

             {

                       try

                       {

                                t.get();

                       }

                       catch (Platform::COMException^ e)

                       {

                       }

             });

    2014年7月22日 7:31

全部回复