# Adding a Tip

You can add a tip either through our SDK on **ePOS** or directly on the **terminal**. See the documentation below for more details.

## Adding a Tip on ePOS

As mentioned in [Make Payment section](./make-payment.md), you can add a tip to `makePayment`.

```tabs
    tab:
      title: Kotlin
      content:
        ```kotlin
        val paymentSubscription = teyaIntegration.makePayment(
            transactionId = UUID.randomUUID().toString(),
            amount = amountToPay,
            currency = "GBP",
            tip = 30 // An optional tip amount, in the smallest unit of the currency.
        )
        ```
    tab:
      title: Java
      content:
        ```java
        PaymentStateSubscription paymentSubscription = teyaIntegration.makePayment(
                UUID.randomUUID().toString(), // transactionId
                amountToPay, // amount
                "GBP", // currency
                30 // An optional tip amount, in the smallest unit of the currency.
        );
        ```
```

The tip parameter allows you to specify an optional tip amount, in the smallest unit of the currency (e.g., pence for GBP, cents for EUR/USD). When you provide a tip, it is treated as included within the total amount you pass.

For example, if you set:
```kotlin
amount = 100
tip = 20
```

In other words, the tip is not added on top of the amount — it is included within it. For example, if the total is **£1.00**, **£0.20** will go toward the tip and **£0.80** will be the purchased goods amount.

```admonition
icon: fas fa-exclamation-triangle
content: Please note that the tip cannot exceed the total transaction amount.
```

## Adding a tip on Terminal

If you don't provide a tip amount in the `makePayment` function and tipping is enabled on the **terminal**, the tip can be selected directly on the terminal.

If you want to enable tipping on the terminal, you also need to pass true for tipping in the setup function:

```tabs
    tab:
      title: Kotlin
      content:
        ```kotlin
        val teyaIntegration = teyaAllInOneSDK.setupTransactionsApi(
            skipApprovedScreen = false,
            allowPaymentAppTips = true, // Enable tipping on the payment app
            showReceiptOptionsOnPaymentApp = false
        )
        ```
    tab:
      title: Java
      content:
        ```java
        TeyaCommonTransactionsApi teyaIntegration = teyaAllInOneSDK.setupTransactionsApi(
                false, // skipApprovedScreen
                true,  // allowPaymentAppTips: Enable tipping on the payment app
                false // showReceiptOptionsOnPaymentApp
        );
        ```
```

When a tip is selected this way, the `amount` and `tip` properties in the `PaymentStateDetails` object will be updated accordingly. These updates occur once the payment status changes to `Successful`, allowing you to see the final tip amount selected on the terminal.

```kotlin
public data class PaymentStateDetails(
    val eposTransactionId: String,
    val amount: Int,           // Total amount including tip; updated after a Successful payment with a terminal-side tip
    val tip: Int?,             // Tip amount; updated after a Successful payment with a terminal-side tip
    // ...
)
```
