# Create a Payment with Installments

Installment payments (*Pago a Plazos*) allow customers to split purchases into multiple payments. For the Get Mini mPOS solution, installment options are typically managed directly on the PIN pad device based on the merchant's configuration.

## Requirements
Before processing installment payments, ensure the SDK is fully initialized with the correct environment and license using `CommonUtils`. You must have valid merchant configuration data from a successful login response (`DatosLoginResponseDTO`) and a connected, initialized PIN pad device with an active `PinpadConfig`. Critically, your merchant account must be specifically configured by the acquirer to support installment transactions; otherwise, the option will not appear on the device.

## Step 1: Execute the Payment

To process an installment transaction, initiate a standard payment using `PagoDTO`. If the terminal and card support installments, the PIN pad will prompt the customer to select the installment terms (number of payments) during the transaction flow.

### How Installments are Defined
You do not pass an installments parameter from your iOS code. When the card and the terminal support installments, the PIN pad handles the selection and returns the total authorized amount to your app.

The `PagoDTO` object requires the following key parameters:

| Parameter | Type | Required | Description |
| :---- | :---- | :---- | :---- |
| `valorCompra` | Int | Yes | Amount in cents (e.g., `1050` for 10.50€) |
| `moneda` | Int | Yes | ISO 4217 currency code (e.g., `978` for EUR) |
| `nFactura` | String | No | Invoice/Order identifier |

```
// Import via Bridging Header: RedsysPinpadManager.h
func startInstallmentPayment(device: EAAccessory, config: PinpadConfig, amount: Int, orderId: String) {
    let pinpadManager = RedsysPinpadManager(bluetoothTech: true)

    // 1. Prepare Merchant DTO (from Login response)
    let merchant = MerchanDTO()
    merchant.fuc = "999008881"
    merchant.terminal = "001"
    merchant.password = "merchant_pass"
    // ... set other fields as required

    // 2. Prepare Payment DTO
    let paymentDTO = PagoDTO(
        valor: Float(amount),      // Note: SDK usually takes float * 100 in init or int depending on method
        mMoneda: 978,              // EUR
        nFactura: orderId,
        email: "",
        tlfCliente: "",
        datosPropietarios: ""
    )

    // 3. Start Payment Operation
    // The PinPad handles the installment selection interaction
    pinpadManager.pay(
        withPinpadBluetooth: device,
        merchan: merchant,
        config: config,
        andPagoDTO: paymentDTO,
        withDelegate: self
    )
}
```

<Callout type="note">

The exact method signature for payment is `payWithPinpadBluetooth:merchan:config:andPagoDTO:withDelegate:`. Ensure you use the correct method for your connection type (Bluetooth vs Wi-Fi).

</Callout>

## Step 2: Handle the Result

The result is delivered via the `onPaymentFinished` callback of the `RedsysBTPinpadPaymentDelegate`. The result object (`PagoResponseDTO` or similar) will contain the authorization details.

```
func onPaymentFinished(_ result: Any!, orError error: Error!) {
    if let result = result, error == nil {
        // Parse result (cast to appropriate Response DTO)
        print("Payment/Installment Successful")
        // Verify response fields for installment info if available
    } else {
        print("Transaction Failed: \(error?.localizedDescription ?? "Unknown Error")")
    }
}
```

## Next Steps

- [Refund a Payment](/en/get-mini/ios-sdk/guides/refund-payment-ios) - Handle returns
- [Transaction Lifecycle](/en/get-mini/ios-sdk/core-concepts/ios-lifecycle) - Review SDK internal states