Skip to content
Payment Emulator LabDocumentationOpen console

Providers and icons

Provider contracts

Provider fidelity is the product. Route paths, required headers, request fields,statuses, errors and signatures must come from the provider's official contractor SDK, not from a co

2 min read

Índice / Index · Español

Provider fidelity is the product. Route paths, required headers, request fields, statuses, errors and signatures must come from the provider's official contract or SDK, not from a convenient internal shape.

#Source precedence

For a provider-facing change, consult sources in this order:

  1. Imported official specification under contracts/<provider>/ and the matching docs/en/fidelity/<provider>.md.
  2. Official SDK when the specification is silent or the SDK's behaviour is what an integration consumes.
  3. The architecture contract under .agents/.
  4. Current implementation and tests.
  5. The web only for information not available above.

If implementation and official contract disagree, implementation is the defect.

#Current contract state

Official OpenAPI snapshots are stored in contracts/mercadopago/mpOrders.json, contracts/stripe/spec3.json and contracts/paypal/paypalOrders.json / paypalPayments.json. Each has adjacent .meta.json metadata with source URL, retrieval date and SHA-256 over the exact downloaded bytes. Runtime validation is still a hand-written subset, not full OpenAPI validation.

Fidelity limits and confirmed routes live in:

#Explicit import

The Mercado Pago importer is opt-in and allow-listed:

bash
ALLOW_CONTRACT_DOWNLOAD=true npm run contract:import:mercadopago --workspace @payment-emulator/api

It downloads the configured official document, canonicalizes JSON and records a SHA-256 checksum. Contract download is tooling, never part of API or worker runtime. Verify the generated artifacts and attribution before committing them.

#Adding contract coverage

  1. Store the official document and checksum under contracts/<provider>/.
  2. Record origin, version/date and license/attribution.
  3. Derive provider validation without leaking provider fields into the canonical model.
  4. Add conformance cases and official-SDK checks where possible.
  5. State unsupported fields/products in the fidelity document.

A checksum proves which document was imported; it does not prove the emulator implements every operation in that document.

The opt-in importer writes canonicalized snapshots to ignored contracts/imported/; these are separate from the raw-byte audit snapshots above.

Payment Emulator Lab · RonuSoftwareMIT