API Documentation

Webhooks

Webhooks Overview

Nota
Webhooks are a PRO feature. In the free build the delivery layer is not shipped at all: the /webhooks* routes are not registered and the Webhooks card does not appear on the API screen. The free equivalent is to poll /events, which carries a cursor so you only ever fetch what is new.

Webhooks push signed JSON notifications to a URL you choose, the moment something happens in your affiliate program — no polling required. Set them up under Coupon Affiliates → Admin Tools → API → Webhooks, or through the management API.

Every lifecycle event in the plugin already flows through one funnel, and the webhook dispatcher listens to it. Deliveries are queued (Action Scheduler when WooCommerce provides it, otherwise WP-Cron), so your endpoint never slows down a checkout or an admin action.

Available events

Every event below needs PRO, since webhooks themselves do. These first ones are raised by the core plugin, so they arrive on any PRO install:

EventoFires when
referral.createdA referred order is attributed to an affiliate.
registration.createdA new affiliate registration is submitted.
registration.acceptedA registration is approved.
registration.declinedA registration is declined.
commission.addedCommission is credited to an affiliate.
commission.removedCommission is removed (refund, cancellation, manual deduction).
affiliate.createdAn affiliate's coupon has been created and is ready to use. Fires after approval, and also when an admin creates an affiliate directly.

These further events come from individual PRO add-ons, so they need that add-on to be active as well:

EventoFires whenAdd-on
payout.requestedAn affiliate requests a payout.Pagos
payout.paidA payout is marked as paid.Pagos
payout.reversedA payout is reversed.Pagos
payout.cancelledA payout is cancelled and its amount returned to the unpaid balance.Pagos
affiliate.payout_details_updatedAn affiliate changes their payout method or details.Pagos
reward.earnedAn affiliate earns a reward or bonus.Rewards
campaign.createdAn affiliate creates a campaign.Campañas
directlink.createdAn affiliate registers a direct-link domain.Enlace directo
commission.mla_addedMulti-level commission is credited to an upline.Multi-Level
commission.mla_removedMulti-level commission is removed from an upline.Multi-Level
mla.invite_createdA multi-level affiliate invite is created.Multi-Level
mla.sub_registeredSomeone registers as a sub-affiliate under an existing affiliate.Multi-Level

Subscribe an endpoint to specific events, or to * for everything. The live catalog for su install is always available at GET /wp-json/wcusage/v2/webhooks/events — it lists only events this build can actually raise, so you never subscribe to a notification that could never arrive.

Tip
affiliate.payout_details_updated arriving shortly before payout.requested is a well-known fraud pattern. It is worth watching even if you do nothing else with webhooks.

Endpoint requirements

  • The delivery URL must be HTTPS and publicly reachable. Loopback and private-network addresses are rejected at creation. Local development environments may use HTTP — see the wcusage_api_webhook_require_https filter.
  • Respond with any 2xx status within 8 seconds. Anything else counts as a failed delivery.
  • Do the real work asynchronously. Acknowledge first, process afterwards.
Nota
Webhook events fire from the plugin's activity funnel before the activity-log setting is consulted, so they keep working even on stores that have database logging switched off. They do stop when the API master switch is off.