# PostCustomersCustomer

From **Stripe API**.

`POST /v1/customers/{customer}`

<p>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 <strong>source</strong> 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 <strong>source</strong> parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the <code>past_due</code> 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 <strong>default_source</strong> for a customer will not trigger this behavior.</p>

<p>This request accepts mostly the same arguments as the customer creation call.</p>

## Parameters

### `customer`

- Location: path
- Required: true
- Type: `string`
- maxLength: `5000`

## Request body

- Required: false
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"address":{"anyOf":[{"properties":{"city":{"maxLength":5000,"type":"string"},"country":{"maxLength":5000,"type":"string"},"line1":{"maxLength":5000,"type":"string"},"line2":{"maxLength":5000,"type":"string"},"postal_code":{"maxLength":5000,"type":"string"},"state":{"maxLength":5000,"type":"string"}},"title":"optional_fields_address","type":"object"},{"enum":[""],"type":"string"}],"description":"The customer's address."},"balance":{"description":"An integer amount in %s that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.","type":"integer"},"bank_account":{"anyOf":[{"properties":{"account_holder_name":{"maxLength":5000,"type":"string"},"account_holder_type":{"enum":["company","individual"],"maxLength":5000,"type":"string"},"account_number":{"maxLength":5000,"type":"string"},"country":{"maxLength":5000,"type":"string"},"currency":{"type":"string"},"object":{"enum":["bank_account"],"maxLength":5000,"type":"string"},"routing_number":{"maxLength":5000,"type":"string"}},"required":["account_number","country"],"title":"customer_payment_source_bank_account","type":"object"},{"maxLength":5000,"type":"string"}],"description":"Either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/js), or a dictionary containing a user's bank account details."},"card":{"anyOf":[{"properties":{"address_city":{"maxLength":5000,"type":"string"},"address_country":{"maxLength":5000,"type":"string"},"address_line1":{"maxLength":5000,"type":"string"},"address_line2":{"maxLength":5000,"type":"string"},"address_state":{"maxLength":5000,"type":"string"},"address_zip":{"maxLength":5000,"type":"string"},"cvc":{"maxLength":5000,"type":"string"},"exp_month":{"type":"integer"},"exp_year":{"type":"integer"},"metadata":{"additionalProperties":{"type":"string"},"type":"object"},"name":{"maxLength":5000,"type":"string"},"number":{"maxLength":5000,"type":"string"},"object":{"enum":["card"],"maxLength":5000,"type":"string"}},"required":["exp_month","exp_year","number"],"title":"customer_payment_source_card","type":"object"},{"maxLength":5000,"type":"string"}],"description":"A token, like the ones returned by [Stripe.js](https://stripe.com/docs/js).","x-stripeBypassValidation":true},"coupon":{"maxLength":5000,"type":"string"},"default_alipay_account":{"description":"ID of Alipay account to make the customer's new default for invoice payments.","maxLength":500,"type":"string"},"default_bank_account":{"description":"ID of bank account to make the customer's new default for invoice payments.","maxLength":500,"type":"string"},"default_card":{"description":"ID of card to make the customer's new default for invoice payments.","maxLength":500,"type":"string"},"default_source":{"description":"If you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) parameter.\n\nProvide the ID of a payment source already attached to this customer to make it this customer's default payment source.\n\nIf you want to add a new payment source and make it the default, see the [source](https://stripe.com/docs/api/customers/update#update_customer-source) property.","maxLength":500,"type":"string"},"description":{"description":"An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard.","maxLength":5000,"type":"string"},"email":{"description":"Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to *512 characters*.","maxLength":512,"type":"string"},"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"invoice_prefix":{"description":"The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.","maxLength":5000,"type":"string"},"invoice_settings":{"description":"Default invoice settings for this customer.","properties":{"custom_fields":{"anyOf":[{"items":{"properties":{"name":{"maxLength":30,"type":"string"},"value":{"maxLength":30,"type":"string"}},"required":["name","value"],"title":"custom_field_params","type":"object"},"type":"array"},{"enum":[""],"type":"string"}]},"default_payment_method":{"maxLength":5000,"type":"string"},"footer":{"maxLength":5000,"type":"string"}},"title":"customer_param","type":"object"},"metadata":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"enum":[""],"type":"string"}],"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) 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`."},"name":{"description":"The customer's full name or business name.","maxLength":256,"type":"string"},"next_invoice_sequence":{"description":"The sequence to be used on the customer's next invoice. Defaults to 1.","type":"integer"},"phone":{"description":"The customer's phone number.","maxLength":20,"type":"string"},"preferred_locales":{"description":"Customer's preferred languages, ordered by preference.","items":{"maxLength":5000,"type":"string"},"type":"array"},"promotion_code":{"description":"The API ID of a promotion code to apply to the customer. The customer will have a discount applied on all recurring payments. Charges you create through the API will not have the discount.","maxLength":5000,"type":"string"},"shipping":{"anyOf":[{"properties":{"address":{"properties":{"city":{"maxLength":5000,"type":"string"},"country":{"maxLength":5000,"type":"string"},"line1":{"maxLength":5000,"type":"string"},"line2":{"maxLength":5000,"type":"string"},"postal_code":{"maxLength":5000,"type":"string"},"state":{"maxLength":5000,"type":"string"}},"title":"optional_fields_address","type":"object"},"name":{"maxLength":5000,"type":"string"},"phone":{"maxLength":5000,"type":"string"}},"required":["address","name"],"title":"customer_shipping","type":"object"},{"enum":[""],"type":"string"}],"description":"The customer's shipping information. Appears on invoices emailed to this customer."},"source":{"maxLength":5000,"type":"string","x-stripeBypassValidation":true},"tax":{"description":"Tax details about the customer.","properties":{"ip_address":{"anyOf":[{"type":"string"},{"enum":[""],"type":"string"}]}},"title":"tax_param","type":"object"},"tax_exempt":{"description":"The customer's tax exemption. One of `none`, `exempt`, or `reverse`.","enum":["","exempt","none","reverse"],"type":"string"},"trial_end":{"anyOf":[{"enum":["now"],"maxLength":5000,"type":"string"},{"format":"unix-time","type":"integer"}],"description":"Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`."}},"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

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](https://stripe.com/docs/payments/save-during-payment).

```json
{"description":"This object represents a customer of your business. It lets you create recurring charges and track payments that belong to the same customer.\n\nRelated guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment).","properties":{"address":{"anyOf":[{"$ref":"#/components/schemas/address"}],"description":"The customer's address.","nullable":true},"balance":{"description":"Current 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.","type":"integer"},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"currency":{"description":"Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes.","maxLength":5000,"nullable":true,"type":"string"},"default_source":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/alipay_account"},{"$ref":"#/components/schemas/bank_account"},{"$ref":"#/components/schemas/bitcoin_receiver"},{"$ref":"#/components/schemas/card"},{"$ref":"#/components/schemas/source"}],"description":"ID of the default payment source for the customer.\n\nIf you are using payment methods created via the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/alipay_account"},{"$ref":"#/components/schemas/bank_account"},{"$ref":"#/components/schemas/bitcoin_receiver"},{"$ref":"#/components/schemas/card"},{"$ref":"#/components/schemas/source"}]}},"delinquent":{"description":"When the customer's latest invoice is billed by charging automatically, `delinquent` is `true` if the invoice's latest charge failed. When the customer's latest invoice is billed by sending an invoice, `delinquent` is `true` if the invoice isn't paid by its due date.\n\nIf an invoice is marked uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't get reset to `false`.","nullable":true,"type":"boolean"},"description":{"description":"An arbitrary string attached to the object. Often useful for displaying to users.","maxLength":5000,"nullable":true,"type":"string"},"discount":{"anyOf":[{"$ref":"#/components/schemas/discount"}],"description":"Describes the current discount active on the customer, if there is one.","nullable":true},"email":{"description":"The customer's email address.","maxLength":5000,"nullable":true,"type":"string"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"invoice_prefix":{"description":"The prefix for the customer used to generate unique invoice numbers.","maxLength":5000,"nullable":true,"type":"string"},"invoice_settings":{"$ref":"#/components/schemas/invoice_setting_customer_setting"},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","type":"object"},"name":{"description":"The customer's full name or business name.","maxLength":5000,"nullable":true,"type":"string"},"next_invoice_sequence":{"description":"The suffix of the customer's next invoice number, e.g., 0001.","type":"integer"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["customer"],"type":"string"},"phone":{"description":"The customer's phone number.","maxLength":5000,"nullable":true,"type":"string"},"preferred_locales":{"description":"The customer's preferred locales (languages), ordered by preference.","items":{"maxLength":5000,"type":"string"},"nullable":true,"type":"array"},"shipping":{"anyOf":[{"$ref":"#/components/schemas/shipping"}],"description":"Mailing and shipping address for the customer. Appears on invoices emailed to this customer.","nullable":true},"sources":{"description":"The customer's payment sources, if any.","properties":{"data":{"description":"Details about each object.","items":{"anyOf":[{"$ref":"#/components/schemas/alipay_account"},{"$ref":"#/components/schemas/bank_account"},{"$ref":"#/components/schemas/bitcoin_receiver"},{"$ref":"#/components/schemas/card"},{"$ref":"#/components/schemas/source"}],"title":"Polymorphic"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"ApmsSourcesSourceList","type":"object","x-expandableFields":["data"]},"subscriptions":{"description":"The customer's current subscriptions, if any.","properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/subscription"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"SubscriptionList","type":"object","x-expandableFields":["data"]},"tax":{"$ref":"#/components/schemas/customer_tax"},"tax_exempt":{"description":"Describes the customer's tax exemption status. One of `none`, `exempt`, or `reverse`. When set to `reverse`, invoice and receipt PDFs include the text **\"Reverse charge\"**.","enum":["exempt","none","reverse"],"nullable":true,"type":"string"},"tax_ids":{"description":"The customer's tax IDs.","properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/tax_id"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"TaxIDsList","type":"object","x-expandableFields":["data"]}},"required":["created","id","livemode","object"],"title":"Customer","type":"object","x-expandableFields":["address","default_source","discount","invoice_settings","shipping","sources","subscriptions","tax","tax_ids"],"x-resourceId":"customer"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/customers/{customer} \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "address": "string",
  "balance": 1,
  "bank_account": "string",
  "card": "string",
  "coupon": "string",
  "default_alipay_account": "string",
  "default_bank_account": "string",
  "default_card": "string",
  "default_source": "string",
  "description": "string",
  "email": "string",
  "expand": [
    "string"
  ],
  "invoice_prefix": "string",
  "invoice_settings": {
    "custom_fields": "string",
    "default_payment_method": "string",
    "footer": "string"
  },
  "metadata": "string",
  "name": "string",
  "next_invoice_sequence": 1,
  "phone": "string",
  "preferred_locales": [
    "string"
  ],
  "promotion_code": "string",
  "shipping": "string",
  "source": "string",
  "tax": {
    "ip_address": "string"
  },
  "tax_exempt": "string",
  "trial_end": "string"
}'
```
