# Create a Payment with Installments

The **Get Smart SDK** supports deferred payments. This feature allows cardholders to split the transaction amount into installments directly at the Point of Sale.

## Prerequisites

Before attempting an installment payment, you should verify that the terminal is configured to support this feature.

### Checking Availability

You can check if the deferred payment feature is enabled in the current configuration by inspecting the `TpvInfo` object obtained during initialization.

```java
suspend fun checkInstallmentSupport() {
    val result = initializationRepository.getTpvInfoRepositoryResult()

    if (result is RepositoryResult.Success) {
        val config = result.data.config

        // Check the 'showPlazox' flag
        if (config.showPlazox) {
            println("✅ Installments (Plazox) are enabled on this device.")
        } else {
            println("❌ Installments are disabled.")
        }
    }
}
```

## Performing the Payment

To initiate an installment payment, you use the standard `makePayment` function but provide the optional `financialConditions` parameter.

**Function**: `makePayment`
**Parameter**: `financialConditions` (Type: `FinancialConditions?`).

### Implementation

```java
suspend fun payWithInstallments(amount: BigDecimal) {
    // 1. Define the amount
    val money = Money(amount, Currency.getInstance("EUR"))

    // 2. Define Financial Conditions
    // Pass the specific conditions required (or an empty object depending on specific bank logic)
    // Note: The specific structure of FinancialConditions depends on the library version
    val conditions = FinancialConditions(/* ... configuration parameters ... */)

    // 3. Call makePayment with the conditions
    val result = paymentRepository.makePayment(
        amount = money,
        financialConditions = conditions // Trigger the financial flow
    )

    handlePaymentResult(result)
}
```

<Callout type="note">

If the card supports installments and the feature is enabled (`showPlazox`), the Get Smart SDK Payment Service may automatically prompt the user to choose installments on the device screen, even without strict parameters, depending on the host configuration.

</Callout>

## Handling the Result

If the payment is accepted and processed as an installment transaction, the resulting `Transaction` object will contain a `financialInfo` block with the details of the deferred payment.

### The FinancialInfo Object

The `Transaction` data class includes an optional field `financialInfo`. If this field is not null, the transaction involved deferred terms.

**Example Handling:**

```java
fun handlePaymentResult(result: RepositoryResult<PaymentResult>) {
    if (result is RepositoryResult.Success && result.data is PaymentResult.Accepted) {
        val transaction = (result.data as PaymentResult.Accepted).data

        // Check for Financial Info
        val finance = transaction.financialInfo

        if (finance != null) {
            println("💰 Deferred Payment Confirmed")
            // Access specific financial details if available in the FinancialInfo model
            // (Refer to the Javadoc in the ZIP for specific fields of FinancialInfo)
        } else {
            println("✅ Standard Payment (One-off)")
        }
    }
}
```

## Summary

To implement installment payments:
1.  **Check** `TpvConfig.showPlazox` to ensure the feature is active.
2.  **Call** `makePayment` passing the `financialConditions` parameter.
3.  **Verify** the `Transaction.financialInfo` in the response to confirm the terms.