Struct stripe::Customer

source ·
pub struct Customer {
Show 28 fields pub id: CustomerId, pub address: Option<Address>, pub balance: Option<i64>, pub cash_balance: Option<CashBalance>, pub created: Option<Timestamp>, pub currency: Option<Currency>, pub default_source: Option<Expandable<PaymentSource>>, pub deleted: bool, pub delinquent: Option<bool>, pub description: Option<String>, pub discount: Option<Discount>, pub email: Option<String>, pub invoice_credit_balance: Option<i64>, pub invoice_prefix: Option<String>, pub invoice_settings: Option<InvoiceSettingCustomerSetting>, pub livemode: Option<bool>, pub metadata: Option<Metadata>, pub name: Option<String>, pub next_invoice_sequence: Option<i64>, pub phone: Option<String>, pub preferred_locales: Option<Vec<String>>, pub shipping: Option<Shipping>, pub sources: List<PaymentSource>, pub subscriptions: List<Subscription>, pub tax: Option<CustomerTax>, pub tax_exempt: Option<CustomerTaxExempt>, pub tax_ids: List<TaxId>, pub test_clock: Option<Expandable<TestHelpersTestClock>>,
}
Expand description

The resource representing a Stripe “Customer”.

For more details see https://stripe.com/docs/api/customers/object

Fields§

§id: CustomerId

Unique identifier for the object.

§address: Option<Address>

The customer’s address.

§balance: Option<i64>

The current balance, if any, that’s 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’s added to their next invoice. The balance only considers amounts that Stripe hasn’t successfully applied to any invoice. It doesn’t reflect unpaid invoices. This balance is only taken into account after invoices finalize.

§cash_balance: Option<CashBalance>

The current funds being held by Stripe on behalf of the customer.

You can apply these funds towards payment intents when the source is “cash_balance”. The settings[reconciliation_mode] field describes if these funds apply to these payment intents manually or automatically.

§created: Option<Timestamp>

Time at which the object was created.

Measured in seconds since the Unix epoch.

§currency: Option<Currency>

Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes.

§default_source: Option<Expandable<PaymentSource>>

ID of the default payment source for the customer.

If you use payment methods created through the PaymentMethods API, see the invoice_settings.default_payment_method field instead.

§deleted: bool§delinquent: Option<bool>

Tracks the most recent state change on any invoice belonging to the customer.

Paying an invoice or marking it uncollectible via the API will set this field to false. An automatic payment failure or passing the invoice.due_date will set this field to true. If an invoice becomes uncollectible by dunning, delinquent doesn’t reset to false. If you care whether the customer has paid their most recent subscription invoice, use subscription.status instead. Paying or marking uncollectible any customer invoice regardless of whether it is the latest invoice for a subscription will always set this field to false.

§description: Option<String>

An arbitrary string attached to the object.

Often useful for displaying to users.

§discount: Option<Discount>

Describes the current discount active on the customer, if there is one.

§email: Option<String>

The customer’s email address.

§invoice_credit_balance: Option<i64>

The current multi-currency balances, if any, that’s 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’s added to their next invoice denominated in that currency. These balances don’t apply to unpaid invoices. They solely track amounts that Stripe hasn’t successfully applied to any invoice. Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.

§invoice_prefix: Option<String>

The prefix for the customer used to generate unique invoice numbers.

§invoice_settings: Option<InvoiceSettingCustomerSetting>§livemode: Option<bool>

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

§metadata: Option<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.

§name: Option<String>

The customer’s full name or business name.

§next_invoice_sequence: Option<i64>

The suffix of the customer’s next invoice number (for example, 0001).

§phone: Option<String>

The customer’s phone number.

§preferred_locales: Option<Vec<String>>

The customer’s preferred locales (languages), ordered by preference.

§shipping: Option<Shipping>

Mailing and shipping address for the customer.

Appears on invoices emailed to this customer.

§sources: List<PaymentSource>

The customer’s payment sources, if any.

§subscriptions: List<Subscription>

The customer’s current subscriptions, if any.

§tax: Option<CustomerTax>§tax_exempt: Option<CustomerTaxExempt>

Describes the customer’s tax exemption status, which is none, exempt, or reverse.

When set to reverse, invoice and receipt PDFs include the following text: “Reverse charge”.

§tax_ids: List<TaxId>

The customer’s tax IDs.

§test_clock: Option<Expandable<TestHelpersTestClock>>

ID of the test clock that this customer belongs to.

Implementations§

source§

impl Customer

source

pub fn list( client: &Client, params: &ListCustomers<'_> ) -> Response<List<Customer>>

Returns a list of your customers.

The customers are returned sorted by creation date, with the most recent customers appearing first.

source

pub fn create(client: &Client, params: CreateCustomer<'_>) -> Response<Customer>

Creates a new customer object.

source

pub fn retrieve( client: &Client, id: &CustomerId, expand: &[&str] ) -> Response<Customer>

Retrieves a Customer object.

source

pub fn update( client: &Client, id: &CustomerId, params: UpdateCustomer<'_> ) -> Response<Customer>

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.

source

pub fn delete(client: &Client, id: &CustomerId) -> Response<Deleted<CustomerId>>

Permanently deletes a customer.

It cannot be undone. Also immediately cancels any active subscriptions on the customer.

source§

impl Customer

source

pub fn attach_source( client: &Client, customer_id: &CustomerId, source: PaymentSourceParams ) -> Response<PaymentSource>

Attaches a source to a customer, does not change default Source for the Customer

For more details see https://stripe.com/docs/api#attach_source.

source

pub fn detach_source( client: &Client, customer_id: &CustomerId, source_id: &PaymentSourceId ) -> Response<DetachedSource>

Detaches a source from a customer

For more details see https://stripe.com/docs/api#detach_source.

source

pub fn retrieve_source( client: &Client, customer_id: &CustomerId, source_id: &PaymentSourceId ) -> Response<PaymentSource>

Retrieves a Card, BankAccount, or Source for a Customer

source

pub fn verify_bank_account( client: &Client, customer_id: &CustomerId, bank_account_id: &BankAccountId, params: VerifyBankAccount<'_> ) -> Response<BankAccount>

Verifies a Bank Account for a Customer.

For more details see https://stripe.com/docs/api/customer_bank_accounts/verify.

source

pub fn retrieve_payment_methods( client: &Client, customer_id: &CustomerId, params: CustomerPaymentMethodRetrieval<'_> ) -> Response<List<PaymentMethod>>

Returns a list of PaymentMethods for a given Customer

For more details see https://stripe.com/docs/api/payment_methods/customer_list

source

pub fn search( client: &Client, params: CustomerSearchParams<'_> ) -> Response<SearchList<Customer>>

Searches for a customer.

For more details see https://stripe.com/docs/api/customers/search.

source§

impl Customer

source

pub fn list_balance_transactions( client: &Client, customer_id: &CustomerId, params: ListCustomerBalanceTransactions<'_> ) -> Response<List<CustomerBalanceTransaction>>

List all of a customer’s balance transactions.

source

pub fn create_balance_transaction( client: &Client, customer_id: &CustomerId, params: CreateCustomerBalanceTransaction<'_> ) -> Response<CustomerBalanceTransaction>

Create a new customer balance transaction.

source

pub fn retrieve_balance_transaction( client: &Client, customer_id: &CustomerId, id: &CustomerBalanceTransactionId, expand: &[&str] ) -> Response<CustomerBalanceTransaction>

Retrieve a customer balance transaction.

source

pub fn update_balance_transaction( client: &Client, customer_id: &CustomerId, id: &CustomerBalanceTransactionId, params: UpdateCustomerBalanceTransaction<'_> ) -> Response<CustomerBalanceTransaction>

Update a customer balance transaction.

Only the description and metadata fields can be updated.

Trait Implementations§

source§

impl Clone for Customer

source§

fn clone(&self) -> Customer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Customer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Customer

source§

fn default() -> Customer

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Customer

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Object for Customer

§

type Id = CustomerId

The canonical id type for this object.
source§

fn id(&self) -> Self::Id

The id of the object.
source§

fn object(&self) -> &'static str

The object’s type, typically represented in wire format as the object property.
source§

impl Serialize for Customer

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,