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

Update a charge

Update the description and metadata of an existing charge. Only these two fields can be modified after charge creation.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Required - 1 fieldRequired Parameters
โ–ผ
`id`STRING(required)
The charge ID to update. Must be a valid charge from your account.
Example:"chrg_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must start with chrg_
Additional - 2 fieldsAdditional Parameters

Responsesโ€‹

200

Successfully updated

Charge updated successfully. Returns complete charge object with updated fields.

Updated fields:
  • description - New description (if provided)
  • metadata - New metadata object (if provided)
  • All other fields remain unchanged

400

Bad request

Invalid parameters provided.

Common causes:
  • Metadata exceeds 15,000 characters
  • Invalid metadata format
  • No fields provided to update

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key

404

Not found

Charge ID does not exist.

Common causes:
  • Incorrect charge ID
  • Charge from different account
  • Using test key for live charge (or vice versa)

Code samplesโ€‹

curl https://api.omise.co/charges/chrg_test_5xuy4w91xqz7d1w9u0t \
-X PATCH \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-d "description=Order #1234 - Shipped" \
-d "metadata[status]=shipped"

Error and result codesโ€‹

Updatable Fieldsโ€‹

FieldCan Update?Notes
descriptionYesText description for internal use
metadataYesCustom key-value data (replaces entirely)
amountNoCannot change after creation
currencyNoCannot change after creation
statusNoChanges via capture/reverse/etc
cardNoCannot change payment method

Metadata Behaviorโ€‹

ActionResultImportant Note
Update metadataReplaces entire objectMust include all keys you want to keep
Omit metadataNo changeExisting metadata preserved
Empty metadata Clears all metadataAll existing data removed

Try it outโ€‹

Required - 1 fields
โ–ผ
Additional - 2 fields