# Payments API

> List and retrieve payments with the Anytime Capital Payments API: status, amounts, net after fees, method, customer, metadata and disputes, filtered by date.

Source: https://anytime-capital.com/docs/payments · Markdown: https://anytime-capital.com/docs/payments.md · All docs: https://anytime-capital.com/docs/llms-full.txt

A payment is one charge (by card, card wallet, bank account or stablecoin) on a payment link, an invoice or a subscription. Customers create payments at checkout; the API reads them. To give money back, see [Refunds](https://anytime-capital.com/docs/refunds.md); to follow chargebacks, [Disputes](https://anytime-capital.com/docs/disputes.md).

| Topic | Detail |
| --- | --- |
| Endpoints | [`GET /api/v1/payments`](#list-payments), [`GET /api/v1/payments/{id}`](#get-payment) |
| Key permissions | `payments:read` |
| Samples | curl; Node.js 18+ with the built-in `fetch` (in an ES module); the [Node SDK](https://anytime-capital.com/docs/node-sdk.md) (preview: not on npm yet); Python with `requests`. |
| Every request can also answer | 401 `UNAUTHORIZED`, 401 `API_KEY_EXPIRED`, 403 `NOT_ENROLLED`, 403 `PERMISSION_DENIED`, 403 `IP_NOT_ALLOWED`, 429 `RATE_LIMITED`, 500 `INTERNAL_ERROR`. See [Error codes](https://anytime-capital.com/docs/error-codes.md). |

## The payment object

```json
{
  "object": "payment",
  "livemode": true,
  "id": "pay_7Hq2LmX9cR4tVb",
  "status": "paid",
  "amountCents": 12500,
  "amountRefundedCents": 0,
  "netCents": 12088,
  "currency": "usd",
  "description": "Consulting — October",
  "source": {
    "type": "payment_link",
    "id": "pl_4kTz8QwN2xYb6RcD1mPa"
  },
  "paymentLinkId": "pl_4kTz8QwN2xYb6RcD1mPa",
  "customer": {
    "name": "Jordan Lee",
    "email": "jordan@example.com",
    "country": "US"
  },
  "card": {
    "brand": "visa",
    "last4": "4242"
  },
  "paymentMethod": {
    "type": "card",
    "label": "Visa •••• 4242"
  },
  "clientReference": "order_1042",
  "metadata": {
    "campaign": "fall-launch"
  },
  "amountDetails": {
    "subtotalCents": 12500,
    "discountCents": 0,
    "shippingCents": 0,
    "taxCents": 0,
    "customerFeeCents": 0
  },
  "dispute": null,
  "failureMessage": null,
  "createdAt": "2026-10-14T16:02:11.000Z",
  "paidAt": "2026-10-14T16:02:15.000Z"
}
```

| Field | Type | Description |
| --- | --- | --- |
| `object` | string | The type of object. Always `payment`. |
| `livemode` | boolean | False for test-mode data (an `ak_test_` key); true for live data. |
| `id` | string | `pay_…` |
| `status` | string | `paid`, `pending`, `failed`, `canceled`, `refunded`, `partially_refunded`, `disputed`: the payment's state now, as **Orders** shows it. |
| `amountCents` | integer | What the customer paid. Integer cents. |
| `amountRefundedCents` | integer | Refunded so far. Integer cents. |
| `netCents` | integer or null | What you keep after fees, once known; null until then. |
| `currency` | string | Lower-case ISO 4217, e.g. usd. |
| `description` | string | The link's title or `Invoice INV-0001`. |
| `source` | object |  |
| `source.type` | string | One of `payment_link`, `invoice`, `subscription`, `manual`. |
| `source.id` | string or null | The payment link, invoice or subscription id. |
| `paymentLinkId` | string or null | The payment link it was paid on; null for invoices, subscriptions and manual charges. With `metadata`, how a shop matches a payment to its order. |
| `customer` | object |  |
| `customer.name` | string or null | Billing name. |
| `customer.email` | string | Customer email. |
| `customer.country` | string or null | Billing country, ISO 3166-1 alpha-2. |
| `paymentMethod` | object or null |  |
| `paymentMethod.type` | string | `card`, `apple_pay`, `google_pay`, `us_bank_account` or `stablecoin`; more may be added. |
| `paymentMethod.label` | string | Visa •••• 4242. |
| `card` | object or null |  |
| `card.brand` | string or null | Card network. |
| `card.last4` | string or null | Last four digits. |
| `clientReference` | string or null | Your own reference, from `?ref=` on the link or `data-ref` on your website's Pay button. |
| `metadata` | object | The payment link's metadata when the payment was made; `{}` when it had none. |
| `amountDetails` | object |  |
| `amountDetails.subtotalCents` | integer or null | Before discount, shipping and fees. Integer cents. |
| `amountDetails.discountCents` | integer | Discount code savings. Integer cents. |
| `amountDetails.shippingCents` | integer | Shipping. Integer cents. |
| `amountDetails.taxCents` | integer | Sales tax. Integer cents. |
| `amountDetails.customerFeeCents` | integer | A surcharge the customer paid. Integer cents. |
| `dispute` | object or null |  |
| `dispute.status` | string | One of `needs_response`, `under_review`, `won`, `lost`, `closed`. |
| `failureMessage` | string or null | Why the latest attempt failed. |
| `createdAt` | string (date-time) | When the payment was started. |
| `paidAt` | string (date-time) or null | When it went through. |

> **Some payments take days:** A bank account payment (`us_bank_account`) stays `pending` for 3–5 business days before it is `paid` or `failed`. Fulfil on the `payment.succeeded` [webhook](https://anytime-capital.com/docs/webhooks.md), not when checkout finishes.

## Endpoints

### List payments

`GET /api/v1/payments`

Permission: `payments:read`.

Card, wallet and bank payments on links, invoices and subscriptions, newest first.

**Query**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | string | no | Only payments with this status. One of `paid`, `pending`, `failed`, `canceled`, `refunded`, `partially_refunded`, `disputed`. |
| `createdFrom` | string | no | Created at or after: a date such as `2026-10-01` (midnight UTC) or an ISO 8601 date-time with its offset, such as `2026-10-01T12:00:00Z`. |
| `createdTo` | string | no | Created before (exclusive), in the same format. Must be after `createdFrom`. |
| `limit` | integer | no | How many objects per page, 1–100. Default 25. See [Pagination](https://anytime-capital.com/docs/pagination.md). |
| `cursor` | string | no | The previous page's `nextCursor`, for the page after it. |

**Request (curl)**

```bash
curl "https://anytime-capital.com/api/v1/payments?status=paid&createdFrom=2026-10-01&createdTo=2026-11-01" \
  -H "Authorization: Bearer $ANYTIME_API_KEY"
```

**Request (Node.js)**

```javascript
const res = await fetch("https://anytime-capital.com/api/v1/payments?status=paid&createdFrom=2026-10-01&createdTo=2026-11-01", {
  headers: { Authorization: `Bearer ${process.env.ANYTIME_API_KEY}` },
});
const page = await res.json();
if (!res.ok) throw new Error(`${page.error.code}: ${page.error.message}`);
```

**Request (Node SDK)**

```typescript
import { AnytimeCapital } from "@anytimecapital/node";

const client = new AnytimeCapital({ apiKey: process.env.ANYTIME_API_KEY! });

const page = await client.payments.list(
  { status: "paid", createdFrom: "2026-10-01", createdTo: "2026-11-01" },
);
```

**Request (Python)**

```python
import os

import requests

res = requests.get(
    "https://anytime-capital.com/api/v1/payments",
    headers={"Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}"},
    params={
        "status": "paid",
        "createdFrom": "2026-10-01",
        "createdTo": "2026-11-01",
    },
    timeout=30,
)
page = res.json()
if not res.ok:
    raise RuntimeError(f"{page['error']['code']}: {page['error']['message']}")
```

**Response** (200)

```json
{
  "object": "list",
  "data": [
    {
      "object": "payment",
      "livemode": true,
      "id": "pay_7Hq2LmX9cR4tVb",
      "status": "paid",
      "amountCents": 12500,
      "amountRefundedCents": 0,
      "netCents": 12088,
      "currency": "usd",
      "description": "Consulting — October",
      "source": {
        "type": "payment_link",
        "id": "pl_4kTz8QwN2xYb6RcD1mPa"
      },
      "paymentLinkId": "pl_4kTz8QwN2xYb6RcD1mPa",
      "customer": {
        "name": "Jordan Lee",
        "email": "jordan@example.com",
        "country": "US"
      },
      "card": {
        "brand": "visa",
        "last4": "4242"
      },
      "paymentMethod": {
        "type": "card",
        "label": "Visa •••• 4242"
      },
      "clientReference": "order_1042",
      "metadata": {
        "campaign": "fall-launch"
      },
      "amountDetails": {
        "subtotalCents": 12500,
        "discountCents": 0,
        "shippingCents": 0,
        "taxCents": 0,
        "customerFeeCents": 0
      },
      "dispute": null,
      "failureMessage": null,
      "createdAt": "2026-10-14T16:02:11.000Z",
      "paidAt": "2026-10-14T16:02:15.000Z"
    }
  ],
  "hasMore": true,
  "nextCursor": "pay_7Hq2LmX9cR4tVb"
}
```

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 400 | `INVALID_INPUT` | A field, filter, `limit` or `cursor` is missing or invalid. The message starts with the field's name, as in `amountCents: …`, or reads `Invalid cursor.` Fix the named field. Don't retry the same request unchanged. |

### Get a payment

`GET /api/v1/payments/{id}`

Permission: `payments:read`.

One payment by id.

**Path**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The payment's id, `pay_…`. |

**Request (curl)**

```bash
curl https://anytime-capital.com/api/v1/payments/pay_7Hq2LmX9cR4tVb \
  -H "Authorization: Bearer $ANYTIME_API_KEY"
```

**Request (Node.js)**

```javascript
const res = await fetch("https://anytime-capital.com/api/v1/payments/pay_7Hq2LmX9cR4tVb", {
  headers: { Authorization: `Bearer ${process.env.ANYTIME_API_KEY}` },
});
const payment = await res.json();
if (!res.ok) throw new Error(`${payment.error.code}: ${payment.error.message}`);
```

**Request (Node SDK)**

```typescript
import { AnytimeCapital } from "@anytimecapital/node";

const client = new AnytimeCapital({ apiKey: process.env.ANYTIME_API_KEY! });

const payment = await client.payments.retrieve("pay_7Hq2LmX9cR4tVb");
```

**Request (Python)**

```python
import os

import requests

res = requests.get(
    "https://anytime-capital.com/api/v1/payments/pay_7Hq2LmX9cR4tVb",
    headers={"Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}"},
    timeout=30,
)
payment = res.json()
if not res.ok:
    raise RuntimeError(f"{payment['error']['code']}: {payment['error']['message']}")
```

**Response** (200)

```json
{
  "object": "payment",
  "livemode": true,
  "id": "pay_7Hq2LmX9cR4tVb",
  "status": "paid",
  "amountCents": 12500,
  "amountRefundedCents": 0,
  "netCents": 12088,
  "currency": "usd",
  "description": "Consulting — October",
  "source": {
    "type": "payment_link",
    "id": "pl_4kTz8QwN2xYb6RcD1mPa"
  },
  "paymentLinkId": "pl_4kTz8QwN2xYb6RcD1mPa",
  "customer": {
    "name": "Jordan Lee",
    "email": "jordan@example.com",
    "country": "US"
  },
  "card": {
    "brand": "visa",
    "last4": "4242"
  },
  "paymentMethod": {
    "type": "card",
    "label": "Visa •••• 4242"
  },
  "clientReference": "order_1042",
  "metadata": {
    "campaign": "fall-launch"
  },
  "amountDetails": {
    "subtotalCents": 12500,
    "discountCents": 0,
    "shippingCents": 0,
    "taxCents": 0,
    "customerFeeCents": 0
  },
  "dispute": null,
  "failureMessage": null,
  "createdAt": "2026-10-14T16:02:11.000Z",
  "paidAt": "2026-10-14T16:02:15.000Z"
}
```

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 404 | `NOT_FOUND` | No such object on your business (an id from another business reads the same), or no such endpoint under `/api/v1`, which still answers in JSON. Check the id and the path. Ids are case-sensitive. |

## Related

- [Accept a payment in Next.js](https://anytime-capital.com/docs/nextjs-checkout.md): A payment link per order and a verified webhook, end to end.
- [Reconcile payouts](https://anytime-capital.com/docs/reconcile-payouts.md): A nightly job over payments, refunds and payouts.
- [Webhooks](https://anytime-capital.com/docs/webhooks.md): payment.succeeded, payment.failed, payment.refunded and more.

---

Anytime Capital is a fintech company, not a bank. Payment processing, banking and payout services are provided by Anytime Capital's licensed partners. Rates shown are for US card payments; international cards, currency conversion and disputes may carry additional fees shown in your dashboard before you accept a payment.
