Skip to main content
Version: 2019-05-29 (Current)

Update a Card

Update card details including cardholder name, expiration date, billing address, and postal code. All update parameters are optional.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Required - 2 fieldsPath Parameters
โ–ผ
`id`STRING(required)
Customer ID (must be a valid customer ID starting with cust_).
Example:"cust_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must be a valid customer ID
`card_id`STRING(required)
Card ID (must be a valid card ID starting with card_).
Example:"card_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must be a valid card ID, Card must belong to the customer
Additional - 3 fieldsCard Information Updates
Additional - 2 fieldsBilling Address Updates

Responsesโ€‹

200

Card updated successfully

Card object returned with updated information.

Updatable fields:
  • name - Cardholder name
  • expiration_month - Card expiration month
  • expiration_year - Card expiration year
  • city - Billing city
  • postal_code - Billing postal code
Non-updatable fields:
  • Card number (create new card instead)
  • Card brand
  • Issuing bank
  • Fingerprint

400

Bad request

Invalid parameters provided.

Common causes:
  • Invalid expiration month (not between 1-12)
  • Past expiration date
  • Invalid year format

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key
  • Incorrect HTTP Basic Auth format

404

Not found

Customer or card not found.

Common causes:
  • Customer ID does not exist
  • Card ID does not exist
  • Card does not belong to the specified customer

Code samplesโ€‹

curl https://api.omise.co/customers/cust_test_5xuy4w91xqz7d1w9u0t/cards/card_test_5xuy4w91xqz7d1w9u0t \
-X PATCH \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "name=JOHN DOE" \
-d "expiration_month=12" \
-d "expiration_year=2026"

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
bad_requestInvalid parametersCheck expiration date and month values
authentication_failureInvalid API keyVerify your secret key is correct
not_foundCustomer or card not foundVerify IDs exist and card belongs to customer
invalid_parametersInvalid expiration dateCheck date is in the future

Updatable Card Fieldsโ€‹

FieldDescription
nameUpdated cardholder name
expiration_monthUpdated expiration month (1-12)
expiration_yearUpdated expiration year (YYYY)
cityUpdated billing city
postal_codeUpdated billing postal code

Try it outโ€‹

Required - 2 fields
โ–ผ
Additional - 5 fields