AppMage

SubscriptionLineItemRpc

Overview

SubscriptionLineItemRpc exposes RPC methods for reading and updating active line items attached to the current subscription context. The endpoint uses context.subscriptionId to identify the target subscription and delegates data access and updates to BillingService.

Endpoints

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

  • Description: Retrieves the active line items for the subscription identified by context.subscriptionId.

  • Request Body:

    {
      "method": "SubscriptionLineItemRpc.getData",
      "params": {
        "filter": {}
      }
    }
  • Parameters:

    Name Type Required Description
    filter Any No Optional input accepted by the schema. The method does not inspect or apply this value in the shown source.
  • Response:

    {
      "success": true,
      "data": {
        "data": [
          {
            "_id": "feature-key",
            "featureKey": "feature-key"
          }
        ],
        "totalCount": 1
      }
    }

    The data array contains the subscription's active line items, with each returned item augmented with an _id field set to the item's featureKey. The source confirms that totalCount equals the number of active line items returned by BillingService.

  • Example (cURL):

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

    No authentication header is documented in the source. This method requires a request context that includes subscriptionId; otherwise it throws Subscription context (subscriptionId) is required.

POST /api/rpc (Method: SubscriptionLineItemRpc.update)

  • Description: Updates a single active line item for the subscription identified by context.subscriptionId.

  • Request Body:

    {
      "method": "SubscriptionLineItemRpc.update",
      "params": {
        "_id": "feature-key",
        "freeUnits": 0,
        "maxUnits": 0,
        "oneTimeFee": 0,
        "recurringFee": 0,
        "ratesheetId": "ratesheet-id"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Identifies the line item to update. The source comments indicate this value is treated as the line item's featureKey.
    freeUnits Integer No Optional integer update value.
    maxUnits Integer No Optional integer update value. Nullable in the schema.
    oneTimeFee Integer No Optional integer update value. Nullable in the schema.
    recurringFee Integer No Optional integer update value. Nullable in the schema.
    ratesheetId String No Optional string update value. Nullable in the schema.
  • Response:

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

    The source shows that this method returns the result of BillingService.updateSubscriptionLineItem(...). The exact response shape is not defined in the inspected file, so only the delegation is confirmed.

  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "SubscriptionLineItemRpc.update",
        "params": {
          "_id": "feature-key",
          "freeUnits": 10
        }
      }'

    No authentication header is documented in the source. This method requires a request context that includes subscriptionId; otherwise it throws Subscription context (subscriptionId) is required.

Notes

Both methods depend on context.subscriptionId. If it is missing, they throw an error before performing any service call.

The request schema for update requires _id and allows the other fields to be omitted. The schema for getData accepts an optional filter value, but the method does not use it in the inspected source.