Skip to content

v0.7.0

Choose a tag to compare

@FernandoCelmer FernandoCelmer released this 06 Sep 16:06
· 22 commits to master since this release

What's Changed

  • cancel() takes an $idempotencyKey — a retried cancellation replays the first answer instead of cancelling twice

Why

issue() and reissue() already accepted the key; cancel() — the one irreversible call, inside a legal window — did not. A dropped connection or a retry sent a second cancellation.

$invoice->cancel(
    $accessKey,
    DocumentType::NFSE,
    'Pedido cancelado pelo comprador',
    idempotencyKey: 'cancel-8f21',
);

The same key with the same body replays the stored answer. A different body under the same key is refused, not silently accepted. Nothing generates a key for you: two calls without one are two cancellations, deliberately.

The parameter is optional and last. Nothing was removed and no other signature changed.