PaperTiger.Resources.SetupIntent (PaperTiger v0.9.20)

View Source

Handles SetupIntent resource endpoints.

Endpoints

  • POST /v1/setup_intents - Create setup intent
  • GET /v1/setup_intents/:id - Retrieve setup intent
  • POST /v1/setup_intents/:id - Update setup intent
  • GET /v1/setup_intents - List setup intents

Note: Setup intents cannot be deleted (only canceled).

SetupIntent Object

%{
  id: "seti_...",
  object: "setup_intent",
  created: 1234567890,
  customer: "cus_...",
  payment_method: "pm_...",
  status: "requires_payment_method",
  usage: "off_session",
  metadata: %{},
  # ... other fields
}

Summary

Functions

Creates a new setup intent.

Lists all setup intents with pagination.

Retrieves a setup intent by ID.

Updates a setup intent.

Functions

create(conn)

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

Creates a new setup intent.

Required Parameters

None (all optional for SetupIntent creation)

Optional Parameters

  • customer - Customer ID for this setup intent
  • payment_method - Payment method ID (can be updated later)
  • usage - How the payment method will be used ("off_session" or "on_session")
  • metadata - Key-value metadata

list(conn)

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

Lists all setup intents with pagination.

Parameters

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

retrieve(conn, id)

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

Retrieves a setup intent by ID.

update(conn, id)

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

Updates a setup intent.

Updatable Fields

  • customer
  • payment_method
  • metadata