This document provides an overview of in-flash payments which allow seamless payments within games without interrupting gameplay. It describes how in-flash payments work, the benefits for users and developers, and how to integrate the payments platform via API. The document also outlines the product architecture, security objectives, and roadmap for additional features and currencies. Integration instructions are provided in multiple steps including collecting user data, configuring the payments service, and handling events for requests.
39. service = new SocialGoldService(); service.userId = parameters.userId; service.signingKey = parameters.signingKey; service.offerId = ‘yourofferidhere’; // Set a display object container for the buyCurrency UI: service.modalParent = stage; // Pass in ‘sandbox’ or ‘production’ for environment: service.environment = parameters.environment; // Set true to use Flash UI for buyCurrency calls: service.useInAppPayments = true; // (Optional) Set true when debugging: service.debug = (parameters.environment != ‘production’);
41. var request:SocialGoldRequest = service.buyCurrency(); // Called on Success: request.addEventListener(SocialGoldEvent.SUCCESS, buyCurrencySuccessHandler); // Called on Failure: request.addEventListener(SocialGoldEvent.FAILURE, buyCurrencyFailureHandler); // Called after every request: request.addEventListener(SocialGoldEvent.COMPLETE, buyCurrencyCompleteHandler); private function buyCurrencySuccessHandler(event:SocialGoldEvent):void { trace(">> buyCurrency SUCCESS"); } private function buyCurrencyFailureHandler(event:SocialGoldEvent):void { trace(">> buyCurrency FAILURE"); } private function buyCurrencyCompleteHandler(event:SocialGoldEvent):void { trace(">> buyCurrency COMPLETE"); }
43. // Called when UI load starts: request.addEventListener(SocialGoldEvent.UI_LOAD_STARTED, uiLoadStartedHandler); // Called when UI load is complete: request.addEventListener(SocialGoldEvent.UI_LOAD_COMPLETED, uiLoadCompletedHandler); private function uiLoadStartedHandler(event:SocialGoldEvent):void { trace(">> uiLoadStartedHandler"); addChild(yourLoadingAnimationInstance); } private function uiLoadCompletedHandler(event:SocialGoldEvent):void { trace(">> uiLoadCompletedHandler"); removeChild(yourLoadingAnimationInstance); }