PaperTiger.Resources.Topup (PaperTiger v1.0.2)

Copy Markdown View Source

Handles Topup resource endpoints.

Endpoints

  • POST /v1/topups - Create topup
  • GET /v1/topups/:id - Retrieve topup
  • POST /v1/topups/:id - Update topup
  • GET /v1/topups - List topups

Note: Topups cannot be deleted (only canceled).

Topup Object

%{
  id: "tu_...",
  object: "topup",
  created: 1234567890,
  amount: 2000,
  currency: "usd",
  status: "pending" | "succeeded" | "failed" | "canceled" | "reversed",
  description: "Account top-up",
  metadata: %{},
  # ... other fields
}

Summary

Functions

Creates a new topup.

Lists all topups with pagination.

Retrieves a topup by ID.

Updates a topup.

Functions

create(conn)

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

Creates a new topup.

Required Parameters

  • amount - Amount in cents (e.g., 2000 for $20.00)
  • currency - Three-letter ISO currency code (e.g., "usd")
  • description - Topup description

Optional Parameters

  • metadata - Key-value metadata

list(conn)

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

Lists all topups with pagination.

Parameters

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

retrieve(conn, id)

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

Retrieves a topup by ID.

update(conn, id)

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

Updates a topup.

Note: Topups can only have limited fields updated.

Updatable Fields

  • description
  • metadata