Skip to main content
When a PIX payment receives a MED (Special Return Mechanism) or when the case ends, Safefy sends a dispute.* event to your organization’s webhooks that subscribe to it. The type field tells which stage the case is in, and the data object carries a snapshot of the case at that moment.

How to receive them

MED events are delivered through the webhooks registered in the dashboard, not through the payment callbackUrl:
  1. In the Safefy dashboard, open Webhooks and click New webhook.
  2. Enter the URL that will receive the events.
  3. In the Dispute group, select the dispute.* events you want.
  4. Save and store the secret shown on screen. It signs this webhook’s events and is shown only once.

Events

A MED may carry a fee, according to your organization’s terms. The amount charged on the case is in data.medFee.
A case that already arrives with an outcome (for example, a MED opened and lost in the same processor notice) produces both events, in this order: dispute.opened and then the outcome event.

Headers

Validate the signature as described in Webhooks → Signature, using the registered webhook’s secret (not the payment and cashout callback secret).

Payload

Amounts in cents. Dates in UTC (ISO 8601).
dispute.opened
dispute.lost

Fields

holdAmount can be lower than amount when part of the payment had already been refunded to the payer before the MED: Safefy only holds what is still with you.

Categories (data.reason)

Delivery

  • Reply with 2xx to confirm. Without confirmation, Safefy retries: up to 3 attempts, or the number configured on the webhook.
  • Every delivery (with the body sent and the response received) shows up in the dashboard, under Webhooks.

Best practices

  • Idempotency: store the event id and ignore events you already processed. Do not rely on arrival order: data.status is the source of truth for the case.
  • dispute.opened: flag the sale as disputed and hold product or service delivery. Submit your defense and evidence before data.responseDeadline with Submit a response and Add evidence.
  • dispute.won and dispute.cancelled: the sale returns to its normal flow. You keep the amount.
  • dispute.lost: record the return to the payer and, if it makes sense, revoke access to the product.
  • data.reason: use the category to automate internal rules, such as reviewing sales in recurring categories.
  • To see the full case (submitted defense, evidence and timeline), call Get a dispute with data.id.