Object DropIn

  • All Implemented Interfaces:

    
    public class DropIn
    
                        

    Drop-in is our pre-built checkout UI for accepting payments. You only need to integrate through your backend with the /sessions API endpoint and provide some configuration data. Drop-in will handle the rest of the checkout flow.

    Alternatively you can opt for a more advanced implementation with the 3 main API endpoints: /paymentMethods, /payments and /payments/details.

    To start the checkout flow, register you activity or fragment using registerForDropInResult to receive the result of Drop-in. Then call one of the startPayment methods.

    • Constructor Detail

    • Method Detail

      • startPayment

         final static Unit startPayment(Context context, ActivityResultLauncher<SessionDropInResultContractParams> dropInLauncher, CheckoutSession checkoutSession, DropInConfiguration dropInConfiguration, Class<out SessionDropInService> serviceClass)

        Starts the checkout flow to be handled by the Drop-in solution. With this solution your backend only needs to integrate the /sessions endpoint to start the checkout flow.

        Call registerForDropInResult to create a launcher when initializing your Activity or Fragment and receive the final result of Drop-in.

        Use dropInConfiguration to configure Drop-in and the components that will be loaded inside it.

        Optionally, you can extend SessionDropInService with your own implementation and add it to your manifest file. This allows you to interact with Drop-in, and take over the checkout flow.

        Parameters:
        context - The context to start the Checkout flow with.
        dropInLauncher - A launcher to start Drop-in, obtained with registerForDropInResult.
        checkoutSession - The result from the /sessions endpoint passed onto CheckoutSessionProvider.createSession to create this object.
        dropInConfiguration - Additional required configuration data.
        serviceClass - Service that extends from SessionDropInService to optionally take over the checkout flow.
      • startPayment

         final static Unit startPayment(Context context, ActivityResultLauncher<SessionDropInResultContractParams> dropInLauncher, CheckoutSession checkoutSession, CheckoutConfiguration checkoutConfiguration, Class<out SessionDropInService> serviceClass)

        Starts the checkout flow to be handled by the Drop-in solution. With this solution your backend only needs to integrate the /sessions endpoint to start the checkout flow.

        Call registerForDropInResult to create a launcher when initializing your Activity or Fragment and receive the final result of Drop-in.

        Use checkoutConfiguration to configure Drop-in and the components that will be loaded inside it.

        Optionally, you can extend SessionDropInService with your own implementation and add it to your manifest file. This allows you to interact with Drop-in, and take over the checkout flow.

        Parameters:
        context - The context to start the Checkout flow with.
        dropInLauncher - A launcher to start Drop-in, obtained with registerForDropInResult.
        checkoutSession - The result from the /sessions endpoint passed onto CheckoutSessionProvider.createSession to create this object.
        checkoutConfiguration - Additional required configuration data.
        serviceClass - Service that extends from SessionDropInService to optionally take over the checkout flow.
      • startPayment

         final static Unit startPayment(Context context, ActivityResultLauncher<DropInResultContractParams> dropInLauncher, PaymentMethodsApiResponse paymentMethodsApiResponse, DropInConfiguration dropInConfiguration, Class<out DropInService> serviceClass)

        Starts the advanced checkout flow to be handled by the Drop-in solution. With this solution your backend needs to integrate the 3 main API endpoints: /paymentMethods, /payments and /payments/details.

        Extend DropInService with your own implementation and add it to your manifest file. This class allows you to interact with Drop-in during the checkout flow.

        Call registerForDropInResult to create a launcher when initializing your Activity or Fragment and receive the final result of Drop-in.

        Use dropInConfiguration to configure Drop-in and the components that will be loaded inside it.

        Parameters:
        context - The context to start the Checkout flow with.
        dropInLauncher - A launcher to start Drop-in, obtained with registerForDropInResult.
        paymentMethodsApiResponse - The result from the /paymentMethods endpoint.
        dropInConfiguration - Additional required configuration data.
        serviceClass - Service that extends from DropInService to interact with Drop-in during the checkout flow.
      • startPayment

         final static Unit startPayment(Context context, ActivityResultLauncher<DropInResultContractParams> dropInLauncher, PaymentMethodsApiResponse paymentMethodsApiResponse, CheckoutConfiguration checkoutConfiguration, Class<out DropInService> serviceClass)

        Starts the advanced checkout flow to be handled by the Drop-in solution. With this solution your backend needs to integrate the 3 main API endpoints: /paymentMethods, /payments and /payments/details.

        Extend DropInService with your own implementation and add it to your manifest file. This class allows you to interact with Drop-in during the checkout flow.

        Call registerForDropInResult to create a launcher when initializing your Activity or Fragment and receive the final result of Drop-in.

        Use checkoutConfiguration to configure Drop-in and the components that will be loaded inside it.

        Parameters:
        context - The context to start the Checkout flow with.
        dropInLauncher - A launcher to start Drop-in, obtained with registerForDropInResult.
        paymentMethodsApiResponse - The result from the /paymentMethods endpoint.
        checkoutConfiguration - Additional required configuration data.
        serviceClass - Service that extends from DropInService to interact with Drop-in during the checkout flow.