support@camerce.com

Developers

REST endpoints, webhook events and the filters and actions worth knowing about.

REST API

Namespace profitsync/v1. Every endpoint requires the manage_woocommerce capability.

EndpointReturnsParameters
GET /dashboardKPIs, charts, alerts and notifications.range
GET /ordersOrder rows with pagination and aggregates.search, sort, paged, per_page
GET /productsTop products and product quick stats.range
GET /categoriesProfit distribution by category.range
GET /notificationsInternal notifications.limit

Webhook events

When webhooks are enabled, Profitrics posts signed JSON for snapshot_rebuild_completed, threshold_breach and alert_triggered. Each request carries X-ProfitSync-Event, and X-ProfitSync-Signature when a secret is set.

Filters and actions

HookTypeFires
profitsync_order_profit_calculatedFilterAfter an order's profit is calculated.
profitsync_dashboard_dataFilterBefore the dashboard payload is returned.
profitsync_orders_aggregatesFilterAfter the Orders KPI aggregates are built.
profitsync_orders_pageFilterAfter paginated order rows are prepared.
profitsync_evaluated_alertsFilterAfter the alert engine evaluates rules.
profitsync_webhook_payloadFilterBefore a webhook body is sent.
profitsync_alerts_triggeredActionWhen threshold alerts fire.
profitsync_internal_notification_createdActionWhen an internal notification is created.
profitsync_snapshot_rebuild_completedActionWhen a rebuild finishes.
profitsync_webhook_dispatchedActionAfter a webhook dispatch attempt.
profitsync_export_startedActionWhen an export begins, with its type.
profitsync_export_completedActionWhen an export finishes, with its type and row count.
add_filter( 'profitsync_order_profit_calculated', function ( $profit, $order_id ) {
    // Subtract a per-order cost your store tracks elsewhere.
    return $profit - my_packing_cost( $order_id );
}, 10, 2 );