Skip to main content
AllDevToolsHub
Back to all patterns

Stripe Charge ID

Validation

Validates a Stripe Charge ID (ch_XXXXXXXX...).

/^ch_[A-Za-z0-9]{24,32}$/

How it works

Charge IDs are slightly longer than customer IDs because they include an embedded timestamp segment. The ch_ prefix is unique to live charges; test-mode charges use the same prefix but a clearly fake-looking suffix.

Test Cases

Should Match

  • ch_3LdhRf2eZvKYlo2C0XK6T6Vt
  • ch_1Hkjk4LgIcRBVwYr3vBlAcZl

Should NOT Match

  • pi_3LdhRf2eZvKYlo2C0XK6T6Vt
  • ch_short

Quick Summary

Validates Stripe Charge IDs of the form ch_ followed by 24–32 alphanumeric characters.