Source
Source objects allow you to accept a variety of payment methods. They
represent a customer's payment instrument, and can be used with the Stripe API
just like a Card object: once chargeable, they can be charged, or can be
attached to customers.
Stripe doesn't recommend using the deprecated Sources API. We recommend that you adopt the PaymentMethods API. This newer API provides access to our latest features and payment method types.
Related guides: Sources API and Sources & Customers.
Summary
Types
@type code_verification() :: %{ optional(:attempts_remaining) => integer() | nil, optional(:status) => String.t() | nil, optional(String.t()) => term() }
attempts_remaining- The number of attempts remaining to authenticate the source object with a verification code.status- The status of the code verification, eitherpending(awaiting verification,attempts_remainingshould be greater than 0),succeeded(successful verification) orfailed(failed verification, cannot be verified anymore asattempts_remainingshould be 0). Max length: 5000.
@type owner() :: %{ optional(:address) => Stripe.Resources.Address.t() | nil, optional(:email) => String.t() | nil, optional(:name) => String.t() | nil, optional(:phone) => String.t() | nil, optional(:verified_address) => Stripe.Resources.Address.t() | nil, optional(:verified_email) => String.t() | nil, optional(:verified_name) => String.t() | nil, optional(:verified_phone) => String.t() | nil, optional(String.t()) => term() }
address- Owner's address. Nullable.email- Owner's email address. Max length: 5000. Nullable.name- Owner's full name. Max length: 5000. Nullable.phone- Owner's phone number (including extension). Max length: 5000. Nullable.verified_address- Verified owner's address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. Nullable.verified_email- Verified owner's email address. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. Max length: 5000. Nullable.verified_name- Verified owner's full name. Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. Max length: 5000. Nullable.verified_phone- Verified owner's phone number (including extension). Verified values are verified or provided by the payment method directly (and if supported) at the time of authorization or settlement. They cannot be set or mutated. Max length: 5000. Nullable.
@type receiver() :: %{ optional(:address) => String.t() | nil, optional(:amount_charged) => integer() | nil, optional(:amount_received) => integer() | nil, optional(:amount_returned) => integer() | nil, optional(:refund_attributes_method) => String.t() | nil, optional(:refund_attributes_status) => String.t() | nil, optional(String.t()) => term() }
address- The address of the receiver source. This is the value that should be communicated to the customer to send their funds to. Max length: 5000. Nullable.amount_charged- The total amount that was moved to your balance. This is almost always equal to the amount charged. In rare cases when customers deposit excess funds and we are unable to refund those, those funds get moved to your balance and show up in amount_charged as well. The amount charged is expressed in the source's currency.amount_received- The total amount received by the receiver source.amount_received = amount_returned + amount_chargedshould be true for consumed sources unless customers deposit excess funds. The amount received is expressed in the source's currency.amount_returned- The total amount that was returned to the customer. The amount returned is expressed in the source's currency.refund_attributes_method- Type of refund attribute method, one ofemail,manual, ornone. Max length: 5000.refund_attributes_status- Type of refund attribute status, one ofmissing,requested, oravailable. Max length: 5000.
@type redirect() :: %{ optional(:failure_reason) => String.t() | nil, optional(:return_url) => String.t() | nil, optional(:status) => String.t() | nil, optional(:url) => String.t() | nil, optional(String.t()) => term() }
failure_reason- The failure reason for the redirect, eitheruser_abort(the customer aborted or dropped out of the redirect flow),declined(the authentication failed or the transaction was declined), orprocessing_error(the redirect failed due to a technical error). Present only if the redirect status isfailed. Max length: 5000. Nullable.return_url- The URL you provide to redirect the customer to after they authenticated their payment. Max length: 5000.status- The status of the redirect, eitherpending(ready to be used by your customer to authenticate the transaction),succeeded(successful authentication, cannot be reused) ornot_required(redirect should not be used) orfailed(failed authentication, cannot be reused). Max length: 5000.url- The URL provided to you to redirect a customer to as part of aredirectauthentication flow. Max length: 2048.
@type source_order() :: %{ optional(:amount) => integer() | nil, optional(:currency) => String.t() | nil, optional(:email) => String.t() | nil, optional(:items) => [source_order_items()] | nil, optional(:shipping) => Stripe.Resources.ShippingDetails.t() | nil, optional(String.t()) => term() }
amount- A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order.currency- Three-letter ISO currency code, in lowercase. Must be a supported currency. Format: ISO 4217 currency code.email- The email address of the customer placing the order. Max length: 5000.items- List of items constituting the order. Nullable.shipping
@type source_order_items() :: %{ optional(:amount) => integer() | nil, optional(:currency) => String.t() | nil, optional(:description) => String.t() | nil, optional(:parent) => String.t() | nil, optional(:quantity) => integer() | nil, optional(:type) => String.t() | nil, optional(String.t()) => term() }
amount- The amount (price) for this order item. Nullable.currency- This currency of this order item. Required whenamountis present. Max length: 5000. Nullable.description- Human-readable description for this order item. Max length: 5000. Nullable.parent- The ID of the associated object for this line item. Expandable if not null (e.g., expandable to a SKU). Max length: 5000. Nullable.quantity- The quantity of this order item. When type issku, this is the number of instances of the SKU to be ordered.type- The type of this order item. Must besku,tax, orshipping. Max length: 5000. Nullable.
@type t() :: %Stripe.Resources.Source{ ach_credit_transfer: Stripe.Resources.AchCreditTransfer.t() | nil, ach_debit: Stripe.Resources.AchDebit.t() | nil, acss_debit: Stripe.Resources.AcssDebit.t() | nil, alipay: Stripe.Resources.Alipay.t() | nil, allow_redisplay: String.t(), amount: integer(), au_becs_debit: Stripe.Resources.AuBecsDebit.t() | nil, bancontact: Stripe.Resources.Bancontact.t() | nil, card: Stripe.Resources.Card.t() | nil, card_present: Stripe.Resources.CardPresent.t() | nil, client_secret: String.t(), code_verification: code_verification() | nil, created: integer(), currency: String.t(), customer: String.t() | nil, eps: Stripe.Resources.Eps.t() | nil, flow: String.t(), giropay: Stripe.Resources.Giropay.t() | nil, id: String.t(), ideal: Stripe.Resources.Ideal.t() | nil, klarna: Stripe.Resources.Klarna.t() | nil, livemode: boolean(), metadata: %{required(String.t()) => String.t()}, multibanco: Stripe.Resources.Multibanco.t() | nil, object: String.t(), owner: owner(), p24: Stripe.Resources.P24.t() | nil, receiver: receiver() | nil, redirect: redirect() | nil, sepa_credit_transfer: Stripe.Resources.SepaCreditTransfer.t() | nil, sepa_debit: Stripe.Resources.SepaDebit.t() | nil, sofort: Stripe.Resources.Sofort.t() | nil, source_order: source_order() | nil, statement_descriptor: String.t(), status: String.t(), three_d_secure: Stripe.Resources.ThreeDSecure.t() | nil, type: String.t(), usage: String.t(), wechat: Stripe.Resources.Wechat.t() | nil }
ach_credit_transferach_debitacss_debitalipayallow_redisplay- This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. Possible values:always,limited,unspecified. Nullable.amount- A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required forsingle_usesources. Nullable.au_becs_debitbancontactcardcard_presentclient_secret- The client secret of the source. Used for client-side retrieval using a publishable key. Max length: 5000.code_verification- Expandable.created- Time at which the object was created. Measured in seconds since the Unix epoch. Format: Unix timestamp.currency- Three-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready. Required forsingle_usesources. Format: ISO 4217 currency code. Nullable.customer- The ID of the customer to which this source is attached. This will not be present when the source has not been attached to a customer. Max length: 5000.epsflow- The authenticationflowof the source.flowis one ofredirect,receiver,code_verification,none. Max length: 5000.giropayid- Unique identifier for the object. Max length: 5000.idealklarnalivemode- Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.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. Nullable.multibancoobject- String representing the object's type. Objects of the same type share the same value. Possible values:source.owner- Information about the owner of the payment instrument that may be used or required by particular source types. Nullable. Expandable.p24receiver- Expandable.redirect- Expandable.sepa_credit_transfersepa_debitsofortsource_order- Expandable.statement_descriptor- Extra information about a source. This will appear on your customer's statement every time you charge the source. Max length: 5000. Nullable.status- The status of the source, one ofcanceled,chargeable,consumed,failed, orpending. Onlychargeablesources can be used to create a charge. Max length: 5000.three_d_securetype- Thetypeof the source. Thetypeis a payment method, one ofach_credit_transfer,ach_debit,alipay,bancontact,card,card_present,eps,giropay,ideal,multibanco,klarna,p24,sepa_debit,sofort,three_d_secure, orwechat. An additional hash is included on the source with a name matching this value. It contains additional information specific to the payment method used. Possible values:ach_credit_transfer,ach_debit,acss_debit,alipay,au_becs_debit,bancontact,card,card_present,eps,giropay,ideal,klarna,multibanco,p24,sepa_credit_transfer,sepa_debit,sofort,three_d_secure,wechat.usage- Eitherreusableorsingle_use. Whether this source should be reusable or not. Some source types may or may not be reusable by construction, while others may leave the option at creation. If an incompatible value is passed, an error will be returned. Max length: 5000. Nullable.wechat