Ejemplos de boletas
Recetas listas para copiar y validadas ante SUNAT, igual que las de facturas. Los campos están explicados en Emitir una boleta.
La boleta más simple, sin datos del cliente, está en la guía de la primera boleta; la boleta con bolsa plástica (ICBPER), en el ejemplo de boletas.
Venta de más de S/ 700: cliente identificado
Sección titulada «Venta de más de S/ 700: cliente identificado»Una boleta sin documento del cliente (NONE) solo se admite hasta S/ 700.00. Por encima, identifica al cliente con DNI, CE, pasaporte o RUC; si no, la API responde 422 ReceiptRequiresCustomerDocument.
curl -X POST https://faktura-test.cgallardo.me/v1/receipts \ -H "Authorization: Bearer sk_test_..." \ -H "Content-Type: application/json" \ -H "Idempotency-Key: pos-0042-000301" \ -d '{ "series": "B001", "customer": { "doc_type": "DNI", "doc_number": "45678912", "name": "MARIA PEREZ" }, "items": [ { "description": "Refrigeradora 300 L", "quantity": 1, "unit_price": 1899 } ] }'use Illuminate\Support\Facades\Http;
$response = Http::withToken('sk_test_...') ->withHeaders(['Idempotency-Key' => 'pos-0042-000301']) ->post('https://faktura-test.cgallardo.me/v1/receipts', [ 'series' => 'B001', 'customer' => [ 'doc_type' => 'DNI', 'doc_number' => '45678912', 'name' => 'MARIA PEREZ', ], 'items' => [ [ 'description' => 'Refrigeradora 300 L', 'quantity' => 1, 'unit_price' => 1899, ], ], ]);
$data = $response->json();const response = await fetch('https://faktura-test.cgallardo.me/v1/receipts', { method: 'POST', headers: { Authorization: 'Bearer sk_test_...', 'Content-Type': 'application/json', 'Idempotency-Key': 'pos-0042-000301', }, body: JSON.stringify({ series: 'B001', customer: { doc_type: 'DNI', doc_number: '45678912', name: 'MARIA PEREZ' }, items: [{ description: 'Refrigeradora 300 L', quantity: 1, unit_price: 1899 }], }),});const data = await response.json();{ "totals": { "taxed": "1609.32", "exempt": "0.00", "unaffected": "0.00", "free": "0.00", "igv": "289.68", "icbper": "0.00", "total_taxes": "289.68", "discounts": "0.00", "charges": "0.00", "total": "1899.00" }, "amount_in_words": "SON MIL OCHOCIENTOS NOVENTA Y NUEVE CON 00/100 SOLES"}Restaurante: recargo al consumo
Sección titulada «Restaurante: recargo al consumo»service_charge agrega el recargo al consumo (por ejemplo, 10 %). Se calcula sobre el valor de venta sin IGV, no forma parte de la base del IGV y se suma al total (Cálculo de impuestos).
curl -X POST https://faktura-test.cgallardo.me/v1/receipts \ -H "Authorization: Bearer sk_test_..." \ -H "Content-Type: application/json" \ -H "Idempotency-Key: pos-0042-000302" \ -d '{ "series": "B001", "customer": { "doc_type": "NONE" }, "items": [ { "description": "Lomo saltado", "quantity": 2, "unit_price": 38 }, { "description": "Chicha morada (jarra)", "quantity": 1, "unit_price": 18 } ], "service_charge": { "percent": 10 } }'use Illuminate\Support\Facades\Http;
$response = Http::withToken('sk_test_...') ->withHeaders(['Idempotency-Key' => 'pos-0042-000302']) ->post('https://faktura-test.cgallardo.me/v1/receipts', [ 'series' => 'B001', 'customer' => ['doc_type' => 'NONE'], 'items' => [ [ 'description' => 'Lomo saltado', 'quantity' => 2, 'unit_price' => 38, ], [ 'description' => 'Chicha morada (jarra)', 'quantity' => 1, 'unit_price' => 18, ], ], 'service_charge' => ['percent' => 10], ]);
$data = $response->json();const response = await fetch('https://faktura-test.cgallardo.me/v1/receipts', { method: 'POST', headers: { Authorization: 'Bearer sk_test_...', 'Content-Type': 'application/json', 'Idempotency-Key': 'pos-0042-000302', }, body: JSON.stringify({ series: 'B001', customer: { doc_type: 'NONE' }, items: [ { description: 'Lomo saltado', quantity: 2, unit_price: 38 }, { description: 'Chicha morada (jarra)', quantity: 1, unit_price: 18 }, ], service_charge: { percent: 10 }, }),});const data = await response.json();El recargo es el 10 % de la base sin IGV (79.66), va en totals.charges y en service_charge, y se suma al total:
{ "totals": { "taxed": "79.66", "exempt": "0.00", "unaffected": "0.00", "free": "0.00", "igv": "14.34", "icbper": "0.00", "total_taxes": "14.34", "discounts": "0.00", "charges": "7.97", "total": "101.97" }, "service_charge": { "base_amount": "79.66", "amount": "7.97" }}Boleta en dólares
Sección titulada «Boleta en dólares»En dólares el cliente debe estar identificado siempre, aunque el monto sea bajo.
curl -X POST https://faktura-test.cgallardo.me/v1/receipts \ -H "Authorization: Bearer sk_test_..." \ -H "Content-Type: application/json" \ -H "Idempotency-Key: pos-0042-000303" \ -d '{ "series": "B001", "currency": "USD", "customer": { "doc_type": "PASAPORTE", "doc_number": "X1234567", "name": "JOHN SMITH" }, "items": [ { "description": "Tour Valle Sagrado", "quantity": 2, "unit_price": 45 } ] }'use Illuminate\Support\Facades\Http;
$response = Http::withToken('sk_test_...') ->withHeaders(['Idempotency-Key' => 'pos-0042-000303']) ->post('https://faktura-test.cgallardo.me/v1/receipts', [ 'series' => 'B001', 'currency' => 'USD', 'customer' => [ 'doc_type' => 'PASAPORTE', 'doc_number' => 'X1234567', 'name' => 'JOHN SMITH', ], 'items' => [ [ 'description' => 'Tour Valle Sagrado', 'quantity' => 2, 'unit_price' => 45, ], ], ]);
$data = $response->json();const response = await fetch('https://faktura-test.cgallardo.me/v1/receipts', { method: 'POST', headers: { Authorization: 'Bearer sk_test_...', 'Content-Type': 'application/json', 'Idempotency-Key': 'pos-0042-000303', }, body: JSON.stringify({ series: 'B001', currency: 'USD', customer: { doc_type: 'PASAPORTE', doc_number: 'X1234567', name: 'JOHN SMITH' }, items: [{ description: 'Tour Valle Sagrado', quantity: 2, unit_price: 45 }], }),});const data = await response.json();{ "currency": "USD", "totals": { "taxed": "76.27", "exempt": "0.00", "unaffected": "0.00", "free": "0.00", "igv": "13.73", "icbper": "0.00", "total_taxes": "13.73", "discounts": "0.00", "charges": "0.00", "total": "90.00" }, "amount_in_words": "SON NOVENTA CON 00/100 DÓLARES AMERICANOS"}