{
  "openapi": "3.1.0",
  "info": {
    "title": "Acme Billing API",
    "version": "2026-10-01",
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    },
    "description": "The Acme Billing API gives you read access to the customers, invoices, and payments of your Acme Billing account.\nUse it to see which invoices are unpaid, check why a payment failed, and void an invoice that you no longer want to collect.\nAmounts are integers in the smallest currency unit (cents for USD), and every amount comes with a `currency` field.\nDates and timestamps use ISO 8601, and every object has an `object` field that names its type.\n\n**Sandbox note:** this is a sample project with mock data.\nThe sandbox server accepts any value in the `X-API-Key` header, but the header must be present.\nIt returns a fixed data set, a snapshot taken on 2026-10-27, and it does not apply filters, pagination, or the IDs in the path.\n"
  },
  "servers": [
    {
      "url": "https://acme-billing.redocly.app/_mock/apis/billing",
      "description": "Sandbox (mock data)"
    }
  ],
  "security": [
    {
      "ApiKey": []
    },
    {}
  ],
  "tags": [
    {
      "name": "Customers",
      "description": "The companies that you bill."
    },
    {
      "name": "Invoices",
      "description": "Invoices, their status, and the payment attempts for each invoice."
    },
    {
      "name": "Payments",
      "description": "Payments that Acme captured for an invoice."
    }
  ],
  "paths": {
    "/customers": {
      "get": {
        "tags": [
          "Customers"
        ],
        "operationId": "listCustomers",
        "summary": "List customers",
        "description": "Returns your customers, sorted by name.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customers.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerList"
                },
                "examples": {
                  "customers": {
                    "summary": "All six customers",
                    "value": {
                      "object": "list",
                      "items": [
                        {
                          "object": "customer",
                          "id": "cus_G4r8Yc2Pe",
                          "name": "Globex Corporation",
                          "email": "billing@globex.example",
                          "country": "US",
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "bank_transfer"
                          },
                          "createdAt": "2025-03-04T10:12:00Z"
                        },
                        {
                          "object": "customer",
                          "id": "cus_H5k9Rv3Mx",
                          "name": "Hooli",
                          "email": "accounts-payable@hooli.example",
                          "country": "US",
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "card",
                            "card": {
                              "brand": "visa",
                              "last4": "1881",
                              "expMonth": 8,
                              "expYear": 2028
                            }
                          },
                          "createdAt": "2024-11-18T16:40:00Z"
                        },
                        {
                          "object": "customer",
                          "id": "cus_I2t4Wb9Ns",
                          "name": "Initech",
                          "email": "ap@initech.example",
                          "country": "US",
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "card",
                            "card": {
                              "brand": "mastercard",
                              "last4": "7710",
                              "expMonth": 2,
                              "expYear": 2029
                            }
                          },
                          "createdAt": "2025-06-23T09:05:00Z"
                        },
                        {
                          "object": "customer",
                          "id": "cus_N8w2Lq7Tz",
                          "name": "Northwind Traders",
                          "email": "ap@northwind.example",
                          "country": "US",
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "card",
                            "card": {
                              "brand": "visa",
                              "last4": "0341",
                              "expMonth": 11,
                              "expYear": 2027
                            }
                          },
                          "createdAt": "2025-01-09T14:30:00Z"
                        },
                        {
                          "object": "customer",
                          "id": "cus_U7m1Fh5Gd",
                          "name": "Umbrella Corporation",
                          "email": "finance@umbrella.example",
                          "country": "GB",
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "bank_transfer"
                          },
                          "createdAt": "2025-08-12T11:20:00Z"
                        },
                        {
                          "object": "customer",
                          "id": "cus_V3p6Jd8Kc",
                          "name": "Vandelay Industries",
                          "email": "payables@vandelay.example",
                          "country": "US",
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "bank_transfer"
                          },
                          "createdAt": "2025-05-27T13:45:00Z"
                        }
                      ],
                      "page": {
                        "limit": 25,
                        "hasMore": false,
                        "nextCursor": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/customers/{customerId}": {
      "get": {
        "tags": [
          "Customers"
        ],
        "operationId": "getCustomer",
        "summary": "Get a customer",
        "description": "Returns one customer by its ID.",
        "parameters": [
          {
            "name": "customerId",
            "in": "path",
            "required": true,
            "description": "The ID of the customer, for example `cus_N8w2Lq7Tz`.",
            "schema": {
              "type": "string",
              "pattern": "^cus_[A-Za-z0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                },
                "examples": {
                  "northwind": {
                    "summary": "Customer with open invoices",
                    "value": {
                      "object": "customer",
                      "id": "cus_N8w2Lq7Tz",
                      "name": "Northwind Traders",
                      "email": "ap@northwind.example",
                      "country": "US",
                      "currency": "usd",
                      "paymentMethod": {
                        "type": "card",
                        "card": {
                          "brand": "visa",
                          "last4": "0341",
                          "expMonth": 11,
                          "expYear": 2027
                        }
                      },
                      "createdAt": "2025-01-09T14:30:00Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/invoices": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "operationId": "listInvoices",
        "summary": "List invoices",
        "description": "Returns your invoices, sorted by invoice ID.\nUse the query parameters to filter by status, due date, or customer.\nTo find the invoices that a customer still has to pay, set `status` to `unpaid`.\n",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Return only the invoices with this status.",
            "schema": {
              "$ref": "#/components/schemas/InvoiceStatus"
            }
          },
          {
            "name": "dueBefore",
            "in": "query",
            "required": false,
            "description": "Return only the invoices with a due date before this date (exclusive).",
            "schema": {
              "type": "string",
              "format": "date",
              "examples": [
                "2026-11-01"
              ]
            }
          },
          {
            "name": "dueAfter",
            "in": "query",
            "required": false,
            "description": "Return only the invoices with a due date after this date (exclusive).",
            "schema": {
              "type": "string",
              "format": "date",
              "examples": [
                "2026-10-01"
              ]
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "description": "Return only the invoices of this customer.",
            "schema": {
              "type": "string",
              "pattern": "^cus_[A-Za-z0-9]+$",
              "examples": [
                "cus_N8w2Lq7Tz"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of invoices.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceList"
                },
                "examples": {
                  "invoices": {
                    "summary": "Eight invoices, four of them unpaid",
                    "value": {
                      "object": "list",
                      "items": [
                        {
                          "object": "invoice",
                          "id": "INV-2041",
                          "customerId": "cus_N8w2Lq7Tz",
                          "customerName": "Northwind Traders",
                          "status": "unpaid",
                          "currency": "usd",
                          "total": 320000,
                          "amountPaid": 0,
                          "amountDue": 320000,
                          "issueDate": "2026-09-21",
                          "dueDate": "2026-10-21",
                          "pastDue": true,
                          "collectionMethod": "send_invoice",
                          "nextRetryAt": "2026-10-27T14:05:31Z",
                          "paidAt": null,
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Growth plan, October 2026",
                              "quantity": 1,
                              "unitAmount": 250000,
                              "amount": 250000
                            },
                            {
                              "description": "Additional seats",
                              "quantity": 14,
                              "unitAmount": 5000,
                              "amount": 70000
                            }
                          ],
                          "createdAt": "2026-09-21T08:00:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2042",
                          "customerId": "cus_H5k9Rv3Mx",
                          "customerName": "Hooli",
                          "status": "paid",
                          "currency": "usd",
                          "total": 540000,
                          "amountPaid": 540000,
                          "amountDue": 0,
                          "issueDate": "2026-09-22",
                          "dueDate": "2026-10-22",
                          "pastDue": false,
                          "collectionMethod": "charge_automatically",
                          "nextRetryAt": null,
                          "paidAt": "2026-10-22T06:00:12Z",
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Enterprise plan, October 2026",
                              "quantity": 1,
                              "unitAmount": 450000,
                              "amount": 450000
                            },
                            {
                              "description": "Additional seats",
                              "quantity": 18,
                              "unitAmount": 5000,
                              "amount": 90000
                            }
                          ],
                          "createdAt": "2026-09-22T08:00:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2043",
                          "customerId": "cus_V3p6Jd8Kc",
                          "customerName": "Vandelay Industries",
                          "status": "paid",
                          "currency": "usd",
                          "total": 125000,
                          "amountPaid": 125000,
                          "amountDue": 0,
                          "issueDate": "2026-09-22",
                          "dueDate": "2026-10-22",
                          "pastDue": false,
                          "collectionMethod": "send_invoice",
                          "nextRetryAt": null,
                          "paidAt": "2026-10-19T15:40:02Z",
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Starter plan, October 2026",
                              "quantity": 1,
                              "unitAmount": 80000,
                              "amount": 80000
                            },
                            {
                              "description": "Additional seats",
                              "quantity": 9,
                              "unitAmount": 5000,
                              "amount": 45000
                            }
                          ],
                          "createdAt": "2026-09-22T08:05:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2044",
                          "customerId": "cus_G4r8Yc2Pe",
                          "customerName": "Globex Corporation",
                          "status": "unpaid",
                          "currency": "usd",
                          "total": 195000,
                          "amountPaid": 0,
                          "amountDue": 195000,
                          "issueDate": "2026-09-23",
                          "dueDate": "2026-10-23",
                          "pastDue": true,
                          "collectionMethod": "send_invoice",
                          "nextRetryAt": null,
                          "paidAt": null,
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Team plan, October 2026",
                              "quantity": 1,
                              "unitAmount": 150000,
                              "amount": 150000
                            },
                            {
                              "description": "API overage, per 1,000 calls",
                              "quantity": 450,
                              "unitAmount": 100,
                              "amount": 45000
                            }
                          ],
                          "createdAt": "2026-09-23T08:00:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2045",
                          "customerId": "cus_I2t4Wb9Ns",
                          "customerName": "Initech",
                          "status": "paid",
                          "currency": "usd",
                          "total": 98000,
                          "amountPaid": 98000,
                          "amountDue": 0,
                          "issueDate": "2026-09-25",
                          "dueDate": "2026-10-25",
                          "pastDue": false,
                          "collectionMethod": "send_invoice",
                          "nextRetryAt": null,
                          "paidAt": "2026-10-24T18:22:09Z",
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Onboarding services",
                              "quantity": 1,
                              "unitAmount": 98000,
                              "amount": 98000
                            }
                          ],
                          "createdAt": "2026-09-25T08:00:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2046",
                          "customerId": "cus_H5k9Rv3Mx",
                          "customerName": "Hooli",
                          "status": "open",
                          "currency": "usd",
                          "total": 540000,
                          "amountPaid": 0,
                          "amountDue": 540000,
                          "issueDate": "2026-11-01",
                          "dueDate": "2026-12-01",
                          "pastDue": false,
                          "collectionMethod": "charge_automatically",
                          "nextRetryAt": null,
                          "paidAt": null,
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Enterprise plan, November 2026",
                              "quantity": 1,
                              "unitAmount": 450000,
                              "amount": 450000
                            },
                            {
                              "description": "Additional seats",
                              "quantity": 18,
                              "unitAmount": 5000,
                              "amount": 90000
                            }
                          ],
                          "createdAt": "2026-09-26T08:00:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2047",
                          "customerId": "cus_I2t4Wb9Ns",
                          "customerName": "Initech",
                          "status": "unpaid",
                          "currency": "usd",
                          "total": 247000,
                          "amountPaid": 0,
                          "amountDue": 247000,
                          "issueDate": "2026-09-28",
                          "dueDate": "2026-10-28",
                          "pastDue": false,
                          "collectionMethod": "send_invoice",
                          "nextRetryAt": null,
                          "paidAt": null,
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Team plan, October 2026",
                              "quantity": 1,
                              "unitAmount": 150000,
                              "amount": 150000
                            },
                            {
                              "description": "Additional seats",
                              "quantity": 15,
                              "unitAmount": 5000,
                              "amount": 75000
                            },
                            {
                              "description": "API overage, per 1,000 calls",
                              "quantity": 220,
                              "unitAmount": 100,
                              "amount": 22000
                            }
                          ],
                          "createdAt": "2026-09-28T08:00:00Z"
                        },
                        {
                          "object": "invoice",
                          "id": "INV-2048",
                          "customerId": "cus_U7m1Fh5Gd",
                          "customerName": "Umbrella Corporation",
                          "status": "unpaid",
                          "currency": "usd",
                          "total": 80000,
                          "amountPaid": 0,
                          "amountDue": 80000,
                          "issueDate": "2026-09-30",
                          "dueDate": "2026-10-30",
                          "pastDue": false,
                          "collectionMethod": "send_invoice",
                          "nextRetryAt": null,
                          "paidAt": null,
                          "voidedAt": null,
                          "lineItems": [
                            {
                              "description": "Starter plan, October 2026",
                              "quantity": 1,
                              "unitAmount": 80000,
                              "amount": 80000
                            }
                          ],
                          "createdAt": "2026-09-30T08:00:00Z"
                        }
                      ],
                      "page": {
                        "limit": 25,
                        "hasMore": false,
                        "nextCursor": null
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/invoices/{invoiceId}": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "operationId": "getInvoice",
        "summary": "Get an invoice",
        "description": "Returns one invoice by its ID, with its line items and the date of the next payment retry.",
        "parameters": [
          {
            "$ref": "#/components/parameters/InvoiceId"
          }
        ],
        "responses": {
          "200": {
            "description": "The invoice.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                },
                "examples": {
                  "northwind": {
                    "summary": "Unpaid invoice, past due, card declined",
                    "value": {
                      "object": "invoice",
                      "id": "INV-2041",
                      "customerId": "cus_N8w2Lq7Tz",
                      "customerName": "Northwind Traders",
                      "status": "unpaid",
                      "currency": "usd",
                      "total": 320000,
                      "amountPaid": 0,
                      "amountDue": 320000,
                      "issueDate": "2026-09-21",
                      "dueDate": "2026-10-21",
                      "pastDue": true,
                      "collectionMethod": "send_invoice",
                      "nextRetryAt": "2026-10-27T14:05:31Z",
                      "paidAt": null,
                      "voidedAt": null,
                      "lineItems": [
                        {
                          "description": "Growth plan, October 2026",
                          "quantity": 1,
                          "unitAmount": 250000,
                          "amount": 250000
                        },
                        {
                          "description": "Additional seats",
                          "quantity": 14,
                          "unitAmount": 5000,
                          "amount": 70000
                        }
                      ],
                      "createdAt": "2026-09-21T08:00:00Z"
                    }
                  },
                  "globex": {
                    "summary": "Unpaid invoice, past due, no payment attempt",
                    "value": {
                      "object": "invoice",
                      "id": "INV-2044",
                      "customerId": "cus_G4r8Yc2Pe",
                      "customerName": "Globex Corporation",
                      "status": "unpaid",
                      "currency": "usd",
                      "total": 195000,
                      "amountPaid": 0,
                      "amountDue": 195000,
                      "issueDate": "2026-09-23",
                      "dueDate": "2026-10-23",
                      "pastDue": true,
                      "collectionMethod": "send_invoice",
                      "nextRetryAt": null,
                      "paidAt": null,
                      "voidedAt": null,
                      "lineItems": [
                        {
                          "description": "Team plan, October 2026",
                          "quantity": 1,
                          "unitAmount": 150000,
                          "amount": 150000
                        },
                        {
                          "description": "API overage, per 1,000 calls",
                          "quantity": 450,
                          "unitAmount": 100,
                          "amount": 45000
                        }
                      ],
                      "createdAt": "2026-09-23T08:00:00Z"
                    }
                  },
                  "hooliPaid": {
                    "summary": "Paid invoice, paid by card",
                    "value": {
                      "object": "invoice",
                      "id": "INV-2042",
                      "customerId": "cus_H5k9Rv3Mx",
                      "customerName": "Hooli",
                      "status": "paid",
                      "currency": "usd",
                      "total": 540000,
                      "amountPaid": 540000,
                      "amountDue": 0,
                      "issueDate": "2026-09-22",
                      "dueDate": "2026-10-22",
                      "pastDue": false,
                      "collectionMethod": "charge_automatically",
                      "nextRetryAt": null,
                      "paidAt": "2026-10-22T06:00:12Z",
                      "voidedAt": null,
                      "lineItems": [
                        {
                          "description": "Enterprise plan, October 2026",
                          "quantity": 1,
                          "unitAmount": 450000,
                          "amount": 450000
                        },
                        {
                          "description": "Additional seats",
                          "quantity": 18,
                          "unitAmount": 5000,
                          "amount": 90000
                        }
                      ],
                      "createdAt": "2026-09-22T08:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/invoices/{invoiceId}/void": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "operationId": "voidInvoice",
        "summary": "Void an invoice",
        "description": "Voids an open or unpaid invoice, so that Acme stops collecting it.\nAcme cancels the scheduled payment retries and sets `amountDue` to 0.\nYou cannot void a paid invoice or an invoice that is already void: the API returns `409`.\nThis action is permanent.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/InvoiceId"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoidInvoiceRequest"
              },
              "examples": {
                "duplicate": {
                  "summary": "Void a duplicate invoice",
                  "value": {
                    "reason": "duplicate"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The voided invoice.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invoice"
                },
                "examples": {
                  "voided": {
                    "summary": "Voided invoice",
                    "value": {
                      "object": "invoice",
                      "id": "INV-2048",
                      "customerId": "cus_U7m1Fh5Gd",
                      "customerName": "Umbrella Corporation",
                      "status": "void",
                      "currency": "usd",
                      "total": 80000,
                      "amountPaid": 0,
                      "amountDue": 0,
                      "issueDate": "2026-09-30",
                      "dueDate": "2026-10-30",
                      "pastDue": false,
                      "collectionMethod": "send_invoice",
                      "nextRetryAt": null,
                      "paidAt": null,
                      "voidedAt": "2026-10-27T10:15:00Z",
                      "lineItems": [
                        {
                          "description": "Starter plan, October 2026",
                          "quantity": 1,
                          "unitAmount": 80000,
                          "amount": 80000
                        }
                      ],
                      "createdAt": "2026-09-30T08:00:00Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The invoice is paid or already void, so you cannot void it.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                },
                "examples": {
                  "paid": {
                    "summary": "The invoice is paid",
                    "value": {
                      "type": "https://acme-billing.redocly.app/guides/errors#invoice-not-voidable",
                      "title": "Invoice cannot be voided",
                      "status": 409,
                      "code": "invoice_not_voidable",
                      "detail": "Invoice INV-2042 is paid. Only open and unpaid invoices can be voided.",
                      "instance": "/invoices/INV-2042/void"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/invoices/{invoiceId}/payment-attempts": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "operationId": "listInvoicePaymentAttempts",
        "summary": "List payment attempts for an invoice",
        "description": "Returns every attempt to collect payment for an invoice, newest first, with the reason for each failure.\nWhen a card payment fails, Acme retries it 1, 3, and 7 days after the first failed attempt.\n`nextRetryAt` on a failed attempt is the date of the next scheduled retry.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/InvoiceId"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of payment attempts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentAttemptList"
                },
                "examples": {
                  "northwindCardDeclined": {
                    "summary": "One declined card payment",
                    "value": {
                      "object": "list",
                      "items": [
                        {
                          "object": "payment_attempt",
                          "id": "att_9Fq2Zr5Lk",
                          "invoiceId": "INV-2041",
                          "customerId": "cus_N8w2Lq7Tz",
                          "attemptNumber": 1,
                          "trigger": "customer",
                          "status": "failed",
                          "amount": 320000,
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "card",
                            "card": {
                              "brand": "visa",
                              "last4": "0341",
                              "expMonth": 11,
                              "expYear": 2027
                            }
                          },
                          "failureReason": "card_declined",
                          "failureMessage": "The card issuer declined the payment.",
                          "attemptedAt": "2026-10-26T14:05:31Z",
                          "nextRetryAt": "2026-10-27T14:05:31Z",
                          "retriesRemaining": 3
                        }
                      ],
                      "page": {
                        "limit": 25,
                        "hasMore": false,
                        "nextCursor": null
                      }
                    }
                  },
                  "noAttempts": {
                    "summary": "An invoice with no payment attempts",
                    "value": {
                      "object": "list",
                      "items": [],
                      "page": {
                        "limit": 25,
                        "hasMore": false,
                        "nextCursor": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/payments": {
      "get": {
        "tags": [
          "Payments"
        ],
        "operationId": "listPayments",
        "summary": "List payments",
        "description": "Returns the payments that Acme captured, newest first. A failed attempt is not a payment, so see the payment attempts of the invoice for failures.",
        "parameters": [
          {
            "name": "invoiceId",
            "in": "query",
            "required": false,
            "description": "Return only the payments for this invoice.",
            "schema": {
              "type": "string",
              "pattern": "^INV-[0-9]+$",
              "examples": [
                "INV-2042"
              ]
            }
          },
          {
            "name": "customerId",
            "in": "query",
            "required": false,
            "description": "Return only the payments of this customer.",
            "schema": {
              "type": "string",
              "pattern": "^cus_[A-Za-z0-9]+$",
              "examples": [
                "cus_H5k9Rv3Mx"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of payments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentList"
                },
                "examples": {
                  "payments": {
                    "summary": "Three captured payments",
                    "value": {
                      "object": "list",
                      "items": [
                        {
                          "object": "payment",
                          "id": "pay_5Tc8Mn6Ja",
                          "invoiceId": "INV-2045",
                          "customerId": "cus_I2t4Wb9Ns",
                          "status": "succeeded",
                          "amount": 98000,
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "card",
                            "card": {
                              "brand": "mastercard",
                              "last4": "7710",
                              "expMonth": 2,
                              "expYear": 2029
                            }
                          },
                          "capturedAt": "2026-10-24T18:22:09Z"
                        },
                        {
                          "object": "payment",
                          "id": "pay_3Lx9Qe2Vn",
                          "invoiceId": "INV-2042",
                          "customerId": "cus_H5k9Rv3Mx",
                          "status": "succeeded",
                          "amount": 540000,
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "card",
                            "card": {
                              "brand": "visa",
                              "last4": "1881",
                              "expMonth": 8,
                              "expYear": 2028
                            }
                          },
                          "capturedAt": "2026-10-22T06:00:12Z"
                        },
                        {
                          "object": "payment",
                          "id": "pay_7Bd4Ks1Hw",
                          "invoiceId": "INV-2043",
                          "customerId": "cus_V3p6Jd8Kc",
                          "status": "succeeded",
                          "amount": 125000,
                          "currency": "usd",
                          "paymentMethod": {
                            "type": "bank_transfer"
                          },
                          "capturedAt": "2026-10-19T15:40:02Z"
                        }
                      ],
                      "page": {
                        "limit": 25,
                        "hasMore": false,
                        "nextCursor": null
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/payments/{paymentId}": {
      "get": {
        "tags": [
          "Payments"
        ],
        "operationId": "getPayment",
        "summary": "Get a payment",
        "description": "Returns one captured payment by its ID.",
        "parameters": [
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "description": "The ID of the payment, for example `pay_3Lx9Qe2Vn`.",
            "schema": {
              "type": "string",
              "pattern": "^pay_[A-Za-z0-9]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                },
                "examples": {
                  "hooli": {
                    "summary": "Card payment for a paid invoice",
                    "value": {
                      "object": "payment",
                      "id": "pay_3Lx9Qe2Vn",
                      "invoiceId": "INV-2042",
                      "customerId": "cus_H5k9Rv3Mx",
                      "status": "succeeded",
                      "amount": 540000,
                      "currency": "usd",
                      "paymentMethod": {
                        "type": "card",
                        "card": {
                          "brand": "visa",
                          "last4": "1881",
                          "expMonth": 8,
                          "expYear": 2028
                        }
                      },
                      "capturedAt": "2026-10-22T06:00:12Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Your secret API key. Create one in the Acme Billing dashboard, under **Settings > API keys**.\nThe sandbox accepts any non-empty value.\n"
      }
    },
    "parameters": {
      "InvoiceId": {
        "name": "invoiceId",
        "in": "path",
        "required": true,
        "description": "The ID of the invoice, for example `INV-2041`.",
        "schema": {
          "type": "string",
          "pattern": "^INV-[0-9]+$"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "The maximum number of items to return.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        }
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "required": false,
        "description": "The `page.nextCursor` value from the previous response. Omit it to get the first page.",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "A query parameter is not valid.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "invalidStatus": {
                "summary": "Unknown status value",
                "value": {
                  "type": "https://acme-billing.redocly.app/guides/errors#invalid-parameter",
                  "title": "Invalid parameter",
                  "status": 400,
                  "code": "invalid_parameter",
                  "detail": "status must be one of: draft, open, unpaid, paid, void.",
                  "instance": "/invoices"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The `X-API-Key` header is missing or the key is not valid.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "missingKey": {
                "summary": "Missing API key",
                "value": {
                  "type": "https://acme-billing.redocly.app/guides/errors#unauthorized",
                  "title": "Unauthorized",
                  "status": 401,
                  "code": "unauthorized",
                  "detail": "Send your API key in the X-API-Key header.",
                  "instance": "/invoices"
                }
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "No object with this ID exists in your account.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "invoiceNotFound": {
                "summary": "Unknown invoice",
                "value": {
                  "type": "https://acme-billing.redocly.app/guides/errors#not-found",
                  "title": "Not found",
                  "status": 404,
                  "code": "not_found",
                  "detail": "Invoice INV-9999 does not exist.",
                  "instance": "/invoices/INV-9999"
                }
              }
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "You sent more than 100 requests in one minute with this API key.",
        "headers": {
          "Retry-After": {
            "description": "The number of seconds to wait before you send the next request.",
            "schema": {
              "type": "integer",
              "examples": [
                12
              ]
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            },
            "examples": {
              "rateLimited": {
                "summary": "Rate limit exceeded",
                "value": {
                  "type": "https://acme-billing.redocly.app/guides/errors#rate-limited",
                  "title": "Too many requests",
                  "status": 429,
                  "code": "rate_limited",
                  "detail": "You sent more than 100 requests in one minute. Retry after 12 seconds.",
                  "instance": "/invoices"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Currency": {
        "type": "string",
        "description": "The three-letter ISO 4217 currency code, in lowercase.",
        "pattern": "^[a-z]{3}$",
        "examples": [
          "usd"
        ]
      },
      "InvoiceStatus": {
        "type": "string",
        "description": "The status of the invoice. See the invoice lifecycle guide.",
        "enum": [
          "draft",
          "open",
          "unpaid",
          "paid",
          "void"
        ]
      },
      "Card": {
        "type": "object",
        "description": "The details of a payment card. Acme never returns the full card number.",
        "required": [
          "brand",
          "last4",
          "expMonth",
          "expYear"
        ],
        "properties": {
          "brand": {
            "type": "string",
            "enum": [
              "visa",
              "mastercard",
              "amex"
            ]
          },
          "last4": {
            "type": "string",
            "description": "The last four digits of the card number.",
            "pattern": "^[0-9]{4}$"
          },
          "expMonth": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "expYear": {
            "type": "integer"
          }
        }
      },
      "PaymentMethod": {
        "type": "object",
        "description": "How the customer pays. `card` is present only when `type` is `card`.",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "card",
              "bank_transfer"
            ]
          },
          "card": {
            "$ref": "#/components/schemas/Card"
          }
        }
      },
      "Page": {
        "type": "object",
        "description": "Pagination details for a list.",
        "required": [
          "limit",
          "hasMore",
          "nextCursor"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "description": "The `limit` used for this page."
          },
          "hasMore": {
            "type": "boolean",
            "description": "`true` when there are more items after this page."
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass this value as `cursor` to get the next page. `null` on the last page."
          }
        }
      },
      "Customer": {
        "type": "object",
        "required": [
          "object",
          "id",
          "name",
          "email",
          "country",
          "currency",
          "paymentMethod",
          "createdAt"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "customer"
          },
          "id": {
            "type": "string",
            "description": "The unique ID of the customer.",
            "pattern": "^cus_[A-Za-z0-9]+$"
          },
          "name": {
            "type": "string",
            "description": "The legal name of the company."
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "The address that receives invoices and payment receipts."
          },
          "country": {
            "type": "string",
            "description": "The two-letter ISO 3166-1 country code of the billing address.",
            "pattern": "^[A-Z]{2}$"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "paymentMethod": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CustomerList": {
        "type": "object",
        "required": [
          "object",
          "items",
          "page"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Customer"
            }
          },
          "page": {
            "$ref": "#/components/schemas/Page"
          }
        }
      },
      "LineItem": {
        "type": "object",
        "required": [
          "description",
          "quantity",
          "unitAmount",
          "amount"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 1
          },
          "unitAmount": {
            "type": "integer",
            "description": "The price of one unit, in the smallest currency unit."
          },
          "amount": {
            "type": "integer",
            "description": "`quantity` times `unitAmount`, in the smallest currency unit."
          }
        }
      },
      "Invoice": {
        "type": "object",
        "required": [
          "object",
          "id",
          "customerId",
          "customerName",
          "status",
          "currency",
          "total",
          "amountPaid",
          "amountDue",
          "issueDate",
          "dueDate",
          "pastDue",
          "collectionMethod",
          "nextRetryAt",
          "paidAt",
          "voidedAt",
          "lineItems",
          "createdAt"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "invoice"
          },
          "id": {
            "type": "string",
            "description": "The invoice number, which is also its unique ID.",
            "pattern": "^INV-[0-9]+$"
          },
          "customerId": {
            "type": "string",
            "description": "The ID of the customer that the invoice bills.",
            "pattern": "^cus_[A-Za-z0-9]+$"
          },
          "customerName": {
            "type": "string",
            "description": "The name of the customer, copied from the customer when the invoice was finalized."
          },
          "status": {
            "$ref": "#/components/schemas/InvoiceStatus"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "total": {
            "type": "integer",
            "description": "The sum of the line items, in the smallest currency unit."
          },
          "amountPaid": {
            "type": "integer",
            "description": "The amount captured so far, in the smallest currency unit."
          },
          "amountDue": {
            "type": "integer",
            "description": "`total` minus `amountPaid`. `0` for a paid or void invoice."
          },
          "issueDate": {
            "type": "string",
            "format": "date",
            "description": "The date Acme sends, or sent, the invoice to the customer."
          },
          "dueDate": {
            "type": "string",
            "format": "date",
            "description": "The date by which the customer must pay."
          },
          "pastDue": {
            "type": "boolean",
            "description": "`true` when the invoice is unpaid and its due date has passed."
          },
          "collectionMethod": {
            "type": "string",
            "description": "How Acme collects the invoice.\n`charge_automatically` charges the payment method on file on the due date.\n`send_invoice` emails the invoice, and the customer pays by card or bank transfer.\n",
            "enum": [
              "charge_automatically",
              "send_invoice"
            ]
          },
          "nextRetryAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When Acme retries the failed card payment next. `null` when no retry is scheduled."
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When Acme captured the payment that paid the invoice in full."
          },
          "voidedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the invoice was voided."
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice was created."
          }
        }
      },
      "InvoiceList": {
        "type": "object",
        "required": [
          "object",
          "items",
          "page"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invoice"
            }
          },
          "page": {
            "$ref": "#/components/schemas/Page"
          }
        }
      },
      "VoidInvoiceRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Why you void the invoice. Acme shows the reason in the dashboard.",
            "enum": [
              "duplicate",
              "uncollectible",
              "created_by_mistake",
              "other"
            ]
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "object",
          "id",
          "invoiceId",
          "customerId",
          "status",
          "amount",
          "currency",
          "paymentMethod",
          "capturedAt"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "payment"
          },
          "id": {
            "type": "string",
            "description": "The unique ID of the payment.",
            "pattern": "^pay_[A-Za-z0-9]+$"
          },
          "invoiceId": {
            "type": "string",
            "description": "The ID of the invoice that the payment paid.",
            "pattern": "^INV-[0-9]+$"
          },
          "customerId": {
            "type": "string",
            "pattern": "^cus_[A-Za-z0-9]+$"
          },
          "status": {
            "type": "string",
            "description": "`refunded` when Acme returned the payment to the customer.",
            "enum": [
              "succeeded",
              "refunded"
            ]
          },
          "amount": {
            "type": "integer",
            "description": "The captured amount, in the smallest currency unit."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "paymentMethod": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "capturedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PaymentList": {
        "type": "object",
        "required": [
          "object",
          "items",
          "page"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            }
          },
          "page": {
            "$ref": "#/components/schemas/Page"
          }
        }
      },
      "PaymentAttempt": {
        "type": "object",
        "required": [
          "object",
          "id",
          "invoiceId",
          "customerId",
          "attemptNumber",
          "trigger",
          "status",
          "amount",
          "currency",
          "paymentMethod",
          "failureReason",
          "failureMessage",
          "attemptedAt",
          "nextRetryAt",
          "retriesRemaining"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "payment_attempt"
          },
          "id": {
            "type": "string",
            "pattern": "^att_[A-Za-z0-9]+$"
          },
          "invoiceId": {
            "type": "string",
            "pattern": "^INV-[0-9]+$"
          },
          "customerId": {
            "type": "string",
            "pattern": "^cus_[A-Za-z0-9]+$"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 1,
            "description": "`1` for the first attempt, then one more for each retry."
          },
          "trigger": {
            "type": "string",
            "description": "What started the attempt.\n`customer` is a payment from the hosted invoice page, `automatic` is a charge on the due date, and `retry` is a scheduled retry.\n",
            "enum": [
              "customer",
              "automatic",
              "retry"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed"
            ]
          },
          "amount": {
            "type": "integer",
            "description": "The amount that Acme tried to collect, in the smallest currency unit."
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "paymentMethod": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "failureReason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the attempt failed. `null` when it succeeded.",
            "enum": [
              "card_declined",
              "insufficient_funds",
              "expired_card",
              "processing_error",
              null
            ]
          },
          "failureMessage": {
            "type": [
              "string",
              "null"
            ],
            "description": "A message for people that explains the failure."
          },
          "attemptedAt": {
            "type": "string",
            "format": "date-time"
          },
          "nextRetryAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When Acme retries the payment next. `null` when the attempt succeeded or no retries are left."
          },
          "retriesRemaining": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3,
            "description": "How many scheduled retries are left. Acme retries a failed card payment at most 3 times."
          }
        }
      },
      "PaymentAttemptList": {
        "type": "object",
        "required": [
          "object",
          "items",
          "page"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentAttempt"
            }
          },
          "page": {
            "$ref": "#/components/schemas/Page"
          }
        }
      },
      "Problem": {
        "type": "object",
        "description": "An error in the RFC 9457 problem details format.",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "A link to the documentation of this error type."
          },
          "title": {
            "type": "string",
            "description": "A short summary of the error type."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code."
          },
          "code": {
            "type": "string",
            "description": "A stable code for the error, for use in your code.",
            "enum": [
              "invalid_parameter",
              "unauthorized",
              "not_found",
              "invoice_not_voidable",
              "rate_limited"
            ]
          },
          "detail": {
            "type": "string",
            "description": "An explanation of this occurrence of the error."
          },
          "instance": {
            "type": "string",
            "description": "The path of the request that caused the error."
          }
        }
      }
    }
  }
}