SDKs Oficiales
Paquetes oficiales para integrar MercaloAPI en tu stack. Tipados, con reintentos automáticos y manejo de errores incluido.
🟢
Node.js / TypeScript
@mercalo/sdk · npm
Instalación
npm install @mercalo/sdkUso rápido
import { MercaloClient } from '@mercalo/sdk';
const mercalo = new MercaloClient(process.env.MERCALO_API_KEY!);
// Crear factura
const invoice = await mercalo.invoices.create({
companyId: 'uuid-empresa',
customer: { nit: '901234567', name: 'Cliente' },
items: [{ description: 'Servicio', quantity: 1, unitPrice: 100000, taxRate: 19 }],
});
console.log(invoice.cufe); // ✅ Tipado completo🐍
Python
mercalo · pip
Instalación
pip install mercaloUso rápido
import mercalo
client = mercalo.Client("sk_live_xxx")
invoice = client.invoices.create(
company_id="uuid-empresa",
customer={"nit": "901234567", "name": "Cliente"},
items=[{"description": "Servicio", "quantity": 1, "unit_price": 100000, "tax_rate": 19}],
)
print(invoice.cufe) # ✅🐘
PHP
mercalo/sdk · composer
Instalación
composer require mercalo/sdkUso rápido
<?php
use Mercalo\MercaloClient;
$mercalo = new MercaloClient('sk_live_xxx');
$invoice = $mercalo->invoices->create([
'companyId' => 'uuid-empresa',
'customer' => ['nit' => '901234567', 'name' => 'Cliente'],
'items' => [
['description' => 'Servicio', 'quantity' => 1, 'unitPrice' => 100000, 'taxRate' => 19],
],
]);
echo $invoice->cufe; // ✅🔷
C# / .NET
Mercalo.SDK · NuGet
Instalación
dotnet add package Mercalo.SDKUso rápido
using Mercalo;
var client = new MercaloClient("sk_live_xxx");
var invoice = await client.Invoices.CreateAsync(new CreateInvoiceRequest
{
CompanyId = "uuid-empresa",
Customer = new Customer { Nit = "901234567", Name = "Cliente" },
Items = new[] {
new InvoiceItem { Description = "Servicio", Quantity = 1, UnitPrice = 100000, TaxRate = 19 }
}
});
Console.WriteLine(invoice.Cufe); // ✅¿No encuentras tu lenguaje?
Nuestra API es REST estándar con JSON, así que puedes usarla con cualquier lenguaje que soporte HTTP. Revisa la guía de autenticación para empezar.