# Create a Payment with Installments

Installment payments allow customers to split their purchase into multiple payments. Unlike standard sales, this flow is interactive: if the **authorization host** determines that installments are available (based on the card BIN and merchant contract), the Get Mini Android SDK will ask your application to provide the user's selection via a callback.

## Requirements

To support installments, your application must:
1.  **Implement the Callback**: Your `RedCLSPinPadInterface` implementation must override the `seleccionDeferPayment` method.
2.  **Enable Merchant Support**: Your merchant account and terminal must be configured by Get Mini to allow installment operations.

---

## Step 1: Implement the Selection Callback

During a standard card operation (`operativaConTarjeta`), if the **authorization host** identifies that installments are available, it will trigger the `seleccionDeferPayment` callback. You must present the options to the user and return the selection code.

```kotlin
import redcls.itpvpc.interfaces.RedCLSPinPadInterface
import redcls.itpvpc.data.RedCLSDeferPaymentData

override fun seleccionDeferPayment(deferPayment: RedCLSDeferPaymentData): String {
    // 1. 'deferPayment' contains the available installment options provided by the host.
    // 2. Present these options (e.g., 3 months, 6 months) to your user.

    val userSelectedCode = showInstallmentSelectionUI(deferPayment)

    // 3. Return the code of the selected option as a String.
    // Return "0" if the user wants to pay in full without installments.
    return userSelectedCode ?: "0"
}
```

<Callout type="note">

If your application does not wish to support this functionality, simply override the method to return `"0"`.

</Callout>

---

## Step 2: Execute the Payment Flow

There is no separate method for installment payments. You initiate a standard sale, and the Get Mini Android SDK manages the installment logic automatically if applicable.

```kotlin
import redcls.itpvpc.data.RedCLSOperativeWithCardData

val saleData = RedCLSOperativeWithCardData("300.00")

Thread {
    // This call will trigger 'seleccionDeferPayment' internally if installments are available
    val response = pinpadManager.operativaConTarjeta(saleData)

    if (response.status == 0) {
        Log.d("GetMini", "Deferred transaction successful")
        val tx = response.transactionData
        if (tx.result == "Autorizada") {
            Log.i("GetMini", "Installment sale approved. Auth: ${tx.autorizationNumber}")
        }
    } else {
        Log.e("GetMini", "SDK Error: ${response.status} - ${response.msgKO}")
    }
}.start()
```

---

## Step 3: Handle Transaction Results

After successful installment payment approval, process the result and ensure you handle the receipt data. The SDK provides specific **literals** that your application must print or display to provide the customer with the installment breakdown.

```kotlin
if (tx.result == "Autorizada") {
    Log.i("GetMini", "Installment sale approved. Auth: ${tx.autorizationNumber}")

    // The response includes specific receipt literals related to deferred payments.
    // Your application must print or display all returned literals (tx.literals)
    // to properly reflect the installment details on the receipt.
}
```

---

## Best Practices

- **Clear UI**: When `seleccionDeferPayment` is called, ensure your UI clearly displays the number of installments and any associated interest rates provided in the `RedCLSDeferPaymentData`.
- **Receipt Printing**: The Get Mini Android SDK fields used for printing (Anexo I of the manual) will include specific literals for installments. Ensure your receipt logic displays all `Literals` returned in the response.
- **Testing**: Not all cards support installments. Use specific test cards provided by Get Mini to verify this flow in the Integration environment.

## Next Steps

* [Create a Single-Step Payment](/en/get-mini/android-sdk/guides/process-single-step-payments) - Learn more about the core sale operation.
* [Create a Pre-authorized Payment](/en/get-mini/android-sdk/guides/process-preauthorized-payment) - Reserve and capture funds.
* [Security and Device Blinding](/en/get-mini/android-sdk/core-concepts/security-device-binding) - Protect your payment integration.