Android inter-app integration
4 min
the cabcard driver app allows users to log in accept payments from an android device the app can be installed from the google play store inter app integration it is possible to initiate transactions and receive the transaction outcome from a third party app using the android intents api this is referred to as an inter app integration it is a lightweight integration suitable for data dispatch providers although it can be used with no further integration, for best results integration with the cabcard webhooks service and http restful api is recommended an example app (react native / expo) is provided here https //github com/ccs group/cabcard go interapp example the basic steps are create an intent, setting the package name to services cabcard driver and the classname to services cabcard driver specify the action as transaction by setting an intent extra named "action" with value transaction compile the transaction parameters this must include identifier a unique identifier (e g a uuid) for the intent amount the transaction amount in currency minor units (pence), for example £10 56 (ten pounds and fifty six pence) would be supplied as 1056 optionally you may also include the following transaction parameters reference a transaction reference which will be stored against the resulting transaction, for example a booking, trip or order id (max 99 characters) originator the name of your app, which will be displayed in the ui (max 20 characters) currency the transaction currency iso code (alphanumeric 3 characters), e g "gbp" currently, only gbp is supported so this field will be ignored customeremailaddress optional, used for convenient sending of receipts and e com fallback customerphonenumber optional, used for convenient sending of receipts and e com fallback this is a simplistic java sample code example public void takepayment() { intent intent = new intent(); intent setclassname("services cabcard driver", "services cabcard driver mainactivity"); // indicate that you want to start a transaction, using the "action" extra intent putextra("action", "transaction"); // supply the transaction parameters as stringified json intent putextra("transaction", "{\\"amount\\" 1644,\\"currency\\" \\"gbp\\",\\"originator\\" \\"your app name\\",\\"reference\\" \\"demo145\\",\\"identifier\\" \\"0c26fa5d c06c 4f9a 9898 34bed866dd33\\"}"); if (intent resolveactivity(getpackagemanager()) != null) { startactivityforresult(intent); } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { if (resultcode == result ok) { // handle transaction result here } }