Skip to content
Terra WalletDevelopers

Early access. The Terra API and SDKs may change before launch, and the SDK packages are not published yet.

View as Markdown

Terra Pay

Early access

Invoices

An invoice is a bill with line items and a due date. Terra hosts it at https://pay.terrawallet.us/i/inv_... and emails it to your customer, who pays it from their own wallet.

Create and send#

POST /v1/invoices:

FieldTypeRequiredNotes
customer_emailstringyesWhere the invoice is sent
line_itemsarrayyesEach item is {description, quantity, unit_amount}; unit_amount is a decimal string
currencystringyesA fiat ISO code
due_datedateyesWhen payment is due
accepted_assetsarray of assetsyesSee Payment intents

Then send it with POST /v1/invoices/:id/send.

JavaScript

// Preview: create and send an invoice (Node 18 or later).const headers = {  Authorization: `Bearer ${process.env.TERRA_SECRET_KEY}`,  "Content-Type": "application/json",}; const invoice = await fetch("https://terrawallet.us/api/v1/invoices", {  method: "POST",  headers: { ...headers, "Idempotency-Key": "invoice-2026-0042" },  body: JSON.stringify({    customer_email: "billing@client.example",    line_items: [      { description: "Design work, November", quantity: 1, unit_amount: "1800.00" },      { description: "Hosting", quantity: 3, unit_amount: "20.00" },    ],    currency: "USD",    due_date: "2026-12-15",    accepted_assets: [      { chain: "ethereum", symbol: "USDC", contract: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6 },      { chain: "tron", symbol: "USDT", contract: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", decimals: 6 },    ],  }),}).then((r) => r.json()); await fetch(`https://terrawallet.us/api/v1/invoices/${invoice.id}/send`, { method: "POST", headers });

Webhooks#

  • invoice.paid: the invoice was paid, verified on chain.
  • invoice.overdue: the due date passed without payment.

In the product design#

The Terra Pay design also includes automatic reminders, partial payments and PDF receipts for invoices. They are described in the API reference as they ship.