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.
Use a valid access token and make a GET call to the /v1/commerce/billing/metrics endpoint with optional query parameters.On successful request processing, PayPal returns a paginated list of all configured metrics.
Use a valid access token and make a PUT call to the /v1/commerce/billing/metrics/{metric_code} endpoint 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.
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.
Copy
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" ] } ]}'
For the exhaustive list of request and response parameter descriptions, see API reference.
Use a valid access token and make a DELETE call to the /v1/commerce/billing/metrics/{metric_code} endpoint to permanently delete a metric.Path parameter: metric_code is the code you provided when you created the metric.
Deleting a metric is permanent and affects all pricing plans and subscriptions using this metric. Ensure you remove the metric from all plans before deletion to avoid billing disruptions.