onOrderCancel

open fun onOrderCancel(order: Order, shouldUpdatePaymentMethods: Boolean)

Only applicable for partial payments flow.

In this method you should make a network call to the /orders/cancel endpoint of the Checkout API through your server. This method is called during a partial payment, when the user removes their already submitted partial payments either by using the remove button or cancelling Drop-in.

We provide order, an Order object that contains a non-serialized version of the order to be cancelled. Use Order.SERIALIZER to serialize it to a JSONObject.

The shouldUpdatePaymentMethods flag indicates the next step you should take after the API call is made:

  • true means that Drop-in is still showing and you might want to call /paymentMethods with the new payment amount. Update Drop-in with the new list of payment methods, by passing DropInServiceResult.Update to sendResult.

  • false means that Drop-in is being dismissed by the user so there is no need to make any further calls.

NOTICE: this method runs on the main thread, you should make sure the API call and any other long running operation is made on a background thread.

Note that not overriding this method while enabling partial payments will cause a MethodNotImplementedException to be thrown.

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

Parameters

order

The data from order being cancelled.

shouldUpdatePaymentMethods

indicates whether payment methods should be re-fetched and passed to Drop-in.