Cookbooks
End-to-end recipes you can copy into production. Each cookbook is a small working agent that solves one real commerce problem, wired through the CodeSpar SDK.
Cookbooks
@codespar/sdkv0.3.0Every cookbook is a runnable example — not pseudo-code. Copy the file, fill in your API key, and it executes against CodeSpar's sandbox. Swap csk_test_ for csk_live_ when you're ready.
Every cookbook ships with a test key that points at CodeSpar's sandbox. You don't need provider accounts to get it running — mock data flows through end-to-end.
Payments
End-to-end commerce
Architecture patterns
How the cookbooks are structured
Every cookbook follows the same shape so you can skim one and jump to any other.
- The scenario. A one-paragraph problem statement — who the user is, what they want, what constraints apply.
- The code. A single file, fully typed, no dependencies beyond
@codespar/sdkand what the scenario actually needs. - Walkthrough. Why each part exists. What would break if you changed it.
- Test run. Exact CLI commands to execute the cookbook against sandbox and what the output looks like.
- Production checklist. What to change before you ship. Usually: environment, API key prefix, error handling for the failure mode that matters for that flow.
Build your own
Missing a scenario? All cookbooks live in content/docs/cookbooks/*.mdx in this repo. Click "Edit this page on GitHub" on any cookbook to contribute.
Next steps
Last updated on
Servers & Toolkits
Browse CodeSpar's catalog of MCP servers across payments, fiscal, logistics, messaging, banking, ERP, crypto, and agentic commerce in Latin America.
Pix Payment Agent
The simplest agent you can build with CodeSpar. Create a Pix charge, generate a QR code, and send it to the customer via WhatsApp — in ~50 lines of code.