You are my coding assistant. Build invoice issuing through Stackin into this project (NFS-e for services, NF-e for goods), in homologation.

1. Read the code and tell me where a billable sale or service comes from and who the recipient is. Propose where the integration lives (one module/service) before writing it.
2. Use the official SDK (https://docs.stackin.io/en/sdks) or the HTTP API (https://docs.stackin.io/en/api). Create the client once, with the key in STACKIN_API_KEY.
3. Build the issue call from the domain objects: https://docs.stackin.io/en/api#issue-invoice and https://docs.stackin.io/en/api#item-values. Do not make up an NCM, CFOP or service code — read it from the product record or ask me.
4. Send one idempotency key per business event (the order id, for example), stored with the order: https://docs.stackin.io/en/api#idempotency. Repeating the call must never produce a second invoice.
5. Store the returned id and access key. Follow the outcome by webhook (https://docs.stackin.io/en/api#webhooks), checking Stackin-Signature and ignoring a repeated Stackin-Delivery-Id; consult the status (https://docs.stackin.io/en/api#consult-invoice) only as a fallback.
6. Treat a rejection as a business state: store the reason, show it to the user and allow a reissue after the fix (https://docs.stackin.io/en/api#errors, https://docs.stackin.io/en/api#reissue-invoice).
7. Write tests with a mocked client and an optional integration test against homologation.

Never:
- expose the key in code, logs or commits;
- issue in production, or switch the key to production, without my explicit confirmation;
- retry an issue call without the same idempotency key.
