Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
Posts: 9
Registered: ‎08-29-2013
My Device: Z10
My Carrier: Viettel
Accepted Solution

Is that possible to get existing purchases with sandbox account?

[ Edited ]

Hi All!
I'm testing the payment service in my app. After downloading the app from BB World, i'm able to purchase the in-app items  with my sandbox account. But I still have some issues while getting the existing purchases. I also tried to set the parameter of the paymentSystem.getExistingPurchase function to true and false but there's no result at all. 

paymentSystem.getExistingPurchase(false);
paymentSystem.addEventListener(PaymentSuccessEvent.GET_EXISTING_PURCHASES_SUCCESS,function(e: PaymentSuccessEvent):void

{

       var purchase : Purchase
       var pastPurchases : Purchases = e.existingPurchases;
      for(var i:int = 0;i<=pastPurchases.length;i++)
      {

                  purchase = pastPurchases[i]

                  if(mySKU == purchase.digitalGoodSKU)

                  {

                     ////my code here!
                      

                   }

 

       }

      

});

Any help would be greatly appreciated. Thanks in advance!

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Is that possible to get existing purchases with sandbox account?

try adding the event listener first, and then call getExistingPurchas()

 

 

for some base code, see here

https://developer.blackberry.com/air/documentation/trs1351711928411.html#trs1351711928411

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
New Contributor
Posts: 9
Registered: ‎08-29-2013
My Device: Z10
My Carrier: Viettel

Re: Is that possible to get existing purchases with sandbox account?

[ Edited ]

I did not copy code from my IDE. In my real code, the paymentSystem.getExistingPurchases() called after all events added Smiley Happy Thanks!

Umm... I'm going to change the license model of my in-app items to consumable. I found this line in the document "The Payment Service does not set any controls on the number of times that a user can purchase these goods." 
Do I need call paymentSystem.getExistingPurchases() if my in-app items are consumable?, Are they also stored on the Payment Server?

Anyone can help me again?

 





 

     

Highlighted
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Is that possible to get existing purchases with sandbox account?

I've been told that it is a good idea to store IAP information with the app (app-storage), so the server does not have to check each time. Only ask if nothing has been stored (as-well-as provided a refresh under settings). This will allow the app to work without a network connection.

It all depends what the user is "purchasing"? If it is levels in a game, you want to know about those. Consumables are more like things they can have only once and if they want it again or another one, they have to buy it.