Cancel returning invalid response, successful webhook

After sending a request to cancel a payment, I’m receiving a response that the status is not allowed.
I’m using the python library and the request is as follows:

request_body = {'status': 'cancelled'}, request_body)

The response I receive is:

dwollav2.error.ValidationError: {
"message":"Validation error(s) present. See embedded errors list for more details.",
   {"errors":[{"code":"NotAllowed","message":"Status not allowed.","path":"/status","_links":{}}]}

Immediately following this response, I receive a successful webhook:

    "id": "8b4dca60-1688-4781-960d-982fa00c9952",
    "resourceId": "b2d80f41-75e7-eb11-8136-b0300d0c7e2a",
    "topic": "customer_transfer_cancelled",
    "timestamp": "2021-07-19T13:20:22.327Z",
    "_links": {
        "self": {
            "href": ""
        "account": {
            "href": ""
        "resource": {
            "href": ""
        "customer": {
            "href": ""
    "created": "2021-07-19T13:20:22.327Z"

Hi @jmtichell – thanks for the detailed report!

I checked the logs and actually found a 200 Ok response for cancelling the above transfer in the webhook with the Id b2d80f41-75e7-eb11-8136-b0300d0c7e2a. The request Id for this request was c9204e14-946b-405d-ae98-322f76f06350.

It appears it was a different transfer (Id: b3d80f41-75e7-eb11-8136-b0300d0c7e2a) that returned a 400 error response.

Thank you @shreya , and sorry for the confusion. Do you have any idea why that transfer wasn’t able to be cancelled? I seem to remember having that problem before, but I don’t remember exactly the reason.

Ah yes, it’s a known issue in Sandbox – the last item of a masspayment isn’t able to be canceled even though it has a cancel link. We have a ticket created for a fix in our backlog.

Ok, glad to hear it’s just the final item and not an issue with a malformed request. Thanks again!

Nope! Your implementation is fine!