Skip to content

Download receipts as PNG files #114

Description

@twytec

Until now, receipts could still be downloaded as PNG files.

using var client = new SumUpClient(new SumUpClientOptions() { AccessToken = key });

DateTimeOffset sdt = new(2026, 4, 1, 0, 0, 0, TimeSpan.Zero);
DateTimeOffset edt = new(2026, 4, 30, 23, 59, 59, TimeSpan.Zero);
var res = await client.Transactions.ListAsync(code, oldestTime: sdt, newestTime: edt, limit: 9999);
if (res.IsSuccess && res.Data is not null && res.Data.Items is not null)
{
    foreach (var item in res.Data.Items)
    {
        var bres = await client.Transactions.GetAsync(code, transactionCode: item.TransactionCode);
        var pngLink = bres.Data.Links.FirstOrDefault(x => x.Type.Contains("png"));
        HttpClient hc = new();
        var d = await hc.GetAsync(pngLink.Href);
        //d.StatusCode == System.Net.HttpStatusCode.Forbidden
    }
}

I suspect that Cloudflare is blocking the request. Is there a solution for this?

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