Create a Single-Step Payment

This guide walks you through processing a standard payment transaction (Sale) using the Get Smart application. A payment transaction charges a specified amount to a customer's card in a single step. This is the most common integration path for point-of-sale applications.

Requirements

Before you begin, ensure you have:

  • Get Smart application installed and configured on the Android device
  • Merchant account credentials provided by Get Smart
  • Permission to launch external Intents in your application
information icon
Tip: Contact your Get Smart representative to obtain merchant credentials and verify your Get Smart application is properly configured.

Payment Transaction Process

This section guides you through the process of creating and executing a payment transaction with the Get Smart App2App integration. You'll learn how to launch the Intent and handle the transaction result.

Step 1: Create and Launch the Payment Intent

A payment transaction involves creating an Intent with the Get Smart action, adding the transaction parameters, and launching it using startActivityForResult. The Get Smart application processes the payment and returns the result to your application.

The table below lists the parameters you need to include in your Intent:

ParameterTypeRequiredDescription
amountdoubleYesThe total amount to charge
typeintYesSet to 1 for Sale transactions
invoiceStringNoOptional order number or identifier for tracking

Always wrap the Intent launch in a try-catch block to handle cases where the Get Smart application is not installed on the device.

The following code example shows how to create and launch a payment Intent:

java
// Define request code for result handling static final int REQUEST_CODE_PAYMENT = 1001; // Initialize the Intent with the Get Smart action Intent intent = new Intent("es.android.redsys.mPOS.movil.tpvAndroid_PAYMENT_REQUEST"); // Add transaction parameters intent.putExtra("amount", 25.90); intent.putExtra("type", 1); // 1 = Sale intent.putExtra("invoice", "INV-12345"); // Optional tracking ID // Launch the Intent with error handling try { startActivityForResult(intent, REQUEST_CODE_PAYMENT); } catch (ActivityNotFoundException e) { // Display a message to the user to install the Get Smart app new AlertDialog.Builder(this) .setTitle("Get Smart App Not Found") .setMessage("Please install and configure the Get Smart application.") .setPositiveButton("OK", null) .show(); }

Step 2: Receive and Handle the Transaction Result

After the Get Smart application processes the payment, it returns control to your application through the onActivityResult callback method. You should verify that the resultCode is RESULT_OK and extract the transaction details from the returned Intent extras.

At the end of a successful transaction, you will receive an authorization code and order ID, which are used to identify and track this payment.

The following code example shows how to handle the transaction result:

java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE_PAYMENT) { if (resultCode == RESULT_OK && data != null) { // Transaction successful - extract response data String authCode = data.getStringExtra("AUTHORIZATION"); String orderId = data.getStringExtra("ORDER"); // Process successful payment } else { // Transaction cancelled or failed // Handle error appropriately } } }

For complete details on all response fields and error handling, see Handle Transaction Results.

Next Steps

Now that you have successfully processed a single-step payment transaction, you can explore more features of the Get Smart App2App integration: