Collections removes the manual check between the charge, the bank and the order. Your agent creates the charge once, the payment is confirmed to your system, and the next step runs from there.
The flow, side by side
From the charge to the confirmed payment.
Your agent creates and follows up. CodeSpar collects and confirms. Your system takes the next step.
01Agent
The charge is created
Your agent creates one charge per instalment: amount, due date, payer. The customer can pay it by Pix or boleto.
invoice 1208 · 1/2 · R$ 1,180.00 · due Oct 602Customer
The customer pays
By Pix with the QR or the code, or by boleto with the line, in the app they already use.
Pix or boleto · until Oct 603CodeSpar
The payment is confirmed
The payment is confirmed, linked to the charge and recorded in your account's history.
payment confirmed · R$ 1,180.0004Your system
The next step runs
Your connected system receives the confirmation and updates the invoice or releases the order.
order 1208 released · by the connected system
Two ways to pay
In your channel or on a payment page.
Send the QR and the payment code through WhatsApp, e-mail or the app you already use, or share a link to a page where the customer sees the charge and pays. The charge and the confirmation are the same.
In your channel
QR and payment code where you talk to the customer
Your agent reads the QR and the code from the charge; your project's integration sends them in the WhatsApp thread, by e-mail or in your app.
Sending through the channel is done by your project's integration.
Collect page
A link the customer opens to pay
Share a link: the customer sees the charge with your name, fills in what is missing and pays by Pix.
The page shows your name as the receiver.
Behind it
Connect your agent to your billing workflow.
Create the charge, follow its state, receive the payment confirmation as an event, and repeat a request without creating a second charge.
SDK example · not run on this page
Cookbook
Two instalments, end to end.
One call creates each instalment with its key; one reads its state. The payment confirmation comes to your endpoint as an event.
- A test keyFrom the Dashboard. Test keys are free; nothing moves real money.
- An invoice to collectPayer name and document, amount and due date per instalment, and a key that names each one.
- An endpoint for the confirmationA trigger on commerce.charge.paid. Your handler matches the invoice and runs the next step.
// 1 · a test key from the Dashboard; a trigger on commerce.charge.paid points at your endpointimport { CodeSpar } from "@codespar/sdk";const session = await new CodeSpar().create("user_0000", { preset: "brazilian" }); // 2 · one charge per instalment, Pix or boleto with a due date, under a key that names itconst run = await session.send("create instalment 1/2 of invoice 1208 for ACME Distribuidora: R$ 1,180.00, due 2026-10-06, boleto or Pix, key inv-1208-1");const charge = run.tool_calls.find((c) => c.tool_name === "codespar_charge"); // 3 · the customer pays by Pix or boleto; follow the charge until it is paidif (charge) console.log((await session.paymentStatus(charge.id)).payment_status); // "succeeded"SDK example · not run on this page
Related use cases
Use case
WhatsApp: Pix payment request in chat
A Pix charge inside the conversation, paid in the bank app.
Use case
Business assistant for your customers
A platform offers its business customers an assistant that pays and collects under a mandate they control.