Payment Drop-In Buttons

Drop-in buttons extend standard buttons in order to easily integrate separate payment brands to your app. This article is intended to guide you through the process of creating and configuring drop-in buttons.

Before you start adding buttons, please install the SDK and set up your server. Then you can proceed with the following guide.



You need to use OnBeforeSubmitCallback interface to listen to callbacks, consider below code snippet for reference


public class CheckoutOnBeforeSubmitListener implements OnBeforeSubmitCallback {
    @Override
    public void onBeforeSubmit(@NonNull PaymentDetails paymentDetails, @NonNull Listener callback) {      
         
    }
}
class CheckoutOnBeforeSubmitListener : OnBeforeSubmitCallback {
    override fun onBeforeSubmit(paymentDetails: PaymentDetails, callback: Listener) {
        
    }
}

Request Payment Status

Finally your app should request the payment status from your server (adapt this example to your own setup).
Based on chosen approach you will have to send checkout Id or resource path to your server.

public String requestPaymentStatus() {
    URL url;
    String urlString;
    HttpURLConnection connection = null;
    String paymentStatus = null;

    urlString = YOUR_URL + "/paymentStatus/" + CHECKOUT_ID;

    try {
        url = new URL(urlString);
        connection = (HttpURLConnection) url.openConnection();

        JsonReader jsonReader = new JsonReader(
                    new InputStreamReader(connection.getInputStream(), "UTF-8"));

        jsonReader.beginObject();
            
        while (jsonReader.hasNext()) {
            if (jsonReader.nextName().equals("paymentResult")) {
                paymentStatus = jsonReader.nextString();

                break;
            }
        }
            
        jsonReader.endObject();
        jsonReader.close();
    } catch (Exception e) {
        /* error occurred */
    } finally {
        if (connection != null) {
            connection.disconnect();
        }
    }

    return paymentStatus;
}
fun requestPaymentStatus(): String? { 
    val url: URL 
    var connection: HttpURLConnection? = null 
    var paymentStatus: String? = null 

    val urlString = YOUR_URL.toString() + "/paymentStatus?resourcePath=" + URLEncoder.encode(RESOURCE_PATH, "UTF-8") 

    try { 
    url = URL(urlString) 
        connection = url.openConnection() as HttpURLConnection 

        val jsonReader = JsonReader(InputStreamReader(connection.inputStream, "UTF-8"))     
        jsonReader.beginObject() 

        while (jsonReader.hasNext()) { 
            if (jsonReader.nextName() == "paymentResult") { 
                paymentStatus = jsonReader.nextString() 

                break 
            } 
        } 

        jsonReader.endObject() 
        jsonReader.close() 
    } catch (e: Exception) { 
        /* error occurred */ 
    } finally { 
        connection?.disconnect() 
    } 

    return paymentStatus 
}

Testing

The sandbox environment only accepts test payment parameters.

You can find test values for credit cards and bank accounts in our Testing Guide.

Go to Production

1. Talk to your account manager to get the live credentials.

2. Adjust the server type to LIVE in your initialization of CheckoutSettings.

CheckoutSettings checkoutSettings = new CheckoutSettings(checkoutId, paymentBrands, Connect.ProviderMode.LIVE);
val checkoutSettings = CheckoutSettings(checkoutId, paymentBrand, Connect.ProviderMode.LIVE)

3. Change your backend to use the correct API endpoints and credentials.