View Source Stripe.Refund (stripity_stripe v3.2.0)
Refund objects allow you to refund a previously created charge that isn't refunded yet. Funds are refunded to the credit or debit card that's initially charged.
Related guide: Refunds
Summary
Functions
Cancels a refund with a status of requires_action
.
When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.
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 refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged.
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(), destination_details: term(), 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 cents (or local equivalent).balance_transaction
Balance transaction that describes the impact on your account balance.charge
ID of the charge that's 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. You can use this for displaying to users (available on non-card refunds only).destination_details
failure_balance_transaction
After the refund fails, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction.failure_reason
Provides the reason for the refund failure. Possible values are:lost_or_stolen_card
,expired_or_canceled_card
,charge_for_pending_refund_disputed
,insufficient_funds
,declined
,merchant_request
, orunknown
.id
Unique identifier for the object.instructions_email
For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions.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's refunded.reason
Reason for the refund, which is either user-provided (duplicate
,fraudulent
, orrequested_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's associated with the refund. Only present if the charge came from another Stripe account.status
Status of the refund. This can bepending
,requires_action
,succeeded
,failed
, orcanceled
. Learn more about failed refunds.transfer_reversal
This refers to the transfer reversal object if the accompanying transfer reverses. This is only applicable if the charge was created using the destination parameter.
Functions
@spec cancel( 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
.
You can’t cancel refunds in other states. Only refunds for payment methods that require customer action can enter the requires_action
state.
Details
- Method:
post
- Path:
/v1/refunds/{refund}/cancel
@spec create( 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()}
When you create a new refund, you must specify a Charge or a PaymentIntent object on which to create it.
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 multiple times, until the entire charge has been refunded.
Once entirely refunded, a charge can’t be refunded again.This method will raise an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge.
#### Details * Method: `post` * Path: `/v1/refunds`@spec expire( 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
@spec list( 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
@spec retrieve( 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}
@spec update( 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 refund that you specify by setting the values of the passed parameters. Any parameters that you don’t provide remain unchanged.
This request only accepts metadata
as an argument.
Details
- Method:
post
- Path:
/v1/refunds/{refund}