Environments and testing
Production and testing use the same address and are distinguished by ambiente in the request
Address and environments
All endpoints are served at https://api.tffiscal.com. Invoice endpoints select the environment through the request field ambiente: "1" is the production environment, in which invoices have legal effect; "2" is the test environment (homologação), processed by the test service of the tax authority, in which invoices have no legal effect. Tokens, signatures and company data are shared by both environments.
The test environment also requires the company to have uploaded a valid A1 digital certificate; the test service of the tax authority validates the certificate as well.
Differences between the test and production environments
| Item | Handling in the test environment |
|---|---|
| Buyer name | Replaced by the platform with NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL, as required by the tax authority for test invoices |
| CPF of an individual buyer | When a domestic buyer has no CNPJ, the CPF is replaced with 12345678909 |
| Invoice number | Counted separately from the production environment; test issuance does not consume production numbers |
| Duplicate submission protection | Not applied: each submission of the same id issues a new test invoice |
| Return invoices | When issued through /api/invoice/return, the original invoice is not referenced |
| Billing | Whether test issuance counts against the subscription quota is defined in the product description in the subscription center |
Consequently, a buyer name and CPF in the XML returned by the test environment that differ from the request are expected and do not indicate an error in the request data.
Recommended integration testing sequence
- Cover every issuance scenario of the business in the test environment: intrastate and interstate, individual and business buyers, every payment method and every transport mode.
- Cover failure paths: send one deliberately incorrect field and confirm that the integrator's system handles the response correctly according to
code. - When the asynchronous endpoint is used, confirm with "Send test" under "My Account" in the main platform that the Webhook URL receives and decrypts the payload.
- After switching to the production environment, issue and verify one low-value real invoice before increasing volume.