# QR Code Payment

This guide shows you how to initiate and process QR Code payments using Getnet's App2App integration on Android terminals. QR Code payments provide a contactless payment option that customers can complete using their mobile wallets.

## Before you begin

Before starting, ensure you have:

* **Polling completed**: Perform a [Polling call](/en/app2app/first-steps-a2a/create-polling-guide) (`getnet://payment/v1/polling`) to verify the Getnet Payment App is properly connected and ready to receive commands.
* **Getnet application installed** on the terminal.

> **Parameter limitations**: Features like Tips (`tip`), Installments (`installments`), and Plan IDs (`planId`) are not supported in the QR flow and will be ignored by the Payment App if sent.

## Step 1: Configure and send the payment Intent

To process a QR Code payment, configure the Intent with the required parameters and set the `paymentMethod` to `"2"` for QR Code.

The following table describes the parameters you need to include in the payment request:

| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| `amount` | String | Yes | Transaction amount (with two implicit decimal places, e.g., "10000" = \$100.00) |
| `receiptCode` | String | Yes | ID printed on the receipt for merchant tracking. |
| `callerId` | String | No | Unique identifier to correlate request with response |
| `paymentMethod` | String | Yes | Set to `"2"` to trigger QR Code payment flow |
| `skipReceipt` | String | No | Set to `"true"` to suppress the customer receipt view screen after approval |
| `allowPrintCurrentTransaction` | String | No | Set to `"true"` to let Getnet handle receipt printing (default), `"false"` to receive raw receipt data |

Here's the complete implementation:

```
private val REQUEST_CODE = 1001  

override fun onCreate(savedInstanceState: Bundle?) {      
    super.onCreate(savedInstanceState)
    
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/payment"))
    intent.putExtra("amount", "10000")           // $100.00
    intent.putExtra("receiptCode", "000123")
    intent.putExtra("callerId", "qr_payment_001")
    intent.putExtra("paymentMethod", "2")        // 2 = QR Code
    
    startActivityForResult(intent, REQUEST_CODE)
}
```

## Step 2: Follow the terminal UI flow

When the intent is sent, the Getnet Payment App takes control of the UI. It is important to account for the following timeout behaviors:

1. **QR Display (Screen A)**: The terminal displays the QR Code for 180 seconds. If not scanned within this window, the transaction expires.

2. **Processing (Screen B)**: Once scanned, the app waits up to 60 seconds for the external wallet to authorize the payment.

## Step 3: Extract the response

The Getnet terminal returns the transaction result via `onActivityResult`.

Here's an example of a successful QR Code payment response:

```
{
  "result": "0",
  "resultDetails": "APPROVED",
  "amount": "10000",
  "nsu": "57003",
  "callerId": "qr_payment_001",
  "authorizationCode": "004433",
  "gmtDateTime": "0115164500",
  "paymentType": "QRCODE"
}
```

**Response Parameters**

The response includes the following fields that contain important transaction information:

| Field | Description |
| :--- | :--- |
| result | Transaction status code: `"0"` (success), `"1"` (denied), `"2"` (canceled), `"3"` (error), `"4"` (unknown) |
| resultDetails | Detailed message about the transaction result (e.g., "APPROVED", "TIMEOUT") |
| paymentType | Payment method used. For QR Code payments, this will be `"QRCODE"` |
| nsu | Getnet transaction authorization code (NSU). Store this for reconciliation and refunds |
| authorizationCode | Authorization code provided by the payment processor |
| amount | Final processed transaction amount |
| gmtDateTime | GMT date and time when the transaction was processed (format: MMDDhhmmss) |
| callerId | Echoes back the unique identifier sent in the original request |

Here's how to extract these fields in your code:

```
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    
    if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
        val extras = data?.extras
        
        val result = extras?.getString("result")                // "0" = Success
        val resultDetails = extras?.getString("resultDetails")  // e.g., "APPROVED"
        val nsu = extras?.getString("nsu")                      // Getnet Reference
        val authCode = extras?.getString("authorizationCode")   // Authorization Code
        val paymentType = extras?.getString("paymentType")      // Will be "QRCODE"
    }
}
```

## Next steps

Now that you've implemented QR Code payments, you can:

- Learn how to process [Refunds and Cancellations](/en/app2app/core-concept-a2a/refund-and-cancellation) for QR Code transactions
- Implement [Custom Receipt Printing](/en/app2app/core-concept-a2a/printing-responsibility) using the `automationSlip` parameter
- Explore [Single-Step Payments](/en/app2app/payment-guides-a2a/create-single-step-payment) for faster checkout experiences