LatticeStripe.Dispute (LatticeStripe v1.7.6)

Copy Markdown View Source

Operations on Stripe Dispute objects.

Disputes are created automatically by Stripe when a cardholder or bank challenges a payment. This module covers the dispute lifecycle after that point: retrieval, listing, metadata updates, safe evidence staging, irreversible evidence submission, and irreversible dispute closure.

There is no create/3 or delete/3 API because disputes are not developer- created resources in Stripe.

Evidence workflow

Stripe API Reference

See the Stripe Disputes API.

Summary

Types

t()

A Stripe Dispute object.

Functions

Closes a Dispute by accepting the loss.

Like close/3 but raises on failure.

Lists Disputes with optional filters.

Like list/3 but raises on failure.

Retrieves a Dispute by ID.

Like retrieve/3 but raises on failure.

Returns a lazy stream of Disputes matching the given filters.

Submits previously staged evidence to the issuing bank.

Updates a Dispute by ID.

Stages dispute evidence without submitting it to the issuing bank.

Types

t()

@type t() :: %LatticeStripe.Dispute{
  amount: integer() | nil,
  balance_transactions: [LatticeStripe.BalanceTransaction.t()] | nil,
  charge: LatticeStripe.Charge.t() | String.t() | nil,
  created: integer() | nil,
  currency: String.t() | nil,
  enhanced_eligibility_types: [String.t()] | nil,
  evidence: LatticeStripe.Dispute.Evidence.t() | nil,
  evidence_details: LatticeStripe.Dispute.EvidenceDetails.t() | nil,
  extra: map(),
  id: String.t() | nil,
  is_charge_refundable: boolean() | nil,
  livemode: boolean() | nil,
  metadata: map() | nil,
  object: String.t(),
  payment_intent: LatticeStripe.PaymentIntent.t() | String.t() | nil,
  payment_method_details: LatticeStripe.Dispute.PaymentMethodDetails.t() | nil,
  reason: atom() | String.t() | nil,
  status: atom() | String.t() | nil
}

A Stripe Dispute object.

See the Stripe Dispute object for field definitions.

Functions

close(client, id, opts \\ [])

@spec close(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}

Closes a Dispute by accepting the loss.

Sends POST /v1/disputes/:id/close with an empty body.

Irreversibility

Closing is irreversible. The dispute status changes to lost and the disputed amount plus any dispute fees are permanently deducted from your Stripe balance. This cannot be undone via the API or Stripe Dashboard.

close!(client, id, opts \\ [])

@spec close!(LatticeStripe.Client.t(), String.t(), keyword()) :: t()

Like close/3 but raises on failure.

from_map(map)

@spec from_map(map() | nil) :: t() | nil

list(client, params \\ %{}, opts \\ [])

@spec list(LatticeStripe.Client.t(), map(), keyword()) ::
  {:ok, LatticeStripe.Response.t()} | {:error, LatticeStripe.Error.t()}

Lists Disputes with optional filters.

Sends GET /v1/disputes.

list!(client, params \\ %{}, opts \\ [])

Like list/3 but raises on failure.

retrieve(client, id, opts \\ [])

@spec retrieve(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}

Retrieves a Dispute by ID.

Sends GET /v1/disputes/:id.

retrieve!(client, id, opts \\ [])

@spec retrieve!(LatticeStripe.Client.t(), String.t(), keyword()) :: t()

Like retrieve/3 but raises on failure.

stream!(client, params \\ %{}, opts \\ [])

@spec stream!(LatticeStripe.Client.t(), map(), keyword()) :: Enumerable.t()

Returns a lazy stream of Disputes matching the given filters.

submit_evidence(client, id, opts \\ [])

@spec submit_evidence(LatticeStripe.Client.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}

Submits previously staged evidence to the issuing bank.

Irreversibility

Evidence submission locks the response sent to the issuing bank. Once submitted, you cannot modify the evidence or add new files. The dispute itself remains open, but the bank response is final.

submit_evidence!(client, id, opts \\ [])

@spec submit_evidence!(LatticeStripe.Client.t(), String.t(), keyword()) :: t()

Like submit_evidence/3 but raises on failure.

update(client, id, params, opts \\ [])

@spec update(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}

Updates a Dispute by ID.

This is the general-purpose update entry point for the underlying Stripe API. It accepts any supported dispute update params, including raw evidence and submit combinations for power users.

update!(client, id, params, opts \\ [])

@spec update!(LatticeStripe.Client.t(), String.t(), map(), keyword()) :: t()

Like update/4 but raises on failure.

update_evidence(client, id, evidence, opts \\ [])

@spec update_evidence(LatticeStripe.Client.t(), String.t(), map(), keyword()) ::
  {:ok, t()} | {:error, LatticeStripe.Error.t()}

Stages dispute evidence without submitting it to the issuing bank.

This helper always sends submit: false, so it is impossible to accidentally lock the dispute response while attaching evidence.

update_evidence!(client, id, evidence, opts \\ [])

@spec update_evidence!(LatticeStripe.Client.t(), String.t(), map(), keyword()) :: t()

Like update_evidence/4 but raises on failure.