|
For Flash game developersBenefits
This is a brief introduction for Flash application developers. More details are available from www.carrot.org and from various CarrotPay documents available from this site. IntroductionCarrotPay offers a system for Flash game developers to embed sales directly into their Flash games and animations. In less than 10 lines of ActionScript 2, you can request a payment and verify that the payment has been make correctly before allowing a player to continue with the game. Payments may be as low as 0.1c per transaction (although larger payments are more common), and only take between 3 and 15 seconds to complete (depending on network activity). Best of all CarrotPay fees are a flat 2.5% for any transaction size or sales volume and you can have your money the same day. We think we have the best package for your in-game sales and your customers will love it too because it's so fast and simple to use. Try out our Demo Store now to get the user experienceThe basics
How it works
Adding payment requests to your applicationYou have a few options (as more fully described on the CarrotPay: Flash Integration Guide), but here follows a quick and dirty example. This example uses client-side only code. For more secure solutions see the CarrotPay: Flash Integration Guide. In addition to being simple to implement, a further very good aspect of this client-side only technique is that it is highly scalable. There is no need for you to be concerned with server-side coding or performance issues. CarrotPay will handle the load and you get the aggregate of all individual payments in one single lump sum each time you collect your money (less our fees of course). This method is complete secure so long as your game is not 'broken into' and reprogrammed. If that were to happen then the attacker will likely program around your payment code and simple help themselves to all your features. If this is a problem for you, you should consider some server-side interaction to protect against it. Step 1. Include the CarrotPay library
#include 'flash_carrot.as' //CarrotPay's payment library
Step 2. Create a payment object and tell it your merchant code.
var pay = new carrotpay('HHPQ-PVWQ-WSKV-KCLW'); //create payment object
Step 3. Determine the authorisation codes of your in-game product(s). Use the CarrotPay on-line Button Wizard to determine the authorisation codes for static items. For convenience, you may like to link your products to their authorisation code. This makes it easier to verify if a payment has been made correctly when the return url is returned (see Step - 6).
//product name and authorisation code pairs
Step 4. Declare a URL something like the line below. The domain part is displayed at the time of authorisation along with the price and description, and the parameters will be used once the URL has been returned to the application after payment. Note the product code (i.e. "recharge"), is referenced twice. Data that is presented inside square brackets (i.e. [...]), is transformed by CarrotPay into a cryptographic hash. (See CarrotPay: HTML Integration Guide for full details).
var recharge_url='http://www.flashgames.com?product=recharge&auth=[recharge]';
Step 5. Attach the payment request to an event. The first parameter is the price, the second a description (in UTF-8 format), and the third is the return url containing the product information and authorisation data.
Step 6. Once payment has been made,
That's it! You may attach any number of Note: CarrotPay knows nothing of your products in advance so you may have as many as you wish and use them in as many games as you wish. |