Skip to main content

Payload Structure

interface WebhookEvent {
  event_id: string;
  type: "checkout.voided";
  data: {
    id: string; // id of the checkout you originally created
    type: "deposit" | "withdrawal";
    charge: {
      id: string;
      status: string;
      from_status: string;
      amount_cents: number;
      transaction_type: "credit" | "debit";
    };
    customer: {
      id: string;
    };
    line_items: Array<{
      product_id: string;
      quantity: number;
    }>;
    line_items_total_amount_cents: number | null;
  }
}

Example Response

{
  "event_id": "ev_tDaWu5aTVa2kbvDjGe55rxZpaMEmVFWB",
  "type": "checkout.voided",
  "data": {
    "id": "chk_u8ThNhNory2ydjKWH5VmwsYpZA54wVGy",
    "type": "deposit",
    "charge": {
      "id": "ch_sybbteMNNfCGZN9SixJ199ZhaUjERzgA",
      "status": "voided",
      "from_status": "succeeded",
      "amount_cents": 2500,
      "transaction_type": "credit"
    },
    "customer": {
      "id": "cus_YPyZUwR9pR3zz3gWzqd69Pb2efRCacN1"
    },
    "line_items": [],
    "line_items_total_amount_cents": null
  }
}

Updating Player’s Balance

This event is triggered when a charge is voided after it had previously succeeded. You need to “undo” the previous action — for deposits you should deduct the balance and for withdrawals you should add back the balance.