To cancel a payment the order requires to be in state New (state=1) or, retry one-time an order in state Error (state=4).
An attempt to cancel/retry an order not in state New/Error respectively will result in an error response.
retry:
Cancel:
Refund: