Interface ComponentCallback
-
- All Implemented Interfaces:
-
com.adyen.checkout.components.core.internal.BaseComponentCallback
public interface ComponentCallback<T extends PaymentComponentState<?>> implements BaseComponentCallback
Implement this callback to interact with a PaymentComponent.
-
-
Method Summary
Modifier and Type Method Description abstract UnitonSubmit(T state)In this method you should make a network call to the /payments endpoint of the Checkout API through your server. abstract UnitonAdditionalDetails(ActionComponentData actionComponentData)In this method you should make a network call to the /payments/details endpoint of the Checkout API through your server. abstract UnitonError(ComponentError componentError)The component has encountered an error. UnitonStateChanged(T state)You can implement this optional method to receive an update any time the state of the component changes. UnitonPermissionRequest(String requiredPermission, PermissionHandlerCallback permissionCallback)Should be overridden to support runtime permissions for components. -
-
Method Detail
-
onSubmit
abstract Unit onSubmit(T state)
In this method you should make a network call to the /payments endpoint of the Checkout API through your server.
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.
See https://docs.adyen.com/api-explorer/ for more information on the API documentation.
- Parameters:
state- The state of the payment component at the moment the user submits the payment.
-
onAdditionalDetails
abstract Unit onAdditionalDetails(ActionComponentData actionComponentData)
In this method you should make a network call to the /payments/details endpoint of the Checkout API through your server.
We provide inside ActionComponentData the whole request data expected by the /payments/details endpoint. Use ActionComponentData.SERIALIZER to serialize this data to a JSONObject.
You can dismiss the component after this API call is successful, there is no need to perform any extra actions.
See https://docs.adyen.com/api-explorer/ for more information on the API documentation.
- Parameters:
actionComponentData- The data from the action component.
-
onError
abstract Unit onError(ComponentError componentError)
The component has encountered an error. Use ComponentError.exception to get the internal exception.
- Parameters:
componentError- The error encountered.
-
onStateChanged
Unit onStateChanged(T state)
You can implement this optional method to receive an update any time the state of the component changes.
This mainly occurs through a user interaction (editing an input, selecting an item from a list, etc) and will be triggered regardless whether the component is valid or not.
We provide a PaymentComponentState which contains information about the state of the payment component at that moment.
- Parameters:
state- The state of the payment component at the current moment.
-
onPermissionRequest
Unit onPermissionRequest(String requiredPermission, PermissionHandlerCallback permissionCallback)
Should be overridden to support runtime permissions for components. Runtime permission should be requested and communicated back through the callback. If not overridden, PermissionHandlerCallback.onPermissionRequestNotHandled will be invoked, which will show an error message.
- Parameters:
requiredPermission- Required runtime permission.permissionCallback- Callback to be used when passing permission result.
-
-
-
-