Skip to content

v0.2.0

Choose a tag to compare

@FernandoCelmer FernandoCelmer released this 04 Sep 23:01
· 50 commits to master since this release

What's Changed

  • correct() — files an electronic correction letter (CC-e) against an authorized invoice
  • invalidate() — regularizes a range of numbers that was reserved and never used
  • idempotencyKey on issue() and reissue() — makes a retry safe

correct() — correction letter (CC-e)

Fixes an already authorized invoice without cancelling and issuing again. It consumes no credit and burns no number in the series.

$result = $invoice->correct(
    '35240912345678000199550010000000011000000017',
    DocumentType::NFE,
    'Carrier corrected to Rapido Ltda',
);

Text between 15 and 1000 characters, checked locally. It cannot correct anything that changes the tax, the issuer, the recipient or the date — those still mean cancelling and issuing again. NF-e only.

invalidate() — invalidate a number range

Regularizes numbering that was reserved and never used, which is the gap an audit looks for.

$result = $invoice->invalidate(
    '1',
    10,
    12,
    'Numbering reserved and left unused after an ERP failure',
);

Reason between 15 and 255 characters, range inclusive, both checked locally. A number that already reached the tax authority cannot be invalidated — the API answers 409 naming which ones.

idempotencyKey on issue() and reissue()

Issuing is the call you must not repeat blindly: if the response is lost, the document may have been authorized already, and a second attempt issues a second invoice.

$result = $invoice->issue(..., idempotencyKey: $key);

Repeat with the same key and the same body and you get the first response back — no second document, no credit spent. Keys last 24 hours. The SDK never generates the key for you: a key generated per call would protect nothing, because the retry would generate another one.

Nothing was removed and no signature changed.

Full Changelog: v0.1.2...v0.2.0