## Additional Configurations

## Overview

The Ryft Android Drop-In SDK provides several **additional configuration** options that allow you to customize the payment experience according to your business needs. These configurations can be set when displaying the Drop-In UI.

## Customising the Drop-In UI

You can customise the **title** of the *PAY* button in the Drop-In UI by providing a `payButtonTitle` parameter within the `display` component as shown below:

Kotlin (Fragment)

```kotlin Customising Pay Button Title - Kotlin (Fragment)
class CheckoutFragment : Fragment(), RyftDropInResultListener {

    private lateinit var ryftDropIn: RyftDropIn
    private lateinit var paymentButton: Button
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ryftDropIn = DefaultRyftDropIn(
            fragment = this,
            listener = this
        )
    }
    
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        paymentButton = view.findViewById(R.id.button_payment)
        paymentButton.setOnClickListener {
            showDropIn()
        }
    }
    
    override fun onPaymentResult(result: RyftPaymentResult) {
        // TODO see next section
    }
    
    private fun showDropIn() {
        ryftDropIn.show(
            // Example for standard account payments
            RyftDropInConfiguration.standardAccountPayment(
                clientSecret = "<the client secret of the payment session",
                publicApiKey = RyftPublicApiKey("<your public API key>"),
                googlePayConfiguration = RyftDropInGooglePayConfiguration(
                    merchantName = "<The name of your business>",
                    merchantCountryCode = "<The ISO 3166-1 alpha-2 country code of your business>"
                ),
                // Defaults to false if not provided
                fieldCollection = RyftDropInFieldCollectionConfiguration(
                    nameOnCard = true
                ),
                display = RyftDropInDisplayConfiguration(
                    usage = RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
                    payButtonTitle = null || "Pay" // Set as appropriate
                )
            )
            
            // Example for sub account payments
            // RyftDropInConfiguration.subAccountPayment(
            //     clientSecret = "<the client secret of the payment session",
            //     publicApiKey = RyftPublicApiKey("<your public API key>"),
            //     subAccountId = "<the Id of the sub-account you are taking payments for",
            //     googlePayConfiguration = RyftDropInGooglePayConfiguration(
            //         merchantName = "<The name of your business>",
            //         merchantCountryCode = "<The ISO 3166-1 alpha-2 country code of your business>"
            //     ),
            //    // Defaults to false if not provided
            //    fieldCollection = RyftDropInFieldCollectionConfiguration(
            //        nameOnCard = true
            //    ),
            //     display = RyftDropInDisplayConfiguration(
            //         usage = RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
            //         payButtonTitle = null || "Pay" // Set as appropriate
            //     )
            // )
        )
    }
}
```

Kotlin (Activity)

```kotlin Customising Pay Button Title - Kotlin (Activity)
class CheckoutActivity : ComponentActivity(), RyftDropInResultListener {

    private lateinit var ryftDropIn: RyftDropIn
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ryftDropIn = DefaultRyftDropIn(
            activity = this,
            listener = this
        )
    }
    
    override fun onPaymentResult(result: RyftPaymentResult) {
        // TODO see next section
    }
    
    // Call this method when customer navigates to payment
    private fun showDropIn() {
        ryftDropIn.show(
            // Example for standard account payments
            RyftDropInConfiguration.standardAccountPayment(
                clientSecret = "<the client secret of the payment session",
                publicApiKey = RyftPublicApiKey("<your public API key>"),
                googlePayConfiguration = RyftDropInGooglePayConfiguration(
                    merchantName = "<The name of your business>",
                    merchantCountryCode = "<The ISO 3166-1 alpha-2 country code of your business>"
                ),
                // Defaults to false if not provided
                fieldCollection = RyftDropInFieldCollectionConfiguration(
                    nameOnCard = true
                ),
                display = RyftDropInDisplayConfiguration(
                    usage = RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
                    payButtonTitle = null || "Pay" // Set as appropriate
                )
            )
            
            // Example for sub account payments
            // RyftDropInConfiguration.subAccountPayment(
            //     clientSecret = "<the client secret of the payment session",
            //     publicApiKey = RyftPublicApiKey("<your public API key>"),
            //     subAccountId = "<the Id of the sub-account you are taking payments for",
            //     googlePayConfiguration = RyftDropInGooglePayConfiguration(
            //         merchantName = "<The name of your business>",
            //         merchantCountryCode = "<The ISO 3166-1 alpha-2 country code of your business>"
            //     ),
            //    // Defaults to false if not provided
            //    fieldCollection = RyftDropInFieldCollectionConfiguration(
            //        nameOnCard = true
            //    ),
            //     display = RyftDropInDisplayConfiguration(
            //         usage = RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
            //         payButtonTitle = null || "Pay" // Set as appropriate
            //     )
            // )
        )
    }
}
```

Java (Fragment)

```java Customising Pay Button Title - Java (Fragment)
class CheckoutFragment extends Fragment implements RyftDropInResultListener {

    private RyftDropIn ryftDropIn;
    private Button paymentButton;
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ryftDropIn = new DefaultRyftDropIn(this, this);
    }

    @Override
    protected void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        paymentButton = view.findViewById(R.id.button_payment);
        paymentButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                showDropIn();
            }
        })
    }
    
    @Override
    protected void onPaymentResult(final RyftPaymentResult result) {
        // TODO see next section
    }
    
    private void showDropIn() {
        ryftDropIn.show(
            // Example for standard account payments
            RyftDropInConfiguration.standardAccountPayment(
                "<the client secret of the payment session",
                new RyftDropInGooglePayConfiguration(
                    "<The name of your business>",
                    "<The ISO 3166-1 alpha-2 country code of your business>"
                ),
                // Defaults to false if not provided
                new RyftDropInFieldCollectionConfiguration(
                    true // nameOnCard
                ),
                new RyftDropInDisplayConfiguration(
                    RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
                    null || "Pay" // Set as appropriate
                ),
                new RyftPublicApiKey("<your public API key>")
            )
            
            // Example for sub account payments
            // RyftDropInConfiguration.subAccountPayment(
            //     "<the client secret of the payment session",
            //     "<the Id of the sub-account you are taking payments for",
            //     new RyftDropInGooglePayConfiguration(
            //         "<The name of your business>",
            //         "<The ISO 3166-1 alpha-2 country code of your business>"
            //     ),
            //    // Defaults to false if not provided
            //    new RyftDropInFieldCollectionConfiguration(
            //        true // nameOnCard
            //    ),
            //     new RyftDropInDisplayConfiguration(
            //         RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
            //         null || "Pay" // Set as appropriate
            //     ),
            //     new RyftPublicApiKey("<your public API key>")
            // )
        );
    }
}
```

Java (Activity)

```java Customising Pay Button Title - Java (Activity)
class CheckoutActivity extends ComponentActivity implements RyftDropInResultListener {

    private RyftDropIn ryftDropIn; 
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ryftDropIn = new DefaultRyftDropIn(this, this);
    }
    
    @Override
    protected void onPaymentResult(final RyftPaymentResult result) {
        // TODO see next section
    }

    // Call this method when customer navigates to payment
    private void showDropIn() {
        ryftDropIn.show(
            // Example for standard account payments
            RyftDropInConfiguration.standardAccountPayment(
                "<the client secret of the payment session",
                new RyftDropInGooglePayConfiguration(
                    "<The name of your business>",
                    "<The ISO 3166-1 alpha-2 country code of your business>"
                ),
                // Defaults to false if not provided
                new RyftDropInFieldCollectionConfiguration(
                    true // nameOnCard
                ),
                new RyftDropInDisplayConfiguration(
                    RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
                    null || "Pay" // Set as appropriate
                ),
                new RyftPublicApiKey("<your public API key>")
            )
            
            // Example for sub account payments
            // RyftDropInConfiguration.subAccountPayment(
            //     "<the client secret of the payment session",
            //     "<the Id of the sub-account you are taking payments for",
            //     new RyftDropInGooglePayConfiguration(
            //         "<The name of your business>",
            //         "<The ISO 3166-1 alpha-2 country code of your business>"
            //     ),
            //    // Defaults to false if not provided
            //    new RyftDropInFieldCollectionConfiguration(
            //        true // nameOnCard
            //    ),
            //     new RyftDropInDisplayConfiguration(
            //         RyftDropInUsage.Payment, // or RyftDropInUsage.SetupCard
            //         null || "Pay" // Set as appropriate
            //     ),
            //     new RyftPublicApiKey("<your public API key>")
            // )
        );
    }
}
```

## Collecting Name on Card

You can choose to collect the **Name on Card** field in the Drop-In UI when displaying the payment form. This can help with fraud prevention and improve payment success rates.

To collect this field, you need to set the `nameOnCard` parameter to `true` within the `fieldCollection` configuration as shown below:

Single Payment

```kotlin Collecting Name on Card - Single Payment
RyftDropInConfiguration.standardAccountPayment(
    clientSecret = "",  // The client secret returned when creating a Payment Session
    publicApiKey = RyftPublicApiKey(""),  // Your Ryft Public API Key
    fieldCollection = RyftDropInFieldCollectionConfiguration(
        nameOnCard = true
    )
)
```

Platform Fee Payment

```kotlin Collecting Name on Card - Platform Fee Payment
RyftDropInConfiguration.subAccountPayment(
    clientSecret = "",  // The client secret returned when creating a Payment Session
    publicApiKey = RyftPublicApiKey(""),  // Your Ryft Public API Key
    subAccountId = "",  // The Id of the Sub-Account you are taking payments for
    fieldCollection = RyftDropInFieldCollectionConfiguration(
        nameOnCard = true
    )
)
```

## Set-Up Cards for Future Payments

You can allow customers to set up their cards for future payments directly from the Drop-In UI.

This process is also known as **Zero-Value Authorisation**, and you can find more information on [this](/documentation/get_started/initiate_payments/additional_settings/authorisation) page.

The Android drop-in SDK has two main usage patterns:

- `Payment` - used for customers actively making a payment.
- `SetupCard` - used for customers who want to set up their card for future payments without making an immediate payment.


By default, the Drop-In UI is configured for the `Payment` usage pattern.

To change this to `SetupCard`, you need to specify the `usage` parameter in the `RyftDropInDisplayConfiguration` object when displaying the Drop-In UI, as shown below:

Single Payment

```kotlin Setting Up Cards for Future Payments - Single Payment
RyftDropInConfiguration.standardAccountPayment(
    clientSecret = "",  // The client secret returned when creating a Payment Session
    publicApiKey = RyftPublicApiKey(""),  // Your Ryft Public API Key
    display = RyftDropInDisplayConfiguration(
        usage = RyftDropInUsage.SetupCard  // Set usage to SetupCard
    )
)
```

Platform Fee Payment

```kotlin Setting Up Cards for Future Payments - Platform Fee Payment
RyftDropInConfiguration.subAccountPayment(
    clientSecret = "",  // The client secret returned when creating a Payment Session
    publicApiKey = RyftPublicApiKey(""),  // Your Ryft Public API Key
    subAccountId = "",  // The Id of the Sub-Account you are taking payments for
    display = RyftDropInDisplayConfiguration(
        usage = RyftDropInUsage.SetupCard  // Set usage to SetupCard
    )
)
```