AppMage

Invoice

This endpoint group provides invoice-related operations for a subscription context, including listing invoices, retrieving a secure download URL for an invoice PDF, and manually generating an invoice for a target. Only methods present in the source and not marked systemOnly: true are documented here.

Endpoints

POST /api/rpc (Method: InvoiceRpc.getData)

  • Description: Lists invoices for a subscription.

  • Request Body:

    {
      "method": "InvoiceRpc.getData",
      "params": {
        "filter": {},
        "sort": {},
        "page": 1,
        "pageSize": 20
      }
    }
  • Parameters:

    Name Type Required Description
    filter Any No Optional filter object merged into the invoice query.
    sort Any No Optional sort specification. If omitted, the method uses { "issueDate": -1 }.
    page Number Yes Positive integer page number.
    pageSize Number Yes Positive integer number of results per page.
  • Response:

    {
      "success": true,
      "data": {
        "data": [],
        "totalCount": 0
      }
    }

    The response contains a data array with the matching invoice records and a totalCount value for the full result set under the same query.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "InvoiceRpc.getData",
        "params": {
          "filter": {},
          "sort": {},
          "page": 1,
          "pageSize": 20
        }
      }'

POST /api/rpc (Method: InvoiceRpc.getDownloadUrl)

  • Description: Gets a secure download URL for an invoice PDF.

  • Request Body:

    {
      "method": "InvoiceRpc.getDownloadUrl",
      "params": {
        "invoiceId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    invoiceId String Yes The invoice identifier.
  • Response:

    {
      "success": true,
      "data": {
        "url": "string"
      }
    }

    If the invoice has no pdfPath, the method returns { "url": null }. If the invoice is not found or does not belong to the current subscription context, it throws an error.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "InvoiceRpc.getDownloadUrl",
        "params": {
          "invoiceId": "64f1c2a7d9f0d3a1b2c3d4e5"
        }
      }'

POST /api/rpc (Method: InvoiceRpc.generateInvoiceForTarget)

  • Description: Manually generates an invoice for a target's pending charges.

  • Request Body:

    {
      "method": "InvoiceRpc.generateInvoiceForTarget",
      "params": {
        "targetId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    targetId String Yes The target identifier used to locate the subscription billing record and generate the invoice.
  • Response:

    {
      "success": true,
      "data": {}
    }

    The method returns the result of generateInvoiceForPeriod(...) from InvoiceService. The exact response shape is not defined in the inspected source.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "InvoiceRpc.generateInvoiceForTarget",
        "params": {
          "targetId": "target_123"
        }
      }'

Notes

The getData and getDownloadUrl methods both rely on the current request context containing subscriptionId. The source throws an error when that subscription context is missing for invoice listing, and it enforces subscription ownership when resolving a download URL. The source does not expose transport-level authentication details, so no authentication header is documented here.