Skip to main content
Metric management helps you monitor, update, and delete existing metrics. You can retrieve metric configurations and modify metric settings to track different usage patterns and adjust billing calculations as your business requirements change.

List metrics

Use a valid access token and send a GET request to /v1/commerce/billing/metrics with optional query parameters. On successful request processing, PayPal returns a paginated list of all configured metrics.
curl -X GET 'https://api-m.sandbox.paypal.com/v1/commerce/billing/metrics?page=1&per_page=10' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS-TOKEN>'

Query parameters

Parameter nameDescription
page
integer
Page number for pagination. Default is 1.
per_page
integer
Number of items per page. Default is 10, maximum is 100.
Note: For the exhaustive list of response parameters, see API reference.

Update metric details

Use a valid access token and send a PUT request to /v1/commerce/billing/metrics/{metric_code} with the modified request parameters such as name, description, aggregation type, aggregation field, and field filters. Path parameter: metric_code is the code you provided when you created the metric.
Note: You cannot modify the metric code or type after creation. You can only update the name, description, aggregation type, aggregation field, and field filters.
On successful request processing, PayPal returns the updated metric information.
curl -X PUT 'https://api-m.sandbox.paypal.com/v1/commerce/billing/metrics/api_requests' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS-TOKEN>' \
-d '{
  "name": "Updated API Requests",
  "description": "Measures the total number of API requests made across all regions",
  "aggregation_type": "COUNT",
  "field_filters": [
    {
      "key": "region",
      "values": [
        "us-east-1",
        "us-west-1",
        "eu-west-1",
        "ap-southeast-1"
      ]
    }
  ]
}'
Note: For the exhaustive list of request and response parameter descriptions, see API reference.

Delete metric

Use a valid access token and send a DELETE request to /v1/commerce/billing/metrics/{metric_code} to permanently delete a metric. Path parameter: metric_code is the code you provided when you created the metric.
Important: Deleting a metric is permanent and will affect all pricing plans and subscriptions using this metric. Ensure you remove the metric from all plans before deletion to avoid billing disruptions.
curl -X DELETE 'https://api-m.sandbox.paypal.com/v1/commerce/billing/metrics/api_requests' \
-H 'Authorization: Bearer <ACCESS-TOKEN>'
I