Get Last Transaction Data (myPOS Smart SDK)
You can retrieve the last recorded transaction directly from the system content provider without needing to track it manually within your app.
Access the Last Transaction
To get transaction info, query the LastTransactionProvider:
final Uri CONTENT_URI = Uri.parse("content://com.mypos.providers.LastTransactionProvider/last_transaction");
Cursor cursor = getContentResolver().query(
CONTENT_URI,
new String[] { // projection parameters you want to receive in response. Choose only the needed ones
"amount",
"currency",
"reference_number",
"reference_number_type",
"operator_code",
"response_code",
"stan",
"date_time",
"authorization_code",
"card_brand",
"transaction_approved",
"cvm",
"transaction_type",
"rrn"
},
null,
null,
null
);
if (cursor == null)
return; // there is no last transaction recorded
cursor.moveToFirst();
double amount = cursor.getDouble(cursor.getColumnIndex("amount"));
String currency = cursor.getString(cursor.getColumnIndex("currency"));
String referenceNumber = cursor.getString(cursor.getColumnIndex("reference_number"));
int referenceNumberType = cursor.getInt(cursor.getColumnIndex("reference_number_type"));
String operatorCode = cursor.getString(cursor.getColumnIndex("operator_code"));
String responseCode = cursor.getString(cursor.getColumnIndex("response_code"));
String stan = cursor.getString(cursor.getColumnIndex("stan"));
String dateTime = cursor.getString(cursor.getColumnIndex("date_time"));
String authorizationCode = cursor.getString(cursor.getColumnIndex("authorization_code"));
String cardBrand = cursor.getString(cursor.getColumnIndex("card_brand"));
boolean transactionApproved = cursor.getInt(cursor.getColumnIndex("transaction_approved")) == 1;
String cvm = cursor.getString(cursor.getColumnIndex("cvm"));
String transactionType = cursor.getString(cursor.getColumnIndex("transaction_type"));
String rrn = cursor.getString(cursor.getColumnIndex("rrn"));
if(!cursor.isClosed())
cursor.close();
Response Data Fields
Here’s a breakdown of what’s returned by the last transaction or in the result intent after any operation:
🧩 General Transaction Info
| Key | Description |
|---|---|
| reference_number | Internal myPOS reference ID |
| rrn | Retrieval Reference Number |
| date_time | Date & time of the transaction (format: YYMMDDHHmmss) |
| amount | Transaction amount |
| currency | Currency code (e.g. EUR, USD) |
| authorization_code | Code returned by the card issuer |
| status | Transaction status (see status codes table) |
| status_text | Textual version of the status |
| transaction_approved | true if approved, false if declined |
| response_code | Issuer's response code ("00" = approved; others indicate decline) |
Card Details
| Key | Description |
|---|---|
| cardholder_name | Cardholder’s name (if available) |
| pan | Obfuscated card number (e.g., XXXX-XXXX-XXXX-8008) |
| pan_hash | Secure hash of the PAN (Primary Account Number) |
| card_brand | Card scheme (e.g., VISA, MASTERCARD) |
| card_entry_mode | How the card was used: - ENTRY_MODE_MAGSTR - ENTRY_MODE_EMV - ENTRY_MODE_CONTACTLESS - ENTRY_MODE_CONTACTLESS_MCHIP - ENTRY_MODE_MANUAL |
| CVM | Cardholder Verification Method: - P: PIN - S: Signature - N: No CVM |
| AID | Application Identifier from the card chip |
| application_name | Application label from the card chip |
Receipt & Terminal
| Key | Description |
|---|---|
| signature_required | Indicates if a signature line is required on the receipt |
| TSI | Transaction Status Indicator |
| TVR | Terminal Verification Result |
| STAN | System Trace Audit Number |
| TID | Terminal ID |
| update_pending | true if a terminal update is available, otherwise false |
| operator_code | Optional code identifying the terminal operator |
Dynamic Currency Conversion (DCC)
| Key | Description |
|---|---|
| dcc_available | Indicates if Dynamic Currency Conversion (DCC) was offered |
| amount_dcc | Amount converted into the selected foreign currency |
| currency_dcc | Currency used for DCC (e.g., USD, GBP) |
| exchange_rate | Exchange rate applied for the conversion |
Merchant Data (merchant_data Bundle)
| Key | Description |
|---|---|
| billing_descriptor | Descriptor shown on the cardholder’s bank statement |
| address_line1 | Address line 1 |
| address_line2 | Address line 2 |
| MID | Merchant ID |
| custom_receipt_row1 | Footer row 1 for receipts |
| custom_receipt_row2 | Footer row 2 for receipts |
Installment Info (installment_data Bundle)
| Key | Description |
|---|---|
| number (int) | Number of installments |
| interest_rate (double) | Interest applied |
| fee (double) | Additional fee |
| annual_percentage_rate | Annual Percentage Rate (APR) |
| total_amount (double) | Total amount due |
| first_installment_amount | Value of the first installment |
| subsequent_installment_amount | Value of each remaining installment |
Most fields are returned as strings. Some keys may be missing depending on transaction type or card capabilities.
Transaction Result Codes (Reference)
public class TransactionProcessingResult {
public static final int TRANSACTION_SUCCESS = 0;
public static final int TRANSACTION_CANCELED = 1;
public static final int TRANSACTION_DECLINED = 2;
public static final int TRANSACTION_FAILED = 3;
public static final int DEVICE_NOT_ACTIVATED = 4;
public static final int NO_DATA_FOUND = 5;
public static final int INVALID_CURRENCY = 6;
public static final int INVALID_AMOUNT = 7;
}
Tip: Use the transaction_approved boolean or status code for quick validation. If needed, log reference_number, authorization_code, and rrn for reconciliation or support purposes.