fortumo.*

Type library
Revision 2014.2450
Keywords fortumo
Availability Pro, Enterprise
Platforms Android

Overview

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

Registration

To use the Fortumo service, please register for an account.

Functions

Properties

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    plugins =
    {
        ["plugin.fortumo"] =
        {
            publisherId = "com.fortumo",
            supportedPlatforms = { android=true },
        },
    },      
}

Corona Enterprise

To use Fortumo in 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" />

Additionally, if your application is using ProGuard, ensure that the .pro file contains the following line:

-keep class mp.** { *; }

Sample Code

http://developers.fortumo.com/wp-content/uploads/CoronaSample.zip

Example

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