update_customer: Update a customer

View source: R/customer.R

update_customerR Documentation

Update a customer

Description

Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. If you pass credit card information, the customer's active card to be used for all charges in the future will be updated. When you update a customer to a new valid card, then the latest unpaid, unclosed invoice for the subscription will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Invoices pertaining to unpaid subscriptions, or invoices pertaining to canceled subscriptions, will not be retried as a result of updating the customer's credit card information.

Usage

update_customer(
  id,
  account_balance = NULL,
  business_vat_id = NULL,
  metadata = list(),
  default_source = NULL,
  coupon = NULL,
  description = NULL,
  email = NULL,
  ship_name = NULL,
  ship_city = NULL,
  ship_country = NULL,
  ship_line1 = NULL,
  ship_line2 = NULL,
  ship_state = NULL,
  ship_zip = NULL,
  ship_phone = NULL,
  card_token = NULL,
  card_exp_month = NULL,
  card_exp_year = NULL,
  card_number = NULL,
  card_cvc = NULL,
  card_holder = NULL,
  address_city = NULL,
  address_country = NULL,
  address_line1 = NULL,
  address_line2 = NULL,
  address_state = NULL,
  address_zip = NULL,
  currency = NULL,
  default_for_currency = NULL,
  card_metadata = NULL
)

Arguments

id

ID of customer to be updated

account_balance

An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that will be used before attempting any charges to the customer's card; a positive amount will be added to the next invoice.

business_vat_id

The customer's VAT identification number. If you are using Relay, this field gets passed to tax provider you are using for your orders. This can be unset by updating the value to NULL.

metadata

A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format. This can be unset by updating the value to NULL.

default_source

ID of source to make the customer's new default for invoice payments

coupon

If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the API will not have the discount.

description

An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. This can be unset by updating the value to NULL.

email

Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This can be unset by updating the value to NULL.

ship_name

Name on shipping address

ship_city

City of shipping address

ship_country

Country of shipping address

ship_line1

Address line 1 of shipping address

ship_line2

Address line 2 of shipping address

ship_state

State/Region/Territory of shipping address

ship_zip

Zip/Postal Code of shipping address

ship_phone

Phone number associated with shipping address

card_token

Token ID of card token representing the customer's credit card details. You can pass credit card details if you don't have a token created yet.

address_city

City of billing address

address_country

Country of billing address

address_line1

Address line 1 of billing address

address_line2

Address line 2 of billing address

address_state

State of billing address

address_zip

Zip/Postal Code of billing address

currency

Required when adding a card to an account (not applicable to customers or recipients). The card (which must be a debit card) can be used as a transfer destination for funds in this currency. Currently, the only supported currency for debit card transfers is usd.

default_for_currency

Only applicable on accounts (not customers or recipients). If you set this to true (or if this is the first external account being added in this currency) this card will become the default external account for its currency.

card_metadata

set of key/value pairs that you can attach to a card object. It can be useful for storing additional information about the card in a structured format.

exp_month

Two digit number representing the card's expiration month.

exp_year

Two or four digit number representing the card's expiration year.

number

The card number, as a string without any separators.

cvc

Card security code.

name

Cardholder's full name

Value

A stripe_customer object representing the updated customer


MrDAndersen/stRipe documentation built on June 9, 2025, 8:37 a.m.