Stripe | Financial Infrastructure to Grow Your Revenue

Stripe | Financial Infrastructure to Grow Your Revenue

4466 articles

Create a card


Create a card

POST / v1 / customers /:id / sources

When you create a new credit card, you must specify a customer or recipient on which to create it.

If the card’s owner has no default card, then the new card will become the default. However, if the owner already has a default, then it will not change. To change the default, you should update the customer to have a new default_source.

Parameters

  • source object | string Required A token, like the ones returned by Stripe.js or a dictionary containing a user’s card details (with the options shown below). Stripe will automatically validate the card.
  • metadata map 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.

Returns

Returns the Card object.

Response

{ "id": "card_1NGTaT2eZvKYlo2CZWSctn5n", "object": "card", "address_city": null, "address_country": null, "address_line1": null, "address_line1_check": null, "address_line2": null, "address_state": null, "address_zip": null, "address_zip_check": null, "brand": "Visa", "country": "US", "customer": "cus_9s6XGDTHzA66Po", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 8, "exp_year": 2024, "fingerprint": "Xt5EWLLDS7FJjR1c", "funding": "credit", "last4": "4242", "metadata": {}, "name": null, "redaction": null, "tokenization_method": null, "wallet": null}

Update a card

POST / v1 / customers /:id / sources /:id

Updates a specified card for a given customer.

Parameters

  • address _ city string the relevant part of the product
  • address _ country string Billing address country, if provided when creating card.
  • address _ line1 string Address line 1 (Street address/PO Box/Company name).
  • address _ line2 string Address line 2 (the relevant part of the product).
  • address _ state string the relevant part of the product
  • address _ zip string ZIP or postal code.
  • exp _ month string Two digit number representing the card’s expiration month.
  • exp _ year string Four digit number representing the card’s expiration year.
  • metadata map 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.
  • name string Cardholder name.

Returns

Response

{ "id": "card_1NBLeN2eZvKYlo2CIq1o7Pzs", "object": "card", "address_city": null, "address_country": null, "address_line1": null, "address_line1_check": null, "address_line2": null, "address_state": null, "address_zip": null, "address_zip_check": null, "brand": "Visa", "country": "US", "cvc_check": "pass", "dynamic_last4": null, "exp_month": 8, "exp_year": 2024, "fingerprint": "Xt5EWLLDS7FJjR1c", "funding": "credit", "last4": "4242", "metadata": {}, "name": "Jenny Rosen", "redaction": null, "tokenization_method": null, "wallet": null, "account": "acct_1032D82eZvKYlo2C"}

Retrieve a card

GET / v1 / customers /:id / cards /:id

You can always see the 10 most recent cards directly on a customer; this method lets you retrieve details about a specific card stored on the customer.

Parameters

No parameters.

Returns

Returns the Card object.

cURL

Response

{ "id": "card_1MvoiELkdIwHu7ixOeFGbN9D", "object": "card", "address_city": null, "address_country": null, "address_line1": null, "address_line1_check": null, "address_line2": null, "address_state": null, "address_zip": null, "address_zip_check": null, "brand": "Visa", "country": "US", "customer": "cus_NhD8HD2bY8dP3V", "cvc_check": null, "dynamic_last4": null, "exp_month": 4, "exp_year": 2024, "fingerprint": "mToisGZ01V71BCos", "funding": "credit", "last4": "4242", "metadata": {}, "name": null, "tokenization_method": null, "wallet": null}
Last verified 2026-09-24

Is this helpful?