View Source Stripe.Customer (Striped v0.1.0)
This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.
Related guide: Save a card during payment.
Link to this section Summary
Functions
Returns a list of transactions that updated the customer’s balances.
Creates a new customer object.
Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, newfunding instructions will be created. If funding instructions have already been created for a given customer, the same funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
Removes the currently applied discount on a customer.
Create an incoming testmode bank transfer
Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
Returns a list of PaymentMethods for a given Customer
Retrieves a Customer object.
Retrieves a PaymentMethod object for a given Customer.
Search for customers you’ve previously created using Stripe’s Search Query Language.Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the source parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the source parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the past_due state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the default_source for a customer will not trigger this behavior.
Link to this section Types
@type t() :: %Stripe.Customer{ address: term() | nil, balance: integer(), cash_balance: Stripe.CashBalance.t() | nil, created: integer(), currency: binary() | nil, default_source: (binary() | Stripe.PaymentSource.t()) | nil, delinquent: boolean() | nil, description: binary() | nil, discount: term() | nil, email: binary() | nil, id: binary(), invoice_credit_balance: term(), invoice_prefix: binary() | nil, invoice_settings: term(), livemode: boolean(), metadata: term(), name: binary() | nil, next_invoice_sequence: integer(), object: binary(), phone: binary() | nil, preferred_locales: term() | nil, shipping: term() | nil, sources: term(), subscriptions: term(), tax: term(), tax_exempt: binary() | nil, tax_ids: term(), test_clock: (binary() | Stripe.TestHelpers.TestClock.t()) | nil }
The customer type.
addressThe customer's address.balanceCurrent balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized.cash_balanceThe current funds being held by Stripe on behalf of the customer. These funds can be applied towards payment intents with source "cash_balance".The settings[reconciliation_mode] field describes whether these funds are applied to such payment intents manually or automatically.createdTime at which the object was created. Measured in seconds since the Unix epoch.currencyThree-letter ISO code for the currency the customer can be charged in for recurring billing purposes.default_sourceID of the default payment source for the customer.
If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.
delinquentWhen the customer's latest invoice is billed by charging automatically,delinquentistrueif the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice,delinquentistrueif the invoice isn't paid by its due date.
If an invoice is marked uncollectible by dunning, delinquent doesn't get reset to false.
descriptionAn arbitrary string attached to the object. Often useful for displaying to users.discountDescribes the current discount active on the customer, if there is one.emailThe customer's email address.idUnique identifier for the object.invoice_credit_balanceThe current multi-currency balances, if any, being stored on the customer.If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency. These balances do not refer to any unpaid invoices.They solely track amounts that have yet to be successfully applied to any invoice. A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized.invoice_prefixThe prefix for the customer used to generate unique invoice numbers.invoice_settingslivemodeHas the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.metadataSet 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.nameThe customer's full name or business name.next_invoice_sequenceThe suffix of the customer's next invoice number, e.g., 0001.objectString representing the object's type. Objects of the same type share the same value.phoneThe customer's phone number.preferred_localesThe customer's preferred locales (languages), ordered by preference.shippingMailing and shipping address for the customer. Appears on invoices emailed to this customer.sourcesThe customer's payment sources, if any.subscriptionsThe customer's current subscriptions, if any.taxtax_exemptDescribes the customer's tax exemption status. One ofnone,exempt, orreverse. When set toreverse, invoice and receipt PDFs include the text "Reverse charge".tax_idsThe customer's tax IDs.test_clockID of the test clock this customer belongs to.
Link to this section Functions
@spec balance_transactions(client :: term(), customer :: binary(), params :: map()) :: {:ok, Stripe.List.t(Stripe.CustomerBalanceTransaction.t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Returns a list of transactions that updated the customer’s balances.
Details
- Method:
get - Path:
/v1/customers/{customer}/balance_transactions
Query parameters
:ending_beforestring:expandarray of: string:limitinteger:starting_afterstring
@spec create(client :: term(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a new customer object.
Details
- Method:
post - Path:
/v1/customers
@spec create_funding_instructions( client :: term(), customer :: binary(), params :: map() ) :: {:ok, Stripe.FundingInstructions.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, newfunding instructions will be created. If funding instructions have already been created for a given customer, the same funding instructions will be retrieved. In other words, we will return the same funding instructions each time.
#### Details * Method: `post` * Path: `/v1/customers/{customer}/funding_instructions`@spec delete(client :: term(), customer :: binary()) :: {:ok, Stripe.DeletedCustomer.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.
Details
- Method:
delete - Path:
/v1/customers/{customer}
@spec delete_discount(client :: term(), customer :: binary()) :: {:ok, Stripe.DeletedDiscount.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Removes the currently applied discount on a customer.
Details
- Method:
delete - Path:
/v1/customers/{customer}/discount
@spec fund_cash_balance(client :: term(), customer :: binary(), params :: map()) :: {:ok, Stripe.CustomerCashBalanceTransaction.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Create an incoming testmode bank transfer
Details
- Method:
post - Path:
/v1/test_helpers/customers/{customer}/fund_cash_balance
@spec list(client :: term(), params :: map()) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
Details
- Method:
get - Path:
/v1/customers
Query parameters
:createdany of:- object with (optional) properties:
gt: integergte: integerlt: integerlte: integer
- integer
- object with (optional) properties:
:emailstring:ending_beforestring:expandarray of: string:limitinteger:starting_afterstring:test_clockstring
@spec list_payment_methods(client :: term(), customer :: binary(), params :: map()) :: {:ok, Stripe.List.t(Stripe.PaymentMethod.t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Returns a list of PaymentMethods for a given Customer
Details
- Method:
get - Path:
/v1/customers/{customer}/payment_methods
Query parameters
:ending_beforestring:expandarray of: string:limitinteger:starting_afterstring:type(Required) string
@spec retrieve(client :: term(), customer :: binary(), params :: map()) :: {:ok, t() | Stripe.DeletedCustomer.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a Customer object.
Details
- Method:
get - Path:
/v1/customers/{customer}
Query parameters
:expandarray of: string
retrieve_payment_method(client, customer, payment_method, params \\ %{})
View Source@spec retrieve_payment_method( client :: term(), customer :: binary(), payment_method :: binary(), params :: map() ) :: {:ok, Stripe.PaymentMethod.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a PaymentMethod object for a given Customer.
Details
- Method:
get - Path:
/v1/customers/{customer}/payment_methods/{payment_method}
Query parameters
:expandarray of: string
@spec search(client :: term(), params :: map()) :: {:ok, Stripe.SearchResult.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Search for customers you’ve previously created using Stripe’s Search Query Language.Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
#### Details * Method: `get` * Path: `/v1/customers/search` #### Query parameters * `:expand` array of: string * `:limit` integer * `:page` string * `:query` (Required) string@spec update(client :: term(), customer :: binary(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the source parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the source parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the past_due state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the default_source for a customer will not trigger this behavior.
This request accepts mostly the same arguments as the customer creation call.
Details
- Method:
post - Path:
/v1/customers/{customer}