View Source Stripe.Refund (Striped v0.5.0) (generated)

Refund objects allow you to 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.

Related guide: Refunds.

Link to this section Summary

Types

t()

The refund type.

Functions

Cancels a refund with a status of requires_action.

Expire a refund with a status of requires_action.

You can see a list of the refunds belonging to a specific charge. Note that the 10 most recent refunds are always available by default on the charge object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.

Retrieves the details of an existing refund.

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

Link to this section Types

@type t() :: %Stripe.Refund{
  amount: integer(),
  balance_transaction: (binary() | Stripe.BalanceTransaction.t()) | nil,
  charge: (binary() | Stripe.Charge.t()) | nil,
  created: integer(),
  currency: binary(),
  description: binary(),
  failure_balance_transaction: binary() | Stripe.BalanceTransaction.t(),
  failure_reason: binary(),
  id: binary(),
  instructions_email: binary(),
  metadata: term() | nil,
  next_action: term(),
  object: binary(),
  payment_intent: (binary() | Stripe.PaymentIntent.t()) | nil,
  reason: binary() | nil,
  receipt_number: binary() | nil,
  source_transfer_reversal: (binary() | Stripe.TransferReversal.t()) | nil,
  status: binary() | nil,
  transfer_reversal: (binary() | Stripe.TransferReversal.t()) | nil
}

The refund type.

  • amount Amount, in %s.
  • balance_transaction Balance transaction that describes the impact on your account balance.
  • charge ID of the charge that was refunded.
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
  • description An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only)
  • failure_balance_transaction If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction.
  • failure_reason If the refund failed, the reason for refund failure if known. Possible values are lost_or_stolen_card, expired_or_canceled_card, or unknown.
  • id Unique identifier for the object.
  • instructions_email Email to which refund instructions, if required, are sent to.
  • metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  • next_action
  • object String representing the object's type. Objects of the same type share the same value.
  • payment_intent ID of the PaymentIntent that was refunded.
  • reason Reason for the refund, either user-provided (duplicate, fraudulent, or requested_by_customer) or generated by Stripe internally (expired_uncaptured_charge).
  • receipt_number This is the transaction number that appears on email receipts sent for this refund.
  • source_transfer_reversal The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details.
  • status Status of the refund. For credit card refunds, this can be pending, succeeded, or failed. For other types of refunds, it can be pending, requires_action, succeeded, failed, or canceled. Refer to our refunds documentation for more details.
  • transfer_reversal If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter.

Link to this section Functions

Link to this function

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

View Source
@spec cancel(
  client :: Stripe.t(),
  refund :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Cancels a refund with a status of requires_action.

Refunds in other states cannot be canceled, and only refunds for payment methods that require customer action will enter the requires_action state.

Details

  • Method: post
  • Path: /v1/refunds/{refund}/cancel
Link to this function

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

View Source
@spec create(
  client :: Stripe.t(),
  params :: %{
    optional(:amount) => integer(),
    optional(:charge) => binary(),
    optional(:currency) => binary(),
    optional(:customer) => binary(),
    optional(:expand) => [binary()],
    optional(:instructions_email) => binary(),
    optional(:metadata) => %{optional(binary()) => binary()} | binary(),
    optional(:origin) => :customer_balance,
    optional(:payment_intent) => binary(),
    optional(:reason) => :duplicate | :fraudulent | :requested_by_customer,
    optional(:refund_application_fee) => boolean(),
    optional(:reverse_transfer) => boolean()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Create a refund.

Details

  • Method: post
  • Path: /v1/refunds
Link to this function

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

View Source
@spec expire(
  client :: Stripe.t(),
  refund :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Expire a refund with a status of requires_action.

Details

  • Method: post
  • Path: /v1/test_helpers/refunds/{refund}/expire
Link to this function

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

View Source
@spec list(
  client :: Stripe.t(),
  charge :: binary(),
  params :: %{
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

You can see a list of the refunds belonging to a specific charge. Note that the 10 most recent refunds are always available by default on the charge object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.

Details

  • Method: get
  • Path: /v1/charges/{charge}/refunds
Link to this function

retrieve(client, charge, refund, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  client :: Stripe.t(),
  charge :: binary(),
  refund :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the details of an existing refund.

Details

  • Method: get
  • Path: /v1/charges/{charge}/refunds/{refund}
Link to this function

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

View Source
@spec update(
  client :: Stripe.t(),
  refund :: binary(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()} | binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

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.

Details

  • Method: post
  • Path: /v1/refunds/{refund}