Get past usage for a customer
curl --request GET \
--url https://api-m.sandbox.paypal.com/v1/commerce/billing/customers/{external_customer_id}/past_usage \
--header 'Authorization: Bearer <token>'{
"usage_periods": [
{
"from_datetime": "2023-12-01T00:00:00Z",
"to_datetime": "2023-12-31T23:59:59Z",
"issuing_date": "2023-12-31",
"total_amount": {
"currency_code": "USD",
"value": 250
},
"taxes_amount": {
"currency_code": "USD",
"value": 3.25
},
"charges_usage": [
{
"units": "200.0",
"events_count": 200,
"amount": {
"currency_code": "USD",
"value": 100
},
"charge": {
"id": "1c31a90-1c31-1c31-1c31-1c311c311c31",
"metric_id": "metric_01H3YT8P7Q5R3S1T2U0V4W9X8",
"charge_model": "STANDARD",
"properties": {
"amount": "0.50"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "API Calls",
"code": "api_calls",
"aggregation_type": "COUNT"
}
},
{
"units": "3000.0",
"events_count": 3000,
"amount": {
"currency_code": "USD",
"value": 150
},
"charge": {
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"metric_id": "metric_02H3YT8P7Q5R3S1T2U0V4W9Y9",
"charge_model": "STANDARD",
"properties": {
"amount": "0.05"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "Storage GB-Hours",
"code": "storage_gb_hours",
"aggregation_type": "SUM"
}
}
]
},
{
"from_datetime": "2023-11-01T00:00:00Z",
"to_datetime": "2023-11-30T23:59:59Z",
"issuing_date": "2023-11-30",
"total_amount": {
"currency_code": "USD",
"value": 150
},
"taxes_amount": {
"currency_code": "USD",
"value": 2.1
},
"charges_usage": [
{
"units": "120.0",
"events_count": 120,
"amount": {
"currency_code": "USD",
"value": 60
},
"charge": {
"id": "1e1a90-1e1a-1e1a-1e1a-1e1a1e1a1e1a",
"metric_id": "metric_01H3YT8P7Q5R3S1T2U0V4W9X8",
"charge_model": "STANDARD",
"properties": {
"amount": "0.50"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "API Calls",
"code": "api_calls",
"aggregation_type": "COUNT"
}
},
{
"units": "1800.0",
"events_count": 1800,
"amount": {
"currency_code": "USD",
"value": 90
},
"charge": {
"id": "1r67r67-1r67-1r67-1r67-1r671r671r67",
"metric_id": "metric_02H3YT8P7Q5R3S1T2U0V4W9Y9",
"charge_model": "STANDARD",
"properties": {
"amount": "0.05"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "Storage GB-Hours",
"code": "storage_gb_hours",
"aggregation_type": "SUM"
}
}
]
},
{
"from_datetime": "2023-10-01T00:00:00Z",
"to_datetime": "2023-10-31T23:59:59Z",
"issuing_date": "2023-10-31",
"total_amount": {
"currency_code": "USD",
"value": 107.5
},
"taxes_amount": {
"currency_code": "USD",
"value": 1.85
},
"charges_usage": [
{
"units": "95.0",
"events_count": 95,
"amount": {
"currency_code": "USD",
"value": 47.5
},
"charge": {
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"metric_id": "metric_01H3YT8P7Q5R3S1T2U0V4W9X8",
"charge_model": "STANDARD",
"properties": {
"amount": "0.50"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "API Calls",
"code": "api_calls",
"aggregation_type": "COUNT"
}
},
{
"units": "1200.0",
"events_count": 1200,
"amount": {
"currency_code": "USD",
"value": 60
},
"charge": {
"id": "1a901b42-1b42-1b42-1b42-1a901b421b42",
"metric_id": "metric_02H3YT8P7Q5R3S1T2U0V4W9Y9",
"charge_model": "STANDARD",
"properties": {
"amount": "0.05"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "Storage GB-Hours",
"code": "storage_gb_hours",
"aggregation_type": "SUM"
}
}
]
}
],
"meta": {
"current_page": 1,
"total_count": 12,
"total_pages": 2
}
}{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "565f78f101498",
"details": [
{
"issue": "PERMISSION_DENIED",
"description": "You do not have permission to access or perform operations on this resource."
}
]
}{
"name": "<string>",
"debug_id": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": "<string>",
"location": "<string>",
"issue": "<string>",
"description": "<string>"
}
]
}{
"name": "INTERNAL_SERVER_ERROR",
"message": "An internal server error has occurred.",
"debug_id": "90957fca61718"
}Get past usage for a customer
Retrieves historical usage information for a specific customer across previous billing periods
GET
/
customers
/
{external_customer_id}
/
past_usage
Get past usage for a customer
curl --request GET \
--url https://api-m.sandbox.paypal.com/v1/commerce/billing/customers/{external_customer_id}/past_usage \
--header 'Authorization: Bearer <token>'{
"usage_periods": [
{
"from_datetime": "2023-12-01T00:00:00Z",
"to_datetime": "2023-12-31T23:59:59Z",
"issuing_date": "2023-12-31",
"total_amount": {
"currency_code": "USD",
"value": 250
},
"taxes_amount": {
"currency_code": "USD",
"value": 3.25
},
"charges_usage": [
{
"units": "200.0",
"events_count": 200,
"amount": {
"currency_code": "USD",
"value": 100
},
"charge": {
"id": "1c31a90-1c31-1c31-1c31-1c311c311c31",
"metric_id": "metric_01H3YT8P7Q5R3S1T2U0V4W9X8",
"charge_model": "STANDARD",
"properties": {
"amount": "0.50"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "API Calls",
"code": "api_calls",
"aggregation_type": "COUNT"
}
},
{
"units": "3000.0",
"events_count": 3000,
"amount": {
"currency_code": "USD",
"value": 150
},
"charge": {
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"metric_id": "metric_02H3YT8P7Q5R3S1T2U0V4W9Y9",
"charge_model": "STANDARD",
"properties": {
"amount": "0.05"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "Storage GB-Hours",
"code": "storage_gb_hours",
"aggregation_type": "SUM"
}
}
]
},
{
"from_datetime": "2023-11-01T00:00:00Z",
"to_datetime": "2023-11-30T23:59:59Z",
"issuing_date": "2023-11-30",
"total_amount": {
"currency_code": "USD",
"value": 150
},
"taxes_amount": {
"currency_code": "USD",
"value": 2.1
},
"charges_usage": [
{
"units": "120.0",
"events_count": 120,
"amount": {
"currency_code": "USD",
"value": 60
},
"charge": {
"id": "1e1a90-1e1a-1e1a-1e1a-1e1a1e1a1e1a",
"metric_id": "metric_01H3YT8P7Q5R3S1T2U0V4W9X8",
"charge_model": "STANDARD",
"properties": {
"amount": "0.50"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "API Calls",
"code": "api_calls",
"aggregation_type": "COUNT"
}
},
{
"units": "1800.0",
"events_count": 1800,
"amount": {
"currency_code": "USD",
"value": 90
},
"charge": {
"id": "1r67r67-1r67-1r67-1r67-1r671r671r67",
"metric_id": "metric_02H3YT8P7Q5R3S1T2U0V4W9Y9",
"charge_model": "STANDARD",
"properties": {
"amount": "0.05"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "Storage GB-Hours",
"code": "storage_gb_hours",
"aggregation_type": "SUM"
}
}
]
},
{
"from_datetime": "2023-10-01T00:00:00Z",
"to_datetime": "2023-10-31T23:59:59Z",
"issuing_date": "2023-10-31",
"total_amount": {
"currency_code": "USD",
"value": 107.5
},
"taxes_amount": {
"currency_code": "USD",
"value": 1.85
},
"charges_usage": [
{
"units": "95.0",
"events_count": 95,
"amount": {
"currency_code": "USD",
"value": 47.5
},
"charge": {
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"metric_id": "metric_01H3YT8P7Q5R3S1T2U0V4W9X8",
"charge_model": "STANDARD",
"properties": {
"amount": "0.50"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "API Calls",
"code": "api_calls",
"aggregation_type": "COUNT"
}
},
{
"units": "1200.0",
"events_count": 1200,
"amount": {
"currency_code": "USD",
"value": 60
},
"charge": {
"id": "1a901b42-1b42-1b42-1b42-1a901b421b42",
"metric_id": "metric_02H3YT8P7Q5R3S1T2U0V4W9Y9",
"charge_model": "STANDARD",
"properties": {
"amount": "0.05"
},
"min_amount": {
"value": 0.01,
"currency_code": "USD"
}
},
"metric": {
"name": "Storage GB-Hours",
"code": "storage_gb_hours",
"aggregation_type": "SUM"
}
}
]
}
],
"meta": {
"current_page": 1,
"total_count": 12,
"total_pages": 2
}
}{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "565f78f101498",
"details": [
{
"issue": "PERMISSION_DENIED",
"description": "You do not have permission to access or perform operations on this resource."
}
]
}{
"name": "<string>",
"debug_id": "<string>",
"message": "<string>",
"details": [
{
"field": "<string>",
"value": "<string>",
"location": "<string>",
"issue": "<string>",
"description": "<string>"
}
]
}{
"name": "INTERNAL_SERVER_ERROR",
"message": "An internal server error has occurred.",
"debug_id": "90957fca61718"
}Authorizations
Use the /v1/oauth2/token endpoint to obtain an access token and pass it as a Bearer token in the Authorization header.
Path Parameters
The unique external identifier of the customer
Query Parameters
Page number
Number of records per page
Filter by subscription ID.
Was this page helpful?
⌘I