# UI Components

The SDK provides an unmanaged custom view deriving from `Button`. There are separate Light and Dark versions to best match your particular UI, and the component is designed to allow for some flexibility in sizing (on both axes).

## CashAppPayButton

Developers are allowed to change the size of `CashAppPayButton` to suit their design, as long as they fall within certain limits.

These limits are:
`CashAppPayButton` should be:

* at least `34dp` tall
* at least `122dp` wide
* at most `54dp` tall

The light and dark variants of the `CashAppPayButton` can be defined using the style parameter, as follows:

```xml title= "Light Button"
<app.cash.paykit.core.ui.CashAppPayButton
      style="@style/CAPButtonStyle.Light"
      android:layout_height="54dp"
      android:layout_width="match_parent"
      />
```

<br />

**Light-background Button:**

<img width="331" alt="Light background Button" src="https://user-images.githubusercontent.com/416941/218883181-77ad30e7-f41a-42b0-a1a4-e829612828e7.png" noZoom />

<br />

```xml title= "Dark Button"
<app.cash.paykit.core.ui.CashAppPayButton
      style="@style/CAPButtonStyle.Dark"
      android:layout_height="54dp"
      android:layout_width="match_parent"
      />
```

<br />

**Dark-background Button:**

<img width="331" alt="Dark background Button" src="https://user-images.githubusercontent.com/416941/218883219-da3588d4-e674-48e2-8299-9c10b4558750.png" noZoom />

<Note>
  Due to its unmanaged nature, the button is merely a stylized button, it's up to developers to trigger the correct action on button press, as well as manage any visibility states of the button accordingly.
</Note>

<Note>
  You can use Android's Resource Qualifiers, such as `values-night`, to easily provide a button variation that follows the system's theme.
</Note>

## Pay Kit Android: Advanced Operations

This page describes advanced operations for the Cash App Pay Android SDK. For most setups, see [Getting Started](/cash-app-pay-partner-api/guides/pay-kit-sdk/pay-kit-android) first, which should contain most of the relevant information for your needs.

### Start with an existing customer request

When you use `createCustomerRequest` you get a `CustomerResponseData` object returned to you. This object contains an `id` field which is the `Request ID`.

<Note>
  If required, you can save this ID to retrieve the request at a later time.
</Note>

Since you are starting with an existing customer request, you'd start the SDK by calling `startWithExistingCustomerRequest` and pass the `Request ID`.

<br />This is how it would look:

```kotlin
cashAppPay.startWithExistingCustomerRequest(customerRequestID)
```

<br />

<Note title="Note">
  * You must call this function *only* when you start on a new SDK instance.
  * You must register for state updates before calling this function.
</Note>

### Update an existing customer request

You can update an existing customer request by calling `updateCustomerRequest` and passing in the `Request ID` and a new `CashAppPayPaymentAction` object.

<br />

This is the signature of the function:

```kotlin
fun updateCustomerRequest(
    requestId: String,
    paymentAction: CashAppPayPaymentAction,
)
```

<br />

<Note>
  You would typically use this function only after you've already started the SDK with a customer request.
</Note>