Skip to content

Account Stats

Get a summary of the account's transaction activity over a given period.

Required scope: view-account

Parameters

ParameterTypeDescription
fromDatestring optionalStart date of the period, formatted as Y-m-d.
toDatestring optionalEnd date of the period, formatted as Y-m-d.
intervalenum optionalA shortcut interval instead of fromDate/toDate. Accepted values: today, yesterday, thisWeek.

Returns

Returns an object summarizing revenue and transaction counts for the requested period.

Request

Endpoint: https://youcanpay.com/api/v2/account/statsMethod: GET

bash
$ curl --location -g --request GET 'https://youcanpay.com/api/v2/account/stats' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Response

json
{
  "object": "v2.account.stats",
  "interval": "thisWeek",
  "from_date": "2026-07-20 00:00:00",
  "to_date": "2026-07-24 23:59:59",
  "total_revenue": {
    "amount": "1200.00",
    "currency": "MAD",
    "localized": "MAD 1,200.00"
  },
  "paid_transactions_by_dates": [
    {
      "date": "2026-07-20",
      "totalAmount": 0
    }
  ],
  "transactions_by_status": [
    {
      "status": "paid",
      "count": 12
    },
    {
      "status": "failed",
      "count": 2
    }
  ],
  "summary": {
    "total_transactions": 14,
    "acceptance_rate": "85.71"
  }
}

Attributes

ParameterTypeDescription
objectstringAlways v2.account.stats.
intervalstringThe resolved interval for the report.
from_datestringStart of the reported period.
to_datestringEnd of the reported period.
total_revenueobjectTotal revenue over the period, always in MAD, as a money object.
paid_transactions_by_datesarrayPaid transaction totals grouped by date.
transactions_by_statusarrayTransaction counts grouped by status.
summary.total_transactionsintegerTotal number of transactions across all statuses.
summary.acceptance_ratestring|nullPercentage of transactions that were paid. null if there were none.