onSubmit

open fun onSubmit(state: T): Boolean

Override this method if you want to take over the sessions flow and make a network call to the /payments endpoint of the Checkout API through your server.

You need to return true if you want to take over the sessions flow, otherwise the API calls will still be handled internally by the SDK. This could be useful in case you want to handle the flow yourself only in certain conditions, then you can return false if these conditions are not met.

Once you take over the flow you will need to handle all the necessary subsequent network calls, otherwise a MethodNotImplementedException will be thrown.

We provide a PaymentComponentState which contains information about the state of the payment component at the moment the user submits the payment.

We also provide inside PaymentComponentState.data the parameters that we can infer from the component's configuration and the user input, especially the state.data.paymentMethod object with the shopper input details.

Use PaymentComponentData.SERIALIZER to serialize this data to a JSONObject. The rest of the /payments call request data should be filled in, on your server, according to your needs.

In case you receive an additional action, you can call component.handleAction with an Action containing the result of the network request.

See https://docs.adyen.com/api-explorer/ for more information on the API documentation.

Return

true if you took over the sessions flow, false otherwise.

Parameters

state

The state of the payment component at the moment the user submits the payment.