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.
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:
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
// )
// )
)
}
}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:
RyftDropInConfiguration.standardAccountPayment(
clientSecret = "", // The client secret returned when creating a Payment Session
publicApiKey = RyftPublicApiKey(""), // Your Ryft Public API Key
fieldCollection = RyftDropInFieldCollectionConfiguration(
nameOnCard = true
)
)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 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:
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
)
)