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.

BrandCard numberCVCExpiration date
Visa4242 4242 4242 4242Any 3 digitsAny future date
Visa (debit)4000 0566 5566 5556Any 3 digitsAny future date
Mastercard5555 5555 5555 4444Any 3 digitsAny future date
Mastercard (2-series)2223 0031 2200 3222Any 3 digitsAny future date
Mastercard (debit)5200 8282 8282 8210Any 3 digitsAny future date
Mastercard (prepaid)5105 1051 0510 5100Any 3 digitsAny 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.

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)NamePostal codeWithholding (retención)
CACX7605101P8No2XOCHILT CASAS CHAVEZ362570
FUNK671228PH6No1KARLA FUENTE NOLASCO011600
IAÑL750210963No1LUIS IAN ÑUZCO852560
JUFA7608212V6No1ADRIANA JUAREZ FERNANDEZ011600
KAHO641101B39No1OSCAR KALA HAAK760742
KICR630120NX3No1RODRIGO KITIA CASTRO362461
MISC491214B86No1CECILIA MIRANDA SANCHEZ010100
RAQÑ7701212M3No1ÑEVES RAMIREZ QUEZADA789050
WATM640917J45No1MARIA WATEMBER TORRES435430
WERX631016S30No1XAIME WEIR ROJO012790
XAMA620210DQ5No1ALBA XKARAJAM MENDEZ012190
XIQB891116QE4No4BERENICE XIMO QUEZADA409680
XOJI740919U48No1INGRID XODAR JIMENEZ760280

Legal entities (personas morales)

RFCSNCFVALIDEZ OBLIGACIONESNamePostal codeWithholding
EKU9003173C9No1ESCUELA KEMPER URGATE425010
IIA040805DZ4No1INDISTRIA ILUMINADORA DE ALMACENES626610
H&E951128469No1HERRERIA & ELECTRICOS060020
IVD920810GU2No1INNOVACION VALOR Y DESARROLLO639010
IXS7607092R5No1INTERNACIONAL XIMBO Y SABORES230040
JES900109Q90No1JIMENEZ ESTRADA SALAS371610
KIJ0906199R1No1KERNEL INDUSTIA JUGUETERA289710
L&O950913MSANo1LUCES & OBRAS609220
OÑO120726RX3Yes1ORGANICOS ÑAVEZ OSORIO405010
S&S051221SE2No1S & SOFTWARE760220
URE180429TM6No1UNIVERSIDAD ROBOTICA ESPAÑOLA869910
XIA190128J61No1XENON INDUSTRIAL ARTICLES763430
ZUÑ920208KL4No1ZAPATERIA URTADO ÑERI345410

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.");
    }
}

Was this page helpful?