Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Usá Idempotency-Key para reintentar escrituras del SDK sin duplicar ventas, compras, pagos ni movimientos
Idempotency-Key
idempotencyKey
await lapyme.sales.create({ idempotencyKey: `sale:shopify:${order.id}`, body: { // ... }, });
sale:shopify:12345 purchase:vendor-bill:0001-00000042 stock-adjustment:warehouse-1:cycle-count-2026-05-24 customer:external-crm:88291
random UUID nuevo en cada retry timestamp-only-2026-05-24T10:30:00Z sale retry-1
import { Lapyme } from "lapyme"; import * as errors from "lapyme/models/errors"; const lapyme = new Lapyme({ bearerAuth: process.env["LAPYME_API_KEY"] ?? "", }); const idempotencyKey = `sale:shopify:${order.id}`; try { await lapyme.sales.create({ idempotencyKey, body: salePayload, }); } catch (error) { if ( error instanceof errors.ApiErrorEnvelope && error.error.retryable ) { // Reintentá la misma operación con el mismo idempotencyKey. await lapyme.sales.create({ idempotencyKey, body: salePayload, }); } else { throw error; } }
IDEMPOTENCY_CONFLICT
Was this page helpful?