PaperTiger.Resources.SetupIntent (PaperTiger v1.1.0)

Copy Markdown 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
  • POST /v1/setup_intents/:id/confirm - Confirm setup intent
  • POST /v1/setup_intents/:id/cancel - Cancel setup intent
  • POST /v1/setup_intents/:id/verify_microdeposits - Verify bank microdeposits

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

Cancels a setup intent that has not reached a terminal state.

Confirms a setup intent.

Creates a new setup intent.

Lists all setup intents with pagination.

Retrieves a setup intent by ID.

Updates a setup intent.

Verifies microdeposits for a bank-account setup intent.

Functions

cancel(conn, id)

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

Cancels a setup intent that has not reached a terminal state.

confirm(conn, id)

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

Confirms a setup intent.

Compatible card payment methods transition to succeeded immediately. Bank account methods transition to requires_action until microdeposits are verified.

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

verify_microdeposits(conn, id)

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

Verifies microdeposits for a bank-account setup intent.