Developers

Integrate mobile payments and monetize with Mocopay

Our developer center provides all the details for a simple and smooth integration so you could easily add mobile payments with Mocopay.

Mandatory preconditions

Before you start integrating Android SDK please make sure that you have done the following through our control box:

  1. Created your payment service.
  2. Downloaded Android SDK library.

Minimal Android API level is 10, if your application is using lower than this level you can’t use the payment SDK and should integrate our cross platform solution.

To use the SDK, your application needs to request certain permissions and declare a few Android components in its AndroidManifest.xml file.

Required manifest elements

If you are only using the web flow, there is only one required permission that you need to declare in your manifest:

<uses-permission android:name="android.permission.INTERNET" />

The SDK uses an Activity and a Service that also need to be specified in your manifest declaration. You can use the following snippet to include them into your application.

<activity
    android:name="ch.nth.payment.PaymentActivity"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<service
    android:name="ch.nth.payment.PaymentService"
    android:exported="false"/>

Optional manifest elements

When using the native flow, you must, in addition to the required Internet permission, request the following ones:

<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />

Also, there is a convenience class in the SDK called PaymentUtils. This class will be mentioned later on in the integration guide, but for now it is important to know that some of the methods from that class require the following permission:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

These methods are as follows:

  • PaymentUtils.getAvailableID(Context)
  • PaymentUtils.getMSISDN(Context)
  • PaymentUtils.getIMEI(Context)

That’s it for the preconditions! Please proceed to the integration guide to find out how to integrate the SDK in your Activities and Fragments.