Test data
Fiscalapi provides test data for your API integration. Use it to activate a subscription, buy stamps (one credit each, used each time you stamp a CFDI), and issue invoices in the test environment.
Test cards
Use these credit and debit cards to simulate payments in the test environment, both when you activate a subscription and when you buy stamps. Under PCI DSS security standards, you make all payments from the dashboard.
| Brand | Card number | CVC | Expiration date |
|---|---|---|---|
| Visa | 4242 4242 4242 4242 | Any 3 digits | Any future date |
| Visa (debit) | 4000 0566 5566 5556 | Any 3 digits | Any future date |
| Mastercard | 5555 5555 5555 4444 | Any 3 digits | Any future date |
| Mastercard (2-series) | 2223 0031 2200 3222 | Any 3 digits | Any future date |
| Mastercard (debit) | 5200 8282 8282 8210 | Any 3 digits | Any future date |
| Mastercard (prepaid) | 5105 1051 0510 5100 | Any 3 digits | Any future date |
Test people
Use these people (individuals or legal entities) to issue CFDIs (Mexico's electronic invoices) in the test environment. The SAT (Mexico's tax authority, Servicio de Administración Tributaria) requires you to use these people, their tax data, and their certificates for invoicing tests. You can use any tax regime (régimen fiscal, the SAT category a taxpayer is registered under, such as 601 or 626) and CFDI use (how the recipient will use the CFDI for tax purposes) compatible with each person.
You can also use your real tax data and certificates, but never made-up data.
Individuals (personas físicas)
| RFC (Mexico's taxpayer ID, Registro Federal de Contribuyentes) | SNCF (Sistema Nacional de Coordinación Fiscal member) | VALIDEZ OBLIGACIONES (SAT invoicing eligibility code) | Name | Postal code | Withholding (retención) |
|---|---|---|---|---|---|
| CACX7605101P8 | No | 2 | XOCHILT CASAS CHAVEZ | 36257 | 0 |
| FUNK671228PH6 | No | 1 | KARLA FUENTE NOLASCO | 01160 | 0 |
| IAÑL750210963 | No | 1 | LUIS IAN ÑUZCO | 85256 | 0 |
| JUFA7608212V6 | No | 1 | ADRIANA JUAREZ FERNANDEZ | 01160 | 0 |
| KAHO641101B39 | No | 1 | OSCAR KALA HAAK | 76074 | 2 |
| KICR630120NX3 | No | 1 | RODRIGO KITIA CASTRO | 36246 | 1 |
| MISC491214B86 | No | 1 | CECILIA MIRANDA SANCHEZ | 01010 | 0 |
| RAQÑ7701212M3 | No | 1 | ÑEVES RAMIREZ QUEZADA | 78905 | 0 |
| WATM640917J45 | No | 1 | MARIA WATEMBER TORRES | 43543 | 0 |
| WERX631016S30 | No | 1 | XAIME WEIR ROJO | 01279 | 0 |
| XAMA620210DQ5 | No | 1 | ALBA XKARAJAM MENDEZ | 01219 | 0 |
| XIQB891116QE4 | No | 4 | BERENICE XIMO QUEZADA | 40968 | 0 |
| XOJI740919U48 | No | 1 | INGRID XODAR JIMENEZ | 76028 | 0 |
Legal entities (personas morales)
| RFC | SNCF | VALIDEZ OBLIGACIONES | Name | Postal code | Withholding |
|---|---|---|---|---|---|
| EKU9003173C9 | No | 1 | ESCUELA KEMPER URGATE | 42501 | 0 |
| IIA040805DZ4 | No | 1 | INDISTRIA ILUMINADORA DE ALMACENES | 62661 | 0 |
| H&E951128469 | No | 1 | HERRERIA & ELECTRICOS | 06002 | 0 |
| IVD920810GU2 | No | 1 | INNOVACION VALOR Y DESARROLLO | 63901 | 0 |
| IXS7607092R5 | No | 1 | INTERNACIONAL XIMBO Y SABORES | 23004 | 0 |
| JES900109Q90 | No | 1 | JIMENEZ ESTRADA SALAS | 37161 | 0 |
| KIJ0906199R1 | No | 1 | KERNEL INDUSTIA JUGUETERA | 28971 | 0 |
| L&O950913MSA | No | 1 | LUCES & OBRAS | 60922 | 0 |
| OÑO120726RX3 | Yes | 1 | ORGANICOS ÑAVEZ OSORIO | 40501 | 0 |
| S&S051221SE2 | No | 1 | S & SOFTWARE | 76022 | 0 |
| URE180429TM6 | No | 1 | UNIVERSIDAD ROBOTICA ESPAÑOLA | 86991 | 0 |
| XIA190128J61 | No | 1 | XENON INDUSTRIAL ARTICLES | 76343 | 0 |
| ZUÑ920208KL4 | No | 1 | ZAPATERIA URTADO ÑERI | 34541 | 0 |
Test certificates
To issue CFDIs in the test environment, each test person has a CSD (Certificado de Sello Digital, the digital seal certificate used to sign CFDIs) made up of two files: the certificate (.cer) and the private key (.key) used to seal the invoices. Always use the pair that belongs to each person. The password for every private key is 12345678a.
Directory structure
When you unzip the certificates file, you get this structure:
Certificados_Pruebas/
├── Personas Físicas/
│ ├── RFC_PERSONA1_TIMESTAMP/
│ │ └── CSD_RFC_PERSONA1_TIMESTAMP/
│ │ ├── archivo.cer
│ │ ├── archivo.key
│ │ └── contraseña.txt
│ └── ...
└── Personas Morales/
├── RFC_EMPRESA1_TIMESTAMP/
│ └── CSD_RFC_EMPRESA1_TIMESTAMP/
│ ├── archivo.cer
│ ├── archivo.key
│ └── contraseña.txt
└── ...
The Personas Físicas (individuals) and Personas Morales (legal entities) folders contain one subfolder per person, named after the person's RFC. Each of them contains another folder, whose name starts with CSD_ followed by the RFC, that holds the person's .cer and .key files. These are the files you upload or send in your HTTP requests to issue CFDIs in the test environment.
Encoding files in base64
Base64 is an encoding scheme that turns any file into text, and it's one of the simplest ways to transfer files over the internet. Every programming language supports base64 encoding.
Encoding CSD files to base64
When you create an invoice in the by-value mode of operation (invoice by value: you send every issuer, recipient, and item value in the request), the taxCredentials field carries the issuer's CSD files (.cer and .key) encoded in base64. If your language isn't in the examples, search Google for "encode file to base64 in" followed by the name of your language.
Encoding CSD files to base64
using System;
using System.IO;
class Program
{
static string EncodeFileToBase64(string filePath)
{
byte[] fileBytes = File.ReadAllBytes(filePath);
return Convert.ToBase64String(fileBytes);
}
static void Main()
{
string cerFilePath = "ruta_del_archivo.cer";
string keyFilePath = "ruta_del_archivo.key";
// Encode the .cer file
string cerBase64 = EncodeFileToBase64(cerFilePath);
Console.WriteLine("Archivo .cer codificado en Base64: " + cerBase64);
// Encode the .key file
string keyBase64 = EncodeFileToBase64(keyFilePath);
Console.WriteLine("Archivo .key codificado en Base64: " + keyBase64);
}
}
Decoding base64 to files
To recover the original file from base64 content, such as a .cer, a .key, an XML, or a PDF, decode it. Every programming language supports base64 decoding.
Decoding base64-encoded files
When Fiscalapi receives an invoice by value request, it decodes the base64 CSD files to get the original files. You can do the same with any base64 file you receive in a Fiscalapi response, such as an XML, a PDF, or a logo.
If your language isn't in the examples, search Google for "decode base64 to original file in" followed by the name of your language.
Decoding base64-encoded files
using System;
using System.IO;
class Program
{
// Decodes a Base64 string to a file
static void DecodeBase64ToFile(string fileBase64, string filePath)
{
byte[] fileBytes = Convert.FromBase64String(fileBase64);
File.WriteAllBytes(filePath, fileBytes);
}
static void Main()
{
// Example: decode a Base64 string to a file
string xmlBase64 = "YXF1aV92YV9lbF9jb250ZW5pZG9fZGVfYmFzZTY0"; // Sample Base64 content
string pdfBase64 = "b3RyYV9jYWRlbmFfZGVfYmFzZTY0X2FxdWk="; // Sample Base64 content
string cerBase64 = "Y29udGVuaWRvX2RlbF9jZXJ0aWZpY2Fkb19lbl9iYXNlNjQ="; // Sample Base64 content
string keyBase64 = "Y29udGVuaWRvX2RlX2xhX2xsYXZlX3ByaXZhZGFfZW5fYmFzZTY0"; // Sample Base64 content
DecodeBase64ToFile(xmlBase64, "C:\\archivos\\factura.xml");
DecodeBase64ToFile(pdfBase64, "C:\\archivos\\factura.pdf");
DecodeBase64ToFile(cerBase64, "C:\\archivos\\certificado.cer");
DecodeBase64ToFile(keyBase64, "C:\\archivos\\llave-privada.key");
Console.WriteLine("Archivos decodificados y guardados.");
}
}