> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shakesco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Payments API Overview

> Request payments, view analytics, and query your store items via the API

<span style={{display:"none"}}>For the complete documentation index, see [llms.txt](/llms.txt).</span>

The Payments API (`https://payments.shakesco.com`) gives your backend full programmatic control over invoices, customer analytics, and store items. Use it to automate billing, build dashboards, or sync your catalogue.

<Note>
  All API calls require your API key. Get it from [users.shakesco.com/user/api-tokens](https://users.shakesco.com/user/api-tokens).
</Note>

## Invoices

Create invoices and generate a payment URL in one call:

```javascript theme={null}
const res = await fetch("https://payments.shakesco.com/invoices", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    type: "public",
    currency: "USD",
    payer_email: "customer@example.com",
    items: [{ description: "Consulting", unit: 5, price: 100 }],
  }),
});

const { invoice_number, payment_url } = await res.json();
// Share payment_url with your customer
```

**Other invoice operations:**

| Method | Endpoint                 | Description             |
| ------ | ------------------------ | ----------------------- |
| `GET`  | `/invoices`              | List all invoices       |
| `GET`  | `/invoices/:number`      | Get a single invoice    |
| `GET`  | `/invoices/payer/:email` | Invoices for a customer |
| `POST` | `/invoices/:number/void` | Cancel an invoice       |

<Card title="Full Invoice API" icon="file-invoice" href="/api-reference/payment-links/invoices/create">
  Complete parameter reference and response shapes
</Card>

## Analytics

Pull per-customer payment data into your own dashboards:

```javascript theme={null}
const email = encodeURIComponent("customer@example.com");
const res = await fetch(
  `https://payments.shakesco.com/analytics/customer/${email}`,
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);
const { overview, revenue, recent_transactions } = await res.json();
```

<Card title="Analytics API Reference" icon="chart-line" href="/api-reference/payment-links/analytics/customer">
  Full analytics endpoint documentation
</Card>

## Store Items

Fetch your store catalogue programmatically:

```javascript theme={null}
// Browse all items for a business
const res = await fetch("https://payments.shakesco.com/store/user/42?page=1", {
  headers: { Authorization: `Bearer ${API_KEY}` },
});
const { data } = await res.json();

// Get a single item
const item = await fetch("https://payments.shakesco.com/store/101", {
  headers: { Authorization: `Bearer ${API_KEY}` },
}).then(r => r.json());
```

<Card title="Store API Reference" icon="bag-shopping" href="/api-reference/payment-links/store/list">
  Full store endpoint documentation
</Card>

## Currency Codes

All currency codes used in invoices and analytics:

```javascript theme={null}
const res = await fetch("https://payments.shakesco.com/codes", {
  headers: { Authorization: `Bearer ${API_KEY}` },
});
const { currency_codes } = await res.json();
```

<Card title="Currency Codes" icon="globe" href="/api-reference/general/codes">
  List of all 300+ supported currency codes
</Card>
