Skip to main content
GET
/
api
/
v1
/
payments
/
stats
Get Payment Statistics
curl --request GET \
  --url https://api.devkit4ai.com/api/v1/payments/stats \
  --header 'Authorization: Bearer <token>'
{
  "total_projects": 123,
  "projects_with_config": 123,
  "projects_with_test": 123,
  "projects_with_live": 123,
  "total_subscriptions": 123,
  "active_subscriptions": 123,
  "total_payments": 123,
  "successful_payments": 123,
  "total_revenue_cents": 123,
  "currency": "usd"
}
Retrieve aggregated payment statistics across all projects owned by the authenticated developer. Includes subscription counts, payment totals, and revenue metrics.

Authentication

This endpoint requires developer authentication via OAuth2 Bearer Token.

Query Parameters

test_mode
boolean
default:"true"
Include test mode data in statistics. Set to false for live mode only.

Response

total_projects
integer
Total number of projects owned by the developer
projects_with_config
integer
Number of projects with Stripe configuration
projects_with_test
integer
Number of projects with test mode credentials
projects_with_live
integer
Number of projects with live mode credentials
total_subscriptions
integer
Total number of subscriptions across all projects
active_subscriptions
integer
Number of currently active subscriptions
total_payments
integer
Total number of payment transactions
successful_payments
integer
Number of successful payments
total_revenue_cents
integer
Total revenue in cents
currency
string
default:"usd"
Currency for revenue (lowercase ISO code)

Example Request

curl "https://api.devkit4ai.com/api/v1/payments/stats?test_mode=true" \
  -H "Authorization: Bearer {developer_jwt}"

Example Response

{
  "total_projects": 3,
  "projects_with_config": 2,
  "projects_with_test": 2,
  "projects_with_live": 1,
  "total_subscriptions": 45,
  "active_subscriptions": 38,
  "total_payments": 127,
  "successful_payments": 120,
  "total_revenue_cents": 359700,
  "currency": "usd"
}

Formatting Revenue

To display revenue as currency:
const revenue = stats.total_revenue_cents / 100;
const formatted = new Intl.NumberFormat('en-US', {
  style: 'currency',
  currency: stats.currency.toUpperCase()
}).format(revenue);

// $3,597.00

Dashboard Metrics

Use these statistics to build a developer dashboard: (((REPLACE_THIS_WITH_IMAGE: cloud-admin-payment-stats-dashboard.png: Developer dashboard showing payment statistics with subscription counts, revenue chart, and project configuration status)))

Key Metrics Explained

MetricDescription
active_subscriptionsSubscriptions with status active or trialing
successful_paymentsPayments with status succeeded
total_revenue_centsSum of all successful payment amounts
When test_mode=true, statistics include both test and live data. Set test_mode=false to see only production metrics.

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Query Parameters

test_mode
boolean
default:true

Include test mode data

Response

Successful Response

Aggregated payment statistics.

total_projects
integer
required
projects_with_config
integer
required
projects_with_test
integer
required
projects_with_live
integer
required
total_subscriptions
integer
required
active_subscriptions
integer
required
total_payments
integer
required
successful_payments
integer
required
total_revenue_cents
integer
required
currency
string
default:usd