For Flash game developers

Benefits

  • Sell in-game items in less than 10 lines of Actionscript
  • Fees are only 2.5% per transaction
  • No minimun transction fee
  • Transactions can be complete in as little as 3 seconds
  • Receive your money same day
  • No charge backs - ever!

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.

Introduction

CarrotPay 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 experience

The basics

  • You arrange for your application to request payments as part of the game play.
  • Customers pay with Carrot-WebCoins from their desktop purse.
  • Customers top-up their purse from time-to-time using a Credit card or PayPal.
  • CarrotPay collects and verifies the WebCoins and credits your account.
  • You collect your WebCoin payments from CarrotPay whenever you like - using your purse.
  • You may immediately spend the WebCoins on other on-line products and services or transfer them to you PayPal or Bank account whenever it makes sense.

How it works

  • Register first
    1. In order to complete registration you first need to install a CarrotPurse, which is a variation on the same desktop purse used by your customers.
    2. You register as a CarrotPay merchant to obtain a merchant id.
    3. Registration is fast (under 1 min.), and can be anonymous - or you may supply a little information so that we can promote you.
  • Add payments to your application
    1. Download CarrotPay: Flash Integration Guide and 'flash_carrot' ActionScript library
    2. Add a payment function to any number of icons or any other script element.
  • Release your application into the wild
  • When players trigger a payment request, their desktop purse will ask them to authorise and after CarrotPay has been verified, the money is immediately credited to your merchant account.
  • Collect the cash from your merchant account as often as you like and transfer it to PayPal or directly to your bank once you have accumulated enough money.

Adding payment requests to your application

You 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
var feature:Object={recharge:'lkcqmbhs', shield:'llpsbhzk'};

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.

mouseListener.onMouseDown = function(){//connect a payment to an event
   pay.startPayment('0.1','Recharge battery',recharge_url);
}

Step 6. Once payment has been made, pay.URL() will be called with the processed url as a parameter. The 'auth' parameter in the url will have been transformed into the authorisation code for the specified product. The following getParam()(example code here),simply extracts the named parameter's value from the url.

pay.URL=function(url:String){
  //Check auth is correct for this product
  if(getParam(url,'auth') == feature[getParam(url,'product')]) { 
    if(getParam(url,'product') == 'recharge')
       increasePower(); //Do something appropriate for this product
    else if(getParam(url,'product') == 'shield')
       addShield(); //Do something appropriate for this product
  }
}

That's it! You may attach any number of startPayment() functions to a variety of events by specifying a different product for each.

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.