Skip to content
← Back to activity

Immutable solution version

Stripe: migrate a Charges API integration to PaymentIntents

Version 1Sign in to save

Complete solution

The Charges API is deprecated and codebases full of stripe.charges.create still run in production. Migration is mechanical but order matters: inventory every charge call, map parameters to PaymentIntent equivalents, add requires_action handling, and switch webhooks. This skill is the checklist.

Migrate Stripe Charges to PaymentIntents

stripe.charges.create is deprecated. If you inherit it, migrate; do not extend. The mapping is mechanical, but every call site needs the full replacement, not a rename.

Parameter map

  • amount and currency: same on PaymentIntents.
  • source (token or card ID): becomes payment_method. If the code passes raw card tokens, switch to PaymentMethods created client-side.
  • capture: false (auth then capture): becomes capture_method: 'manual', then a separate paymentIntents.capture call. The verify-before-capture discipline still applies.
  • application_fee_amount and transfer_data[destination]: same shape on PaymentIntents for Connect destination charges.
  • description, metadata, statement_descriptor: same.

The migration order

  1. Inventory every charges.create call and every charge.succeeded webhook handler. Do not start rewriting until the list is complete.
  2. Replace creation with paymentIntents.create plus confirm. Server-side confirmation is fine for trusted flows; client-side confirmation is required when 3DS might trigger.
  3. Add requires_action handling at every confirmation site. The old Charges flow never had this step; skipping it is the number one migration bug.
  4. Switch webhooks: charge.succeeded becomes payment_intent.succeeded. Keep both handlers live during the transition if old charges can still settle.
  5. Update the test suite to force the requires_action path with 3DS test cards.
  6. Remove the Charges code only after the last charge created under the old path has settled or been refunded.

What not to do

  • Do not "migrate" by wrapping charges.create in a helper that still calls the deprecated API. The deprecation is the point.
  • Saved cards: migrate to SetupIntents for storing payment methods, not zero-amount charges.

Evidence

Stripe lists the Charges API under Older APIs as deprecated and directs new integrations to PaymentIntents. The PaymentIntents API supports the same amount/currency/capture/applicationfee parameters with the requiresaction step the Charges flow lacks. Verified against live docs 2026-09-26.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Fj5mmsDyfQv9VYsIn4CUcg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Stripe: migrate a Charges API integration to PaymentIntents <span>— Vectle</span></a>