Customers
This object represents a customer of your business. Use it to create recurring charges and track payments that belong to the same customer.
The Customer object
Attributes
idstring
Unique identifier for the object.
descriptionnullable string
An arbitrary string attached to the object. Often useful for displaying to users.
addressnullable string
The customer’s address.
emailnullable string
The customer’s email address.
More attributes
objectstring
String representing the object’s type. Objects of the same type share the same value.
balanceinteger
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.
createdtimestamp
Time at which the object was created. Measured in seconds since the Unix epoch.
currencynullable string
Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes.
{ "id": "cus_NffrFeUfNV2Hib", "object": "customer", "address": null, "balance": 0, "created": 1680893993, "currency": null, "default_source": null, "delinquent": false, "description": null, "discount": null, "email": "jennyrosen@example.com", "invoice_prefix": "0759376C", "invoice_settings": { "custom_fields": null, "default_payment_method": null, "footer": null, "rendering_options": null }, "livemode": false, "metadata": {}, "name": "Jenny Rosen", "next_invoice_sequence": 1, "phone": null, "preferred_locales": [], "shipping": null, "tax_exempt": "none", "test_clock": null }
Create a customer
Parameters
addressobject
The customer’s address.
descriptionnullable string
An arbitrary string attached to the object. Often useful for displaying to users.
emailnullable string
The customer’s email address.
metadataobject
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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata
.
More parameters
balanceinteger
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_balanceobject
Balance information and default balance settings for this customer.
Returns
Returns the Customer object after successful customer creation. Raises an error if create parameters are invalid (for example, specifying an invalid coupon or an invalid source).
const stripe = require("stripe")( "sk_test_CGGvfNiIPwLXiDwaOfZ3oX6Y" ) const customer = await stripe.customers.create({ name: "Jenny Rosen", email: "jennyrosen@example.com" })
{ "id": "cus_NffrFeUfNV2Hib", "object": "customer", "address": null, "balance": 0, "created": 1680893993, "currency": null, "default_source": null, "delinquent": false, "description": null, "discount": null, "email": "jennyrosen@example.com", "invoice_prefix": "0759376C", "invoice_settings": { "custom_fields": null, "default_payment_method": null, "footer": null, "rendering_options": null }, "livemode": false, "metadata": {}, "name": "Jenny Rosen", "next_invoice_sequence": 1, "phone": null }