Unit.API.Disputes (Unit v1.0.0)

Copy Markdown View Source

API module for Unit Disputes.

Disputes are filed when a customer wants to contest a card transaction. Unit manages the dispute process with the card network on your behalf.

Dispute flow

  1. Customer identifies an unauthorized or incorrect charge
  2. You create a dispute via the API
  3. Unit investigates with the card network
  4. Status progresses through InvestigationStartedProvisionallyCreditedResolvedWon or ResolvedLost

Important

Disputes are only available for card transactions. For ACH returns, use Unit.API.Payments.return_received_ach/3.

Summary

Functions

Create a dispute for a card transaction.

Get a dispute by ID.

List disputes.

Functions

create(params, opts \\ [])

@spec create(
  map(),
  keyword()
) :: {:ok, Unit.Resource.Dispute.t()} | {:error, term()}

Create a dispute for a card transaction.

Required params

  • :account_id
  • :transaction_id — the disputed card transaction ID
  • :description — reason for the dispute
  • :source"Debit" or "Credit"

Optional

  • :tags

get(id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, Unit.Resource.Dispute.t()} | {:error, term()}

Get a dispute by ID.

list(opts \\ [])

@spec list(keyword()) :: {:ok, [Unit.Resource.Dispute.t()], map()} | {:error, term()}

List disputes.

Filter options

  • :account_id, :customer_id
  • :status
  • :since, :until
  • :page_limit, :page_offset