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
}
}Retrieves historical usage information for a specific customer across previous billing periods
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
}
}Use the /v1/oauth2/token endpoint to obtain an access token and pass it as a Bearer token in the Authorization header.
The unique external identifier of the customer
Page number
Number of records per page
Filter by subscription ID.
Was this page helpful?