Skip to main content

Use case · Charge in the conversation

Sandbox · Pix charge with QR

Send the Pix payment request in chat. Receive confirmation in your system.

The agent sends a Pix charge in the thread, with QR and copy-paste code. The customer pays in the bank app and the payment lands in your ledger.

Casa Sabãoconta comercial · online

Quero 2 do sabonete de lavanda e 1 do kit presente. Entrega em Pinheiros.

13:58 ✓✓

Pedido #1047

2× sabonete de lavandaR$ 89,901× kit presenteR$ 175,00entrega PinheirosR$ 25,00Total · Pix vale por 24 hR$ 289,90
Pague com o QR no app do seu banco
Copiar código Pix (copia e cola)

Cobrança Pix da Casa Sabão. A confirmação chega aqui.

14:02

Paguei pelo app do banco.

14:03 ✓✓

Pagamento recebido · R$ 289,90. Pedido #1047 confirmado, sai hoje para Pinheiros.

14:04

Charge · codespar_chargedemo

MethodPix · QR + copy-paste code

AmountR$ 289.90 · order #1047

Statussucceeded

Money inledger entry · #1047

1 · charge sent in the thread · 14:022 · paid in the bank app · 14:033 · ledger entry · order #1047 confirmed

Approval rule · optionalagent + codespar_charge

With this rule on, each charge from this agent waits for an operator in the Dashboard before it reaches the customer. It matches agent and tool, never an amount.

Illustrative · demo data

Demo

Charge, get paid, then decide a refund.

Send the Pix charge, pay as the customer, then let the agent propose a refund and decide it as the manager in the Dashboard.

Simulated demo · no real money
Activity demo2 entries
CustomerPaid in the bank app · R$ 289.90Pix · confirmed to the charge · ledger entry, money in+R$ 289.90paid
AgentPix charge · R$ 289.90codespar_charge · QR and copy-paste code · order #1047sent
Simulated result: paid. The payment is a ledger entry; order #1047 is confirmed in your system.

The session opens with the first two requests already run; Reset brings that state back.

Order #1047 demo

Received for order #1047

R$ 289.90

Pix chargesent · QR + code
Customer paymentpaid · Pix
Refund · money outnone
Ledgerentry · money in

No WhatsApp message is sent and no charge is issued: the thread is simulated in your browser.

The pain

The sale closes on WhatsApp, but the charge leaves the channel and the confirmation never comes back to the system.

Who uses it

The sales or support operator who runs the conversation.

Who buys it

The business owner, or the customer-service platform that serves those businesses.

The gain

Cart, Pix charge and confirmation in one thread, with the payment in your ledger. Money going out is a separate request your approval rule can hold.

The flow, side by side

From the cart to a confirmed payment.

The agent charges, the customer pays in the bank app, the ledger records it. Money going out is a separate request your rules can hold.

  1. 01Agent

    Cart from the conversation

    The copilot drafts the cart from what the customer wrote; prices come from your catalog.

    Pedido #1047 · R$ 289.90 · Illustrative
  2. 02CodeSpar

    Pix charge

    codespar_charge issues a Pix charge with QR and copy-paste code. With an approval rule on the tool, an operator approves it first.

    codespar_charge · Pix · 24 h
  3. 03Customer

    Paid in the bank app

    The customer pays with the QR or the code in the bank app. The payment is confirmed to the charge.

    payment_status · succeeded
  4. 04Your system

    Ledger and the thread

    Money in is a ledger entry. Your WhatsApp integration tells the customer the order is confirmed. A refund is a new request: money out.

    ledger entry · #1047 confirmed

Two ways to pay

Two ways to pay. One runs today.

Path B is what runs today, in the sandbox: a Pix charge in the thread, paid in the bank app. Path A, paying inside the chat under the customer's own mandate, is where this goes: it depends on a bank or partner and does not exist today. Below, how it would look.

Path B · QR / copy and paste

Sandbox

Pay in the bank app, confirmed in the thread

The cart goes out with a Pix QR and a copy-paste code. The customer pays in the bank app; the payment is confirmed to the charge and lands in your ledger. Your integration says so in the thread.

codespar_charge · Pix · QR + code · 24 hpaid in the bank app → succeeded→ ledger entry · order #1047 confirmed

Runs in the sandbox with a test key. Delivery on WhatsApp is your integration.

Path A · pay inside the chat

Direction · bank or partner

Confirm and pay in the message

The customer taps once and their own assistant pays under a mandate the customer gave their bank or a partner: cap per purchase, expiry, verified payee. No bank app.

tap "Confirmar e pagar" → customer's mandate checked→ paid from the customer's side

Direction. Depends on the bank or partner that holds the customer's mandate. It does not exist today.

Path A · pay inside the chat

Confirm and pay in the message, as it would look.

The same cart. The customer taps once and their own assistant pays under a mandate the customer gave their bank or a partner: cap, expiry, verified payee. No bank app, no redirect. None of this exists today; it depends on that bank or partner.

Direction · bank or partner
Casa Sabãoconta comercial · online

Quero 2 do sabonete de lavanda e 1 do kit presente. Entrega em Pinheiros.

13:58 ✓✓

Pedido #1047

2× sabonete de lavandaR$ 89,901× kit presenteR$ 175,00entrega PinheirosR$ 25,00Total · Pix vale por 24 hR$ 289,90
Direction · bank or partnerConfirmar e pagar · R$ 289,90Pagar com QR / copia e cola

Pagamento pelo seu assistente, dentro do seu mandato: teto R$ 800 por compra · válido até 30/11 · favorecido verificado.

14:02

Confirmado · pagar R$ 289,90 a Casa Sabão.

14:03 ✓✓

Pago · R$ 289,90. Dentro do seu mandato: R$ 289,90 de R$ 800 · favorecido verificado.

14:03

Pedido #1047 confirmado, sai hoje para Pinheiros.

14:04

  1. 1 · Cart sent
  2. 2 · The customer confirms and pays in the chatDirection · bank or partner
  3. 3 · Order confirmed in the thread
Check · customer's sidedemo

Customer mandatemnd_demo_cust · cap R$ 800 · until Nov 30

PayeeCasa Sabão · verified

AmountR$ 289.90 · inside the cap

Held bythe customer's bank or partner

Illustrative · demo data · It does not exist today: it depends on the bank or partner that holds the customer's mandate.

Behind it

Charge in, money out, each with its own rule.

Collect issues the charge; Pay sends the refund. A mandate governs what an agent spends, so the charge side has none: there, an optional approval rule puts a person before the charge.

Rules · Casa Sabão demo
Chargecodespar_charge · Pix · QR + code
Due date24 h after it is sent
Operator reviewoptional · approval rule on codespar_charge
Refunds (money out)codespar_pay · approval rule · manager
Money inledger entry · order reference
Three paths under the same rules demo
Happy pathOrder #1047 · R$ 289.90 · Pix charge → paid in the bank app → ledger entry; your integration confirms it in the thread.
With reviewAn approval rule on codespar_charge → the charge waits for an operator in the Dashboard before it reaches the customer. The rule matches agent and tool, never an amount.
Money outRefund of R$ 89.90 → codespar_pay → held by the approval rule on codespar_pay until the manager approves or refuses.
TypeScript · @codespar/sdk 0.16.11SDK example
const session = await new CodeSpar().create("user_0000", { preset: "brazilian" });const charge = await session.charge({ amount: 289.90, currency: "BRL", method: "pix", description: "Pedido #1047", buyer: { name: "Ana Souza" } });console.log(charge.pix_qr_code, charge.pix_copy_paste);// amount in major units: R$ 289.90 is 289.90 · your integration sends the code in the thread

SDK example · demo data · not run on this page

What runs it demo
CollectSandboxIssues the Pix charge with QR and copy-paste code.Open
ApprovalsExistsAn optional rule holds a tool call for a person: on codespar_charge, on codespar_pay, or both.Open
PaySandboxSends the refund back to the customer.Open
WalletExistsMoney in lands as a ledger entry.Open
WhatsApp deliveryPilot / integrationYour integration sends the charge and the confirmation in the thread.

What exists today

Exists, sandbox, pilot or direction: one label per control.

What you can run with a test key today, what runs in the sandbox, what depends on a pilot or an integration, and what is only a direction.

Pix charge with QR and copy-paste codecodespar_charge issues it in the sandbox with a test key.Sandbox
Payment confirmed into the ledgerThe charge turns succeeded and money in is a ledger entry. Money in gets no signed receipt.Sandbox
Approval rule on the charge or the refund toolHolds a tool call for a person. It matches agent and tool; it has no amount condition.Exists
Refund as money outcodespar_pay sends a Pix back to the customer.Sandbox
Cart read from the conversationThe copilot drafts the cart from what the customer wrote.Illustrative
Sending the charge and the confirmation on WhatsAppDelivery in the customer's thread is your integration.Pilot / integration
Pay inside the chat under the customer's mandateConfirm and pay in the message. Depends on a bank or partner; it does not exist today.Direction · bank or partner

Cookbook

A Pix charge in the chat, end to end.

One call issues the charge, one reads its status. An approval rule, if you set one, holds the charge in the Dashboard; the agent reads the outcome.

  1. A test keyFrom the Dashboard. Test keys are free; nothing moves real money.
  2. An approval rule, if you want oneAgent and tool, set in the Dashboard: codespar_charge for charges, codespar_pay for refunds.
  3. A conversationAny reference the agent can quote: customer, items, amount, order number.
@codespar/sdk 0.16.11SDK example
// 1 · a test key from the Dashboard; an approval rule on codespar_charge is optionalimport { CodeSpar } from "@codespar/sdk";const session = await new CodeSpar().create("user_0000", { preset: "brazilian" }); // 2 · the agent issues the Pix charge for order #1047: QR and copy-paste codeconst run = await session.send("charge R$ 289.90 by Pix to Ana Souza for order #1047");const charge = run.tool_calls.find((c) => c.tool_name === "codespar_charge"); // 3 · the customer pays in the bank app; follow the charge until it settlesif (charge) console.log((await session.paymentStatus(charge.id)).payment_status); // "succeeded"

SDK example · demo data · not run on this page

Related use cases

Use caseSandbox

CFO copilot

Pay approved invoices under your approval policy.

Use caseSandbox

Autonomous procurement

Supplier orders paid under your rules.

Use caseSandbox

API and compute budgets

Agents pay for APIs and compute under a budget.

Give your agents a way to pay and get paid.

Build is free: hosted MCP, SDK and sandbox.

Test keys are free.

terminal · test modedemo
$ claude mcp add --transport http codespar https://connect.codespar.dev/mcp \    --header "Authorization: Bearer <test key>"> "charge R$ 289.90 by Pix to Ana Souza for order #1047"  codespar_charge · Pix · QR and copy-paste code  paid in the bank app · succeeded · ledger entry, money in

Illustrative · demo data

WhatsApp: Pix payment request in chat · CodeSpar