PaperTiger.Resources.Webhook (PaperTiger v1.0.2)

Copy Markdown View Source

Handles Webhook Endpoint resource endpoints.

Endpoints

  • POST /v1/webhook_endpoints - Create webhook endpoint
  • GET /v1/webhook_endpoints/:id - Retrieve webhook endpoint
  • POST /v1/webhook_endpoints/:id - Update webhook endpoint
  • DELETE /v1/webhook_endpoints/:id - Delete webhook endpoint
  • GET /v1/webhook_endpoints - List webhook endpoints

Webhook Endpoint Object

%{
  id: "we_...",
  object: "webhook_endpoint",
  created: 1234567890,
  url: "https://example.com/webhook",
  secret: "whsec_...",
  enabled_events: ["charge.succeeded", "customer.created"],
  status: "enabled",
  metadata: %{},
  # ... other fields
}

Summary

Functions

Creates a new webhook endpoint.

Deletes a webhook endpoint.

Lists all webhook endpoints with pagination.

Retrieves a webhook endpoint by ID.

Updates a webhook endpoint.

Functions

create(conn)

@spec create(Plug.Conn.t()) :: Plug.Conn.t()

Creates a new webhook endpoint.

Required Parameters

  • url - Webhook endpoint URL
  • enabled_events - Array of event types to subscribe to

Optional Parameters

  • metadata - Key-value metadata
  • status - Initial status (default: "enabled")

delete(conn, id)

@spec delete(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Deletes a webhook endpoint.

Returns a deletion confirmation object.

list(conn)

@spec list(Plug.Conn.t()) :: Plug.Conn.t()

Lists all webhook endpoints with pagination.

Parameters

  • limit - Number of items (default: 10, max: 100)
  • starting_after - Cursor for pagination
  • ending_before - Reverse cursor

retrieve(conn, id)

@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Retrieves a webhook endpoint by ID.

update(conn, id)

@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Updates a webhook endpoint.

Updatable Fields

  • url
  • enabled_events
  • metadata
  • status