From a payment's status to your ERP entry: a proposal.
This page is a conceptual proposal, not a product feature. CodeSpar does not write to ERPs: Omie and Tiny are not connectors it routes to, and Bling is routed only to issue NFS-e. What exists to build on: codespar_pay reads each payment's status by id, and codespar_wallet lists the wallet's entries. Mapping each money event to the right ERP, entity and account, and writing it, is your integration.
From a payment's status to your ERP entry.
An illustrative sketch: the agent reads the payment's status from CodeSpar and your integration writes the entry to the ERP. CodeSpar does not write to the ERP.
- CodeSpar returns the payment's status and the wallet's statement
- Writing to the ERP is your integration
- Bling is routed only to issue NFS-e
The conversation is the easy part.
Every transaction gets keyed into an ERP by hand, then reconciled at month end across countries and entities.
Key each transaction into the ERP
Your integration writes the entry from the payment's status
Check the bank portal for what settled
codespar_pay action=status reads each payment
Rebuild the wallet's movements for the accountant
codespar_wallet action=statement lists them
Attach the fiscal document by hand
codespar_invoice issues it (NFe.io, live projects only); attaching it is your integration
A proposal, on the records that exist.
Your integration reads what CodeSpar records: a payment's status by id (codespar_pay, action=status) and the wallet's entries (codespar_wallet, action=statement). It maps each entry to the entity, account and currency of the right ERP and writes it there. CodeSpar has no ERP connector that writes entries: Omie and Tiny are not routed, and Bling is routed only for NFS-e.
codespar_payPayment status by id
CodeSparcodespar_walletThe wallet's entries
CodeSparEntity, account, currency
The entry in the ERP
The fiscal document, if any
A sketch, not a product flow. codespar_pay with action=status returns a payment's provider status by id; codespar_wallet with action=statement returns the wallet's ledger entries. Your integration turns each settled entry into an ERP entry for the right entity and writes it through the ERP's own API. No CodeSpar connector writes to Omie, Bling or Tiny.
The code, and what it assumes.
// Prerequisites: CODESPAR_API_KEY set to a test key (csk_test_…) and a payment // made through codespar_pay. Writing to the ERP is your code: CodeSpar does not // write to Omie, Bling or Tiny. import { CodeSpar } from "@codespar/sdk"; const session = await new CodeSpar().create("user_0000", { preset: "brazilian" }); // what CodeSpar can tell your integration const status = await session.execute("codespar_pay", { action: "status", payment_id: "<payment id>" }); const statement = await session.execute("codespar_wallet", { action: "statement", consumer_id: "user_0000", limit: 20 }); // your integration: map each settled entry to the ERP of the right entity console.log(status.data, statement.data);
Example with the published SDK (@codespar/sdk 0.16.11). Its prerequisites are in the comments. Compiling does not prove the integration: run it in test mode first.
codespar_payaction=status reads a payment's status by id.
codespar_walletaction=statement lists the wallet's ledger entries.
Start with a test key.
Test keys are free. Open the sandbox, connect the providers your project uses and see which tools it can call before you build.