Stripe.Refund (stripity_stripe v2.17.3) View Source

Work with Stripe refund objects.

You can:

Link to this section Summary

Link to this section Types

Specs

t() :: %Stripe.Refund{
  amount: non_neg_integer(),
  balance_transaction: Stripe.id() | Stripe.BalanceTransaction.t() | nil,
  charge: Stripe.id() | Stripe.Charge.t() | nil,
  created: Stripe.timestamp(),
  currency: String.t(),
  failure_balance_transaction:
    Stripe.id() | Stripe.BalanceTransaction.t() | nil,
  failure_reason: String.t() | nil,
  id: Stripe.id(),
  metadata: Stripe.Types.metadata(),
  object: String.t(),
  payment_intent: Stripe.id() | Stripe.PaymentIntent.t() | nil,
  reason: String.t() | nil,
  receipt_number: String.t() | nil,
  source_transfer_reversal: Stripe.id() | Stripe.TransferReversal.t() | nil,
  status: String.t() | nil,
  transfer_reversal: Stripe.id() | Stripe.TransferReversal.t() | nil
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:charge) => Stripe.Charge.t() | Stripe.id(),
         optional(:payment_intent) => Stripe.PaymentIntent.t() | Stripe.id(),
         optional(:amount) => pos_integer(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:reason) => String.t(),
         optional(:refund_application_fee) => boolean(),
         optional(:reverse_transfer) => boolean()
       }
       | %{}

Create a refund.

When you create a new refund, you must specify a charge to create it on.

Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.

You can optionally refund only part of a charge. You can do so as many times as you wish until the entire charge has been refunded.

Once entirely refunded, a charge can't be refunded again. This method will return an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.

See the Stripe docs.

Link to this function

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

View Source

Specs

list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:charge) => Stripe.id() | Stripe.Charge.t(),
         optional(:ending_before) => t() | Stripe.id(),
         optional(:limit) => 1..100,
         optional(:starting_after) => t() | Stripe.id()
       }
       | %{}

List all refunds.

Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, with the most recent refunds appearing first. For convenience, the 10 most recent refunds are always available by default on the charge object.

See the Stripe docs.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a refund.

Retrieves the details of an existing refund.

See the Stripe docs.

Link to this function

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

View Source

Specs

update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{optional(:metadata) => Stripe.Types.metadata()} | %{}

Update a refund.

Updates the specified refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

This request only accepts :metadata as an argument.

See the Stripe docs.