Packages
Complete Stripe SDK for Elixir with parity to the official Ruby SDK. V1+V2 coverage (193 services, 320 resource structs, 525 documented params). Per-event modules, Finch HTTP/2, RustyJSON, automatic retries, OAuth, webhooks, telemetry, per-client config, streaming pagination.
Current section
Files
Jump to
Current section
Files
lib/stripe/resources/refund.ex
# File generated from our OpenAPI spec
defmodule Stripe.Resources.Refund do
@moduledoc """
Refund
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](https://docs.stripe.com/refunds)
"""
@typedoc """
* `amount` - Amount, in cents (or local equivalent).
* `balance_transaction` - Balance transaction that describes the impact on your account balance. Nullable. Expandable.
* `charge` - ID of the charge that's refunded. Nullable. Expandable.
* `created` - Time at which the object was created. Measured in seconds since the Unix epoch. Format: Unix timestamp.
* `currency` - Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: ISO 4217 currency code.
* `description` - An arbitrary string attached to the object. You can use this for displaying to users (available on non-card refunds only). Max length: 5000.
* `destination_details` - Expandable.
* `failure_balance_transaction` - After the refund fails, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. Expandable.
* `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`, or `unknown`. Max length: 5000.
* `id` - Unique identifier for the object. Max length: 5000.
* `instructions_email` - For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions. Max length: 5000.
* `metadata` - Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Nullable.
* `next_action` - Expandable.
* `object` - String representing the object's type. Objects of the same type share the same value. Possible values: `refund`.
* `payment_intent` - ID of the PaymentIntent that's refunded. Nullable. Expandable.
* `pending_reason` - Provides the reason for why the refund is pending. Possible values are: `processing`, `insufficient_funds`, or `charge_pending`. Possible values: `charge_pending`, `insufficient_funds`, `processing`.
* `presentment_details` - Expandable.
* `reason` - Reason for the refund, which is either user-provided (`duplicate`, `fraudulent`, or `requested_by_customer`) or generated by Stripe internally (`expired_uncaptured_charge`). Possible values: `duplicate`, `expired_uncaptured_charge`, `fraudulent`, `requested_by_customer`. Nullable.
* `receipt_number` - This is the transaction number that appears on email receipts sent for this refund. Max length: 5000. Nullable.
* `source_transfer_reversal` - The transfer reversal that's associated with the refund. Only present if the charge came from another Stripe account. Nullable. Expandable.
* `status` - Status of the refund. This can be `pending`, `requires_action`, `succeeded`, `failed`, or `canceled`. Learn more about [failed refunds](https://docs.stripe.com/refunds#failed-refunds). Max length: 5000. Nullable.
* `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. Nullable. Expandable.
"""
@type t :: %__MODULE__{}
defstruct [
:amount,
:balance_transaction,
:charge,
:created,
:currency,
:description,
:destination_details,
:failure_balance_transaction,
:failure_reason,
:id,
:instructions_email,
:metadata,
:next_action,
:object,
:payment_intent,
:pending_reason,
:presentment_details,
:reason,
:receipt_number,
:source_transfer_reversal,
:status,
:transfer_reversal
]
@object_name "refund"
def object_name, do: @object_name
def expandable_fields,
do: [
"balance_transaction",
"charge",
"destination_details",
"failure_balance_transaction",
"next_action",
"payment_intent",
"presentment_details",
"source_transfer_reversal",
"transfer_reversal"
]
def __nested_fields__ do
%{
"destination_details" => %{
fields: %{
"affirm" => :scalar,
"afterpay_clearpay" => :scalar,
"alipay" => :scalar,
"alma" => :scalar,
"amazon_pay" => :scalar,
"au_bank_transfer" => :scalar,
"blik" => %{
fields: %{
"network_decline_code" => :scalar,
"reference" => :scalar,
"reference_status" => :scalar
}
},
"br_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"card" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar,
"reference_type" => :scalar,
"type" => :scalar
}
},
"cashapp" => :scalar,
"crypto" => %{
fields: %{
"reference" => :scalar
}
},
"customer_cash_balance" => :scalar,
"eps" => :scalar,
"eu_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"gb_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"giropay" => :scalar,
"grabpay" => :scalar,
"jp_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"klarna" => :scalar,
"mb_way" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"multibanco" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"mx_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"nz_bank_transfer" => :scalar,
"p24" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"paynow" => :scalar,
"paypal" => %{
fields: %{
"network_decline_code" => :scalar
}
},
"pix" => :scalar,
"revolut" => :scalar,
"scalapay" => :scalar,
"sofort" => :scalar,
"swish" => %{
fields: %{
"network_decline_code" => :scalar,
"reference" => :scalar,
"reference_status" => :scalar
}
},
"th_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"twint" => :scalar,
"type" => :scalar,
"us_bank_transfer" => %{
fields: %{
"reference" => :scalar,
"reference_status" => :scalar
}
},
"wechat_pay" => :scalar,
"zip" => :scalar
}
},
"next_action" => %{
fields: %{
"display_details" => %{
fields: %{
"email_sent" => %{
fields: %{
"email_sent_at" => :scalar,
"email_sent_to" => :scalar
}
},
"expires_at" => :scalar
}
},
"type" => :scalar
}
},
"presentment_details" => %{
fields: %{
"presentment_amount" => :scalar,
"presentment_currency" => :scalar
}
}
}
end
end