Skip to content

[Bug]: Transactions::get() throws ValueError for card type BANCOMAT #127

Closed

Description

@lanz1

What happened?

For a card-present transaction paid with an Italian PagoBancomat debit card, the Transactions API returns "card": { "type": "BANCOMAT", ... }.

BANCOMAT is not a case of SumUp\Types\CardResponseType (nor of CardType in openapi.json), so Hydrator::castEnumValue() falls back to from() and throws a ValueError. The whole TransactionFull is lost, although the transaction is SUCCESSFUL and every other field is valid.

In a Solo / Cloud API integration this means an approved payment cannot be reconciled through Transactions::get(): in our case the payment stayed unresolved and the reader was blocked until we worked around it.

Expected: the transaction is returned. BANCOMAT should be a known card type, and in general an enum value added to the API before the SDK is regenerated should not make the whole response unreadable. CardResponseType already declares an UNKNOWN case that could absorb it.

Relevant code or error output

ValueError: "BANCOMAT" is not a valid backing value for enum SumUp\Types\CardResponseType

// Minimal offline reproduction
$client = new class implements \SumUp\HttpClient\HttpClientInterface {
    public function send(string $method, string $url, array $body, array $headers, ?\SumUp\HttpClient\RequestOptions $options = null): \SumUp\HttpClient\Response {
        return new \SumUp\HttpClient\Response(200, [
            'id' => 'tx-1', 'status' => 'SUCCESSFUL', 'amount' => 2.0, 'currency' => 'EUR',
            'card' => ['type' => 'BANCOMAT', 'last_4_digits' => '1234'],
        ]);
    }
};
(new \SumUp\Services\Transactions($client, 'token'))->get('MERCHANT'); // ValueError

SDK version

0.1.6

PHP version

8.4.24

Framework or runtime

Laravel 13

Operating system

Debian Linux (Docker, AWS ECS)

Additional context

I'm opening a PR with a fix: a fallback to the UNKNOWN case in the hydrator (enums without UNKNOWN keep the current strict behaviour) and BANCOMAT added to the CardType schema.

Activity

  1. self-assigned this
    on Oct 14, 2026
  2. jonathandhn commented on Oct 14, 2026

    @jonathandhn

    We hit the same issue today with sumup/sumup-php 0.1.6 in a CiviCRM Solo / Cloud API integration, but the unexpected value was card.type = "SUMUP" rather than BANCOMAT.

    The resulting ValueError prevented us from hydrating and reconciling an otherwise successful transaction. We worked around it in our integration by normalising unknown CardResponseType values to UNKNOWN before hydration.

    This confirms that the generic UNKNOWN fallback in #128 is useful beyond the specific BANCOMAT case.

  3. matoous commented on Oct 15, 2026

    @matoous
    Contributor

    Fix(es) released in v0.1.7. Thank you for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions