Skip to main content

Payload Structure

interface WebhookEvent {
  event_id: string;
  type: "checkout.pending"
  data: {
    id: string;
    type: 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 Payload

{
  "event_id": "ev_tDaWu5aTVa2kbvDjGe55rxZpaMEmVFWB",
  "type": "checkout.pending",
  "data": {
    "id": "chk_twijxXgVFofj9mdnvzF7vhbJSZEhfUpC",
    "type": "deposit",
    "charge": {
      "id": "ch_yRZcCGouimTgbz4thtrfbj2mh3ZT6vnz",
      "status": "pending",
      "from_status": "created",
      "amount_cents": 2500,
      "transaction_type": "credit"
    },
    "customer": {
      "id": "cus_vi57KegYgcRqcGHqip8q6UZiqtrwMT870"
    },
    "line_items": [],
    "line_items_total_amount_cents": null
  }
}

Handling Pending Events

When a charge enters a pending state, you should:
  • Update your system to reflect that the transaction is in progress
  • Display appropriate pending status to the customer
  • Wait for subsequent webhook events (success, failure, or expiration)
  • Do not assume the transaction has completed until you receive a final status event
The transaction_type field in the charge object indicates the type of transaction:
  • credit: Represents money being added to the customer’s account
  • debit: Represents money being removed from the customer’s account