Quick Start

This practical guide will walk you through the basic integration between your Android application and the Getnet payment application via Deeplink. By the end of this tutorial, you will have triggered a payment command and processed the transaction response.

Before you begin

Before proceeding with the steps below, make sure you can meet these prerequisites.

  • You need to understand what a Polling call (getnet://payment/v1/polling) to verify if the Getnet payment app is properly connected and ready to receive commands before starting a transaction.
  • Basic knowledge of Android Intents and onActivityResult.

Step 1: Validate the terminal connection (polling)

Before initiating a payment, it is a best practice to perform a Polling operation. This non-financial request verifies that the Getnet payment app is connected and ready to process transactions.

To perform this check, trigger an Intent using the following URI:

Polling URI: getnet://payment/v1/polling

Here's an example implementation:

Kotlin
val POLLING_REQUEST_CODE = 2001 val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/polling")) startActivityForResult(intent, POLLING_REQUEST_CODE)
information icon
Note: Polling does not require any parameters. Send the deeplink and the terminal responds with its current status.

The Getnet app returns the following parameters:

ParameterTypeDescription
resultStringResult of the operation: "0" for success (terminal ready).
resultDetailsStringDetailed message regarding the terminal status.
information icon
If the result is "0", you are cleared to proceed to the Payment.

Step 2: Initialize the payment transaction

Communication is handled via an Intent with a specific URI. For the purpose of this tutorial, you will create a payment transaction using the following URI:
Payment URI: getnet://payment/v1/payment

To initiate a payment, you must build an Intent with specific request parameters passed as extras. Below is the table of the required parameters for the payment transaction:

ParameterTypeRequiredDescription
amountStringYesTransaction amount with two implicit decimal places (e.g., "10000" = $100.00)
originalAmountStringYesValue in local currency to perform the transaction
receiptCodeStringYesIdentification code to be printed on receipt
callerIdStringYesUnique identifier to correlate request with response
Optional Parameters
ParameterTypeDescription
paymentMethodString"1" for Card, "2" for QR Code. Skips payment method selection screen.
operationModeString"1" for calculated mode, "0" for manual (default)
skipReceiptStringSet to "true" to suppress the customer receipt view screen after approval
allowPrintCurrentTransactionStringSet to "true" to let Getnet handle receipt printing, "false" to receive raw receipt data

Here is an example of an Android implementation:

Kotlin
private val PAYMENT_REQUEST_CODE = 1001 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Define the payment URI val paymentUri = Uri.parse("getnet://payment/v1/payment") // Configure the Intent with the required parameters val intent = Intent(Intent.ACTION_VIEW, paymentUri) intent.putExtra("amount", "10000") // $100.00 intent.putExtra("originalAmount", "10000") intent.putExtra("receiptCode", "123456") intent.putExtra("callerId", "payment_001") intent.putExtra("allowPrintCurrentTransaction", "true") // Start the activity and expect a result startActivityForResult(intent, PAYMENT_REQUEST_CODE) }

Step 3: Process the payment response

After the payment process completes, the Getnet app returns an Intent containing the transaction results. You must extract these extras to verify if the payment was approved.

Response Parameters
ParameterTypeDescription
resultStringResult of the operation: "0" for success, any other value indicates failure or cancellation
resultDetailsStringDetailed message about the transaction result
amountStringFinal charged amount with two implicit decimal places
receiptCodeStringIdentification code printed on receipt
callerIdStringThe unique identifier sent in the request
nsuStringGetnet transaction authorization code (unique per terminal)
authorizationCodeStringAuthorization code provided by the card issuer
brandStringCard brand used in the transaction (e.g., "VISA", "MASTERCARD")
cardLastDigitsStringLast 4 digits of the card used
cardBinStringFirst 8 digits of the card (BIN)
inputTypeStringCard input method: "021" (magnetic), "051" (chip), "071" (contactless), "801" (fallback)
installmentsStringNumber of installments (if applicable)
planIdStringInstallment plan ID used (if applicable)
gmtDateTimeStringTransaction timestamp in GMT format (MMDDhhmmss)
automationSlipStringReceipt data in JSON format (if allowPrintCurrentTransaction = "false")

Here's an example of a successful transaction response:

Text
{ "result": "0", "resultDetails": "APPROVED", "amount": "10000", "tip": "0", "receiptCode": "123456", "callerId": "payment_001", "nsu": "57003", "nsuLastSuccesfullMessage": "750057003", "paymentType": "credit", "brand": "VISA", "inputType": "051", "installments": "1", "planId": "", "Interest": "false", "gmtDateTime": "0612211725", "authorizationCode": "004433", "cardBin": "51559030", "cardLastDigits": "8015", "automationSlip": "" }
Use the onActivityResult method to extract the response parameters. Here's an example implementation of how to handle the payment response:
Text
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == PAYMENT_REQUEST_CODE && resultCode == RESULT_OK) { val extras = data?.extras ?: return // Transaction Status val result = extras.getString("result") val resultDetails = extras.getString("resultDetails") if (result == "0") { // Payment successful val nsu = extras.getString("nsu") val authCode = extras.getString("authorizationCode") val amount = extras.getString("amount") val brand = extras.getString("brand") val cardLastDigits = extras.getString("cardLastDigits") // Log or display success Log.d("Payment", "Success! NSU: $nsu, Auth: $authCode") } else { // Payment failed or cancelled Log.e("Payment", "Failed: $resultDetails") // Handle error appropriately } } }

Complete implementation example

Here's a complete example that brings together all three steps:

Kotlin
class PaymentActivity : AppCompatActivity() { private val POLLING_REQUEST_CODE = 2001 private val PAYMENT_REQUEST_CODE = 1001 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Step 1: Verify terminal is ready val pollingIntent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/polling")) startActivityForResult(pollingIntent, POLLING_REQUEST_CODE) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (resultCode == RESULT_OK && data != null) { val result = data.extras?.getString("result") when (requestCode) { POLLING_REQUEST_CODE -> { // If terminal is ready, proceed to payment if (result == "0") { // Step 2: Initiate payment val paymentIntent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/payment")) paymentIntent.putExtra("amount", "10000") paymentIntent.putExtra("originalAmount", "10000") paymentIntent.putExtra("receiptCode", "123456") paymentIntent.putExtra("callerId", "payment_001") paymentIntent.putExtra("allowPrintCurrentTransaction", "true") startActivityForResult(paymentIntent, PAYMENT_REQUEST_CODE) } else { // Terminal not ready val resultDetails = data.extras?.getString("resultDetails") Log.e("Polling", "Terminal not ready: $resultDetails") } } PAYMENT_REQUEST_CODE -> { // Step 3: Handle payment response if (result == "0") { val nsu = data.extras?.getString("nsu") val authCode = data.extras?.getString("authorizationCode") val amount = data.extras?.getString("amount") // Payment successful Log.d("Payment", "Success! NSU: $nsu") } else { val resultDetails = data.extras?.getString("resultDetails") // Payment failed or cancelled Log.e("Payment", "Failed: $resultDetails") } } } } } }

Next steps

Congratulations! You have successfully completed the basic integration between your Android application and the Getnet payment app via Deeplink.

You now have a working foundation for processing payments through the Getnet payment app. With this knowledge, you can expand your integration to handle more complex scenarios, implement additional payment options, and create a robust payment experience for your users.