Skip to content

BillingRequestService.ListAsync and AllAsync methods do not work when CreatedAt filter is specified #176

@IanKemp

Description

@IanKemp

A method invocation like

var billingRequests = await _goCardlessClient.BillingRequests.ListAsync(new BillingRequestListRequest
{
    CreatedAt = new BillingRequestListRequest.CreatedAtParam
    {
        GreaterThanOrEqual = DateTimeOffset.Parse("2025-11-19T09:26:35.1214323+00:00"),
        LessThanOrEqual = DateTimeOffset.Parse("2025-11-26T09:26:35.1214323+00:00"),
    },
});

causes the following request (URL-decoded)

GET /billing_requests?created_at[gte]=2025-11-19T09:26:35.1214323+00:00&created_at[lte]=2025-11-26T09:26:35.1214323+00:00

which results in an error response

{
    "error": {
        "message": "One of your parameters was incorrectly typed",
        "errors": [
            {
                "field": "created_at",
                "message": "{\"gte\"=>\"2025-11-19T09:26:35.1214323 00:00\", \"lte\"=>\"2025-11-26T09:26:35.1214323 00:00\"} is not a string.",
                "request_pointer": "/billing_requests/created_at"
            }
        ],
        "documentation_url": "https://developer.gocardless.com/api-reference#invalid_type",
        "type": "invalid_api_usage",
        "code": 422
    }
}

The issue is that these methods assume that CreatedAt has the same gt/gte/lt/lte filters that other endpoints like list mandates do, but the docs show that this parameter doesn't support these filters on this endpoint. As this is incongruent with every other endpoint, this one should be updated to match - i.e. this is an API, not client, bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions