Advertisement
Guest User

Untitled

a guest
May 26th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. try
  2. {
  3. InAppBilling.init( APPLICATION_KEY );
  4. if (InAppBilling.isSupported)
  5. {
  6. trace( "InAppBilling.service.version = " + InAppBilling.service.version );
  7.  
  8. InAppBilling.service.addEventListener( InAppBillingEvent.SETUP_SUCCESS, setup_successHandler );
  9. InAppBilling.service.addEventListener( InAppBillingEvent.SETUP_FAILURE, setup_failureHandler );
  10.  
  11. InAppBilling.service.addEventListener( InAppBillingEvent.PRODUCTS_LOADED, products_loadedHandler );
  12. InAppBilling.service.addEventListener( InAppBillingEvent.PRODUCTS_FAILED, products_failedHandler );
  13. InAppBilling.service.addEventListener( InAppBillingEvent.INVALID_PRODUCT, product_invalidHandler );
  14.  
  15. InAppBilling.service.addEventListener( PurchaseEvent.PURCHASE_SUCCESS, purchase_successHandler );
  16. InAppBilling.service.addEventListener( PurchaseEvent.PURCHASE_PURCHASING, purchase_purchasingHandler );
  17. InAppBilling.service.addEventListener( PurchaseEvent.PURCHASE_RESTORED, purchase_restoredHandler );
  18. InAppBilling.service.addEventListener( PurchaseEvent.PURCHASE_CANCELLED, purchase_cancelledHandler );
  19. InAppBilling.service.addEventListener( PurchaseEvent.PURCHASE_FAILED, purchase_failedHandler );
  20.  
  21. InAppBilling.service.addEventListener( InAppBillingEvent.RESTORE_PURCHASES_SUCCESS, restorePurchases_successHandler );
  22. InAppBilling.service.addEventListener( InAppBillingEvent.RESTORE_PURCHASES_FAILED, restorePurchases_failedHandler );
  23.  
  24. InAppBilling.service.addEventListener( InAppBillingEvent.CONSUME_SUCCESS, consumePurchase_successHandler );
  25. InAppBilling.service.addEventListener( InAppBillingEvent.CONSUME_FAILED, consumePurchase_failedHandler );
  26.  
  27. // Set the required service type and call setup
  28. InAppBilling.service.setServiceType( InAppBillingServiceTypes.GOOGLE_PLAY_INAPP_BILLING );
  29. InAppBilling.service.setup( GOOGLE_PLAY_INAPP_BILLING_KEY );
  30. }
  31. else
  32. {
  33. trace( "InAppBilling not supported" );
  34. }
  35. }
  36. catch (e:Error)
  37. {
  38. trace( e );
  39. }
  40.  
  41. // com.distriqt.InAppBilling
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement