SaaS Invoice Billing

Bill subscriptions with crypto invoices, expiry timers, and partial payments.

Open the interactive version or read this guide as markdown.

Tags: Invoices, Webhooks

Paste this prompt into Claude, ChatGPT, or any AI tool. It works best with the CoinCircuit MCP server connected: https://mcp.coincircuit.io


You are helping me integrate CoinCircuit crypto invoicing into my existing SaaS billing system. I have the CoinCircuit MCP server connected.

If you have access to the CoinCircuit MCP server, call these tools for the most accurate and detailed schema outputs:

Use the live MCP data as your source of truth. The details below are a guide, but if the MCP returns something different, trust the MCP.

API Basics

Project Context

I have a SaaS app that bills customers monthly. I'm adding crypto invoice payments via CoinCircuit so customers can pay in any supported crypto (USDT, BTC, ETH, etc.).

What I Need You to Implement

1. Invoice creation on subscription renewal

Endpoint: POST /api/v1/invoices (Call get_endpoint with method post, path /api/v1/invoices, section request in the CoinCircuit MCP for the exact request body schema with all field types and validations.)

Required fields:

Optional fields:

Example request body:

{
  "amount": "29.99",
  "currency": "USD",
  "description": "Pro Plan - May 2026",
  "expiresAt": "2026-05-03T00:00:00.000Z",
  "customer": {
    "email": "subscriber@example.com",
    "firstName": "John",
    "lastName": "Doe"
  },
  "periodStart": "2026-05-01T00:00:00.000Z",
  "periodEnd": "2026-05-31T23:59:59.000Z",
  "nextPaymentDate": "2026-06-01T00:00:00.000Z",
  "metadata": {
    "subscriptionId": "sub_abc123",
    "plan": "pro"
  },
  "successUrl": "https://myapp.com/billing/success"
}

Response (201): Returns the invoice object. Key fields:

(Call get_endpoint with method post, path /api/v1/invoices, section success in the CoinCircuit MCP for the full response schema.)

Error responses: 400 (invalid input or expiresAt exceeds 2 days), 401 (bad API key)

2. Send the payment link

The response includes data.url. Email this to the customer or display it in your app's billing dashboard. The hosted page handles crypto selection, address display, and payment detection automatically.

3. Webhook event handling

(Call get_schema with name InvoicePaidWebhookDto in the CoinCircuit MCP for the full invoice.paid webhook payload with all nested fields including the payments array.)

Invoice events (envelope: { event: string, data: { invoice: InvoiceObject, payments?: PaymentArray } }):

Invoice webhook data fields:

Webhook security: Same as checkout: verify HMAC-SHA256 via x-coincircuit-signature, deduplicate via x-coincircuit-delivery-id.

Constraints