Skip to main content

Documentation

Android Project Setup
Package query declaration

Add the following to your AndroidManifest.xml so Android allows your app to see the Core package:

<queries>
    <package android:name="net.rapyd.core"/>
</queries>
Callback activity

Your main activity must declare an intent filter for the ACTION_CALLBACK action so Core can return control to your app after a transaction:

<activity
    android:name=".MainActivity"
    android:exported="true">

    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>

    <intent-filter>
        <action android:name="ACTION_CALLBACK"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>

</activity>
Broadcast receiver

Declare a BroadcastReceiver to receive results from Core. Register every action you intend to handle:


<receiver
    android:name=".receivers.ResultReceiver"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="TRANSACTION_RESULT_ACTION"/>
        <action android:name="TRANSACTION_CANCELLED_ACTION"/>
        <action android:name="TRANSACTION_STATUS_ACTION"/>
        <action android:name="VOID_RESULT_ACTION"/>
        <action android:name="END_OF_DAY_RESULT_ACTION"/>
        <action android:name="LAST_END_OF_DAY_RESULT_ACTION"/>
        <action android:name="X_REPORT_RESULT_ACTION"/>
        <action android:name="CONFIG_RESULT_ACTION"/>
        <action android:name="DAILY_SALES_ACTION"/>
        <action android:name="ACTION_GET_TRANSACTION_RESULT"/>
        <action android:name="ACTION_GET_TRANSACTION_IN_PROGRESS_RESULT"/>
        <action android:name="TRANSACTION_LIST_RESULT"/>
        <action android:name="ACTION_GET_AVAILABLE_MERCHANTS_RESULT"/>
        <action android:name="ACTION_OFFLINE_STATUS"/>
        <action android:name="ACTION_GET_PRINT_STATUS_RESULT"/>
        <action android:name="ACTION_CARD_DATA"/>
        <action android:name="ACTION_CORE_FAILED"/>
    </intent-filter>
</receiver>
ResultReceiver implementation

public class ResultReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent == null) return;

        switch (intent.getAction()) {

            case Messages.TRANSACTION_RESULT_ACTION: {
                TransactionResult result = WrapperUtils.getTransactionResultFromJson(
                    intent.getStringExtra(Messages.TRANSACTION_RESULT));
                // Handle approved/declined transaction result
                break;
            }

            case Messages.TRANSACTION_CANCELLED_ACTION: {
                // Transaction was cancelled before completion
                break;
            }

            case Messages.TRANSACTION_STATUS_ACTION: {
                String status = intent.getStringExtra(Messages.TRANSACTION_STATUS);
                String uti    = intent.getStringExtra(Messages.TRANSACTION_UTI);
                // Update UI with in-progress status
                break;
            }

            case Messages.VOID_RESULT_ACTION: {
                boolean voided = intent.getBooleanExtra(Messages.VOID_RESULT, false);
                String uti     = intent.getStringExtra(Messages.TRANSACTION_UTI);
                break;
            }

            case Messages.END_OF_DAY_RESULT_ACTION: {
                String eod = intent.getStringExtra(Messages.END_OF_DAY_RESULT);
                break;
            }

            case Messages.CONFIG_RESULT_ACTION: {
                Config config = WrapperUtils.getConfigFromJson(
                    intent.getStringExtra(Messages.CONFIG_RESULT));
                break;
            }

            case Messages.ACTION_CORE_FAILED: {
                // Core failed to start — show an error to the user
                break;
            }
        }
    }
}
Wrapper library

Add the Rapyd wrapper library to your Gradle dependencies. The wrapper provides the Api, Messages, Parameters, and TransactionType classes used throughout this guide.



dependencies {
    implementation 'net.rapyd:rapyd_pax_pos_wrapper:<version>'
}