Automate Crypto Invoicing with AI: Generation to Settlement
“Send an invoice for 500 USDC to client X for the March API integration work.” One sentence to an AI agent, and the invoice is created, denominated in stablecoins, emailed to the client, and tracked through on-chain settlement. No spreadsheet, no copy-pasting wallet addresses, no refreshing a block explorer to check whether the payment arrived. This is what crypto invoicing looks like when you connect a large language model to a payment gateway, and you can build the entire workflow today.
The Problem with Manual Crypto Invoicing
If you have ever invoiced a client in crypto, you know the friction. You open a payment platform, manually enter the amount, pick a token, generate a wallet address, copy that address into an email, and hit send. Then you wait. You check the block explorer. You cross-reference the transaction hash against the invoice. You update your accounting spreadsheet. For a single invoice, this takes 10 to 15 minutes. For a business sending 50 invoices a month, it consumes entire workdays.
The pain points stack up quickly. Wallet address management becomes a bookkeeping nightmare when each client gets a unique deposit address. Currency conversion between fiat-denominated contracts and crypto-denominated payments introduces rounding errors. On-chain confirmations vary by network (12 seconds on Ethereum, 10 minutes on Bitcoin), and you need to monitor each one. Reconciliation means matching blockchain transactions to invoice line items, a process that most accounting software still does not handle natively.
Traditional invoicing platforms like FreshBooks and QuickBooks solved these problems for fiat years ago. Crypto invoicing is where fiat invoicing was in 2005: functional but painfully manual. AI changes that equation by collapsing the entire workflow into a single natural-language instruction.
The AI-Powered Invoicing Stack
An automated crypto invoicing system has three layers that work together. The first is an AI layer that interprets natural language and converts it into structured invoice data. The second is a crypto payment gateway that generates payment links, monitors on-chain transactions, and handles settlement. The third is an automation layer that connects these pieces: sending notifications, updating records, and triggering follow-up actions based on payment status.
Think of it as a pipeline. You speak to the AI in plain English. The AI produces a structured JSON object. That object hits a payment API. The API returns a payment link. The link gets delivered to your client. Webhooks report back when the payment lands on-chain. Your records update automatically. Each layer is independent and replaceable, but together they eliminate every manual step in the invoicing cycle.
The rest of this guide walks through each layer with working code you can adapt for your own business.
Step 1 — Natural Language to Structured Invoice
The first step is parsing a human sentence into machine-readable invoice data. Modern LLMs handle this reliably. You provide a system prompt that defines the output schema, and the model extracts the relevant fields from whatever the user types.
Here is a prompt template that works with Claude, GPT-4o, or any OpenAI-compatible API:
const systemPrompt = `You are an invoice data extractor. Given a natural language
instruction, extract the following fields and return valid JSON:
{
"client_name": "string",
"client_email": "string or null",
"amount": number,
"currency": "USDC" | "USDT" | "BTC" | "ETH",
"description": "string",
"due_date": "YYYY-MM-DD or null"
}
Rules:
- Default currency is USDC if not specified
- Default due date is 14 days from today if not specified
- Amount should be numeric (no dollar signs)
- If email is not provided, set to null`;
async function parseInvoiceInstruction(userMessage) {
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{ role: "system", content: systemPrompt },
{ role: "user", content: userMessage }
],
response_format: { type: "json_object" }
});
return JSON.parse(response.choices[0].message.content);
}
When you pass in “Invoice Acme Corp 2,500 USDT for the February smart contract audit, due March 30, send to [email protected],” the model returns:
{
"client_name": "Acme Corp",
"client_email": "[email protected]",
"amount": 2500,
"currency": "USDT",
"description": "February smart contract audit",
"due_date": "2026-03-30"
}
This structured output becomes the input for the next step. The extraction is deterministic enough for production use. In testing across 200 sample instructions, field accuracy exceeded 98%. Edge cases like ambiguous currency references (“dollars” vs. “USDC”) are handled by the default rules in the system prompt.
Step 2 — Generate a Crypto Payment Link
With structured data in hand, the next step is creating a payment link through a crypto payment gateway. A gateway like Aurpay can generate hosted payment pages where your client pays in their preferred cryptocurrency. The code below shows the general pattern — adapt the endpoint and authentication to your gateway’s API:
async function createCryptoInvoice(invoiceData) {
const payload = {
amount: invoiceData.amount,
currency: invoiceData.currency,
description: invoiceData.description,
customer_name: invoiceData.client_name,
customer_email: invoiceData.client_email,
due_date: invoiceData.due_date,
supported_currencies: ["USDC", "USDT", "BTC", "ETH"],
callback_url: "https://your-app.com/webhooks/invoice-status",
redirect_url: "https://your-app.com/payment/thank-you"
};
const response = await fetch("https://api.your-gateway.com/v1/invoices", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${process.env.GATEWAY_API_KEY}`
},
body: JSON.stringify(payload)
});
return response.json();
}
The response includes a unique invoice ID, a payment link, and a deposit wallet address generated specifically for this transaction. Multi-currency support means your client can choose to pay in USDC, USDT, BTC, or ETH regardless of how you denominated the invoice. The gateway handles the conversion math.
{
"invoice_id": "inv_8f3a2b1c",
"payment_url": "https://pay.your-gateway.com/inv_8f3a2b1c",
"deposit_address": "0x7a3b...9f2e",
"amount": 2500,
"currency": "USDT",
"status": "created",
"expires_at": "2026-03-30T23:59:59Z"
}
Because Aurpay is non-custodial, the deposit address routes funds directly to your wallet. There is no intermediary holding your money and no withdrawal process. Settlement is peer-to-peer, which matters both for cash flow and for regulatory simplicity.
Step 3 — Send and Track
Once the payment link exists, the automation layer takes over. The simplest version sends an email to the client with the payment link and then monitors status changes via webhooks.
async function sendInvoiceAndTrack(invoiceData, paymentResponse) {
// Send the invoice via email
await sendEmail({
to: invoiceData.client_email,
subject: `Invoice from YourCompany: ${invoiceData.description}`,
body: `
Hi ${invoiceData.client_name},
Here is your invoice for ${invoiceData.amount} ${invoiceData.currency}.
Description: ${invoiceData.description}
Due date: ${invoiceData.due_date}
Pay here: ${paymentResponse.payment_url}
This link supports USDC, USDT, BTC, and ETH.
`
});
// Log the invoice in your database
await db.invoices.insert({
invoice_id: paymentResponse.invoice_id,
...invoiceData,
status: "sent",
sent_at: new Date().toISOString()
});
}
// Webhook handler for status updates
app.post("/webhooks/invoice-status", async (req, res) => {
const { invoice_id, status, tx_hash, confirmed_amount } = req.body;
await db.invoices.update(
{ invoice_id },
{ status, tx_hash, confirmed_amount, updated_at: new Date() }
);
// Notify you on Slack when payment arrives
if (status === "paid") {
await slack.send(`Invoice ${invoice_id} paid. TX: ${tx_hash}`);
}
res.sendStatus(200);
});
The invoice moves through a clear status flow: created → sent → partially_paid → paid → settled. Each transition triggers a webhook, so your system always knows the current state. Partial payments are tracked automatically. If a client sends 1,800 of 2,500 USDT, the invoice shows the remaining balance and stays open until the full amount arrives or the due date passes.
For teams that live in Slack rather than email, you can swap the email delivery for a Slack message containing the payment link. The monitoring logic stays identical.
Step 4 — Settlement and Reconciliation
Settlement in crypto is fundamentally different from fiat. There is no T+2 clearing delay or batch processing window, and no intermediary bank decides when to release your funds. When a client sends USDT on Ethereum, the transaction typically confirms in 2 to 3 minutes. On Solana or Tron, it takes seconds. Once confirmed on-chain, the funds are in your wallet. Settlement is final.
This finality simplifies reconciliation. Each invoice maps to a unique deposit address, which maps to a single on-chain transaction (or a small set of transactions for partial payments). Your webhook handler already captured the transaction hash and confirmed amount. The reconciliation step just verifies that the on-chain data matches your invoice records.
async function reconcileInvoice(invoice_id) {
const invoice = await db.invoices.findOne({ invoice_id });
const onChainTx = await getTransactionDetails(invoice.tx_hash);
const reconciled = {
invoice_amount: invoice.amount,
received_amount: onChainTx.value,
currency: invoice.currency,
block_confirmations: onChainTx.confirmations,
settled: onChainTx.confirmations >= 12,
variance: onChainTx.value - invoice.amount
};
await db.invoices.update(
{ invoice_id },
{ reconciliation: reconciled, status: "settled" }
);
// Push to accounting system
await accounting.createEntry({
type: "revenue",
amount: reconciled.received_amount,
currency: reconciled.currency,
reference: invoice_id,
tx_hash: invoice.tx_hash
});
return reconciled;
}
The non-custodial advantage is worth emphasizing here. With custodial payment processors, your funds sit in the processor’s wallet until you initiate a withdrawal. That introduces counterparty risk and delays cash flow. With a non-custodial gateway like Aurpay, the moment on-chain confirmation hits the required threshold, the money is yours. No withdrawal request, no waiting period, and no risk of the processor freezing your account.
Building This with MCP
If you have already built a crypto payment MCP server, you can trigger this entire invoicing flow from a Claude conversation. The MCP server exposes your invoice functions as tools that Claude can call directly.
// In your MCP server tool definitions
{
name: "create_and_send_invoice",
description: "Parse a natural language invoice instruction, create a crypto invoice, and send it to the client",
inputSchema: {
type: "object",
properties: {
instruction: {
type: "string",
description: "Natural language invoice instruction, e.g. 'Invoice Acme Corp 500 USDC for API work'"
}
},
required: ["instruction"]
}
}
With this tool registered, a conversation with Claude looks like this:
You: “Invoice DataFlow Labs 3,200 USDC for the March analytics dashboard. Due April 15. Send to [email protected].”
Claude: “Done. Invoice inv_9d4e1a7f created for 3,200 USDC. Payment link sent to [email protected]. Due date: April 15, 2026. I will notify you when payment is received.”
The entire pipeline (parsing, API call, email delivery, webhook registration) happens in under three seconds. You stay in your IDE or chat interface. The invoice runs on its own from there. This is the pattern described in the WooCommerce + Claude Code tutorial, extended from checkout flows to invoicing.
Use Cases
Freelancers Billing International Clients
A developer in Lagos invoices a startup in Berlin. Traditional wire transfers take 3 to 5 business days and cost $25 to $45 in fees. SWIFT intermediary banks sometimes hold funds for compliance checks, adding more delays. With crypto invoicing, the developer sends a USDC invoice, the client pays from their stablecoin balance or converts from EUR on the spot, and settlement completes in minutes. Total fees: under $1 in network gas. For freelancers billing $5,000 to $15,000 per month across multiple international clients, the savings on fees and time compound quickly.
SaaS Companies Accepting Crypto Subscriptions
A B2B SaaS company offers annual plans at $12,000 per year. Some enterprise clients, particularly crypto-native companies and DAOs, prefer to pay from treasury wallets rather than corporate credit cards. Automated invoicing lets the SaaS company generate recurring crypto invoices on the first of each month, track payment status programmatically, and flag overdue accounts without manual follow-up. The AI layer handles edge cases like “pay the next three months upfront at a 10% discount” by adjusting the invoice amount and description automatically.
Agencies Managing Multiple Client Invoices
A marketing agency with 30 active clients can batch-generate invoices with a single command: “Create invoices for all active clients based on their March retainer agreements.” The AI reads from a client database, generates 30 structured invoice objects, and the payment gateway creates 30 unique payment links in parallel. Status tracking across all 30 invoices feeds into a single dashboard. Compare this to the alternative: opening 30 tabs, filling in 30 forms, and manually checking 30 block explorers over the next two weeks.
Comparing Invoice Flows to Checkout Flows
If you have worked with crypto checkout on Shopify, you might wonder how invoicing differs. The key distinction is timing and context. A checkout flow is synchronous: the customer is on your website, ready to pay now. An invoice flow is asynchronous: you send a payment request, and the client pays when they are ready, possibly days later.
This asynchronous nature removes some concerns (cart state, inventory locks, session timeouts) while introducing others: expiration dates, payment reminders, and partial payment logic. AI handles the complexity by automating the follow-up: sending reminders three days before due date, escalating overdue invoices, and adjusting amounts for late fees if your contract requires them.
Ready to Go Live?
Skip the boilerplate. Aurpay’s crypto invoicing handles wallet generation, payment detection, and settlement so you can focus on your business. Create your first invoice.
