fortumo.*

Type library
Revision 2014.2381
Keywords fortumo
Sample code http://developers.fortumo.com/wp-content/uploads/CoronaSample.zip
See also
Availability Pro, Enterprise

Overview

The Fortumo plugin enables developers to charge for premium features and sell virtual credits inside their android applications.

Sign Up

To use the Fortumo service, please sign up for an account.

Platforms

The following platforms are supported:

Syntax

local fortumo = require "plugin.fortumo"

Functions

Properties

Project Settings

SDK

When you build using the Corona Simulator, the server automatically takes care of integrating the plugin into your project.

All you need to do is add an entry into a plugins table of your build.settings. The following is an example of a minimal build.settings file:

settings =
{
    plugins =
    {
        -- key is the name passed to Lua's 'require()'
        ["plugin.fortumo"] =
        {
            -- required
            publisherId = "com.fortumo",
        },
    },      
}

Enterprise

Add the Fortumo jar into your project and make sure that the following lines are present in your AndroidManifest.xml file:

<!-- Under <manifest> -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />

<permission android:protectionLevel="signature" android:name="[your_package_name_here].PAYMENT_BROADCAST_PERMISSION" />
<uses-permission android:name="[your_package_name_here].PAYMENT_BROADCAST_PERMISSION" />

<!-- Under <application> -->
<receiver android:name="mp.MpSMSReceiver">
    <intent-filter>
        <action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
    </intent-filter>
</receiver>
<service android:name="mp.MpService" />
<service android:name="mp.StatusUpdateService" />
<activity android:name="mp.MpActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" />

NB! If you're application is using proguard, then ensure that your .pro file contains the following line:

-keep class mp.** { *; }

Sample Code

You can access sample code here.

function onPaymentComplete(response)
    local productName = response.productName
    local serviceId = response.serviceId

    if response.billingStatus == fortumo.BILLING_STATUS_BILLED then
        -- The payment was successful
    elseif response.billingStatus == fortumo.BILLING_STATUS_PENDING then
        -- The payment was probably successful (must wait to be sure)
    else
        -- Cancelled or failed
    end
end

local request = fortumo.newPaymentRequest()

request:setService("serviceId", "appSecret")
request:setProductName("productName")
request:setType(fortumo.PRODUCT_TYPE_NON_CONSUMABLE)

fortumo.makePayment(request, onPaymentComplete)

Support

More support is available from the Fortumo team: