Upgrade your integration
Upgrade your integration to the latest API version.
To upgrade your integration, complete the following steps. Search the Changelog for information specific to your integration.
Define the target version for your upgrade
Make sure that you specify the API version that you’re integrating against in your code instead of relying on your account’s default API version. To test a newer version for API calls, set the Stripe-Version header (in live mode or a sandbox). Learn how to set an API version in our server-side SDKs.
View which API versions your integration uses in the Overview tab of Workbench.
Review the Changelog to find the target version for your upgrade.
Specify the API version in your SDK
Your account has a default API version that defines how you call the API, what functionality you have access to, and the structure of API responses. When you use a server-side SDK, your API calls to Stripe use the API version that was current when the SDK was released. You can’t target a different API version when using a strongly typed language, such as Java, Go, or .NET.
The stripe-ruby library allows you to set the API version for a client or on a per-request basis.
If you don’t set an API version, recent versions of stripe-ruby use the API version that was latest at the time your version of stripe-ruby was released. Versions of stripe-ruby before v9 use your account’s default API version.
To set the API version for all requests made by a StripeClient, provide the stripe_ option when you create the client:
require 'stripe' # Don't put any keys in code. See /keys-best-practices. client = Stripe::StripeClient.new('sk_test_...', stripe_version: '2026-11-18.endive')
Or set the version per-request:
require 'stripe' # Don't put any keys in code. See /keys-best-practices. client = Stripe::StripeClient.new('sk_test_...') intent = client.v1.payment_intents.retrieve( '{{PAYMENT_INTENT_ID}}', {}, {stripe_version: '2026-11-18.endive'}, ) intent.capture
Note
When you override the version for a client or per-request, the API response objects are also returned in that version.
Update your code to handle API changes
Review your most important requests and update your code to handle changes to the response. For each request, review the relevant breaking changes in the changelog to understand the changes required to adopt your target version.
View your API requests in the Overview tab of Workbench.
Update your event destinations
We recommend using thin events instead of snapshot events for your event destinations. Thin event payloads don’t change across API versions. If you’re already using thin events, you don’t need to update your event destinations for this or future upgrades. If you’re not using thin events, migrate during this upgrade. Only keep snapshot events if your integration needs a point-in-time view of the object or needs to see which fields changed without making another API call.
If you don’t have any event destinations: Create thin event destinations instead of snapshot webhook endpoints. Follow Set up events. You don’t need to follow the migration steps.
If you have event destinations that receive snapshot events: Migrate from snapshot events to thin events. Follow the steps in the Thin events tab as part of your upgrade process, and see the migration guide for additional details and troubleshooting. You create a thin event destination and run it in parallel with your existing destination. Test your thin event handler in shadow mode (logging actions without changing data) so you can switch without disrupting production.
Before you switch, confirm that each event type your handler uses has a thin event equivalent of a snapshot event. For each thin event, your handler makes an API call to fetch the related object. The object reflects its latest state, not its state when the event occurred. The API call uses the API version that your SDK sets, so the object matches the rest of your integration.
Thin events provide a lightweight, version-stable alternative to snapshot events. Instead of receiving full resource objects in webhook payloads, you receive compact notifications and fetch the details you need. The thin event notification payload and destination configuration remain stable across API version upgrades, so you don’t need to update your event destinations when you upgrade. Resources and events that you fetch from the API still follow standard API versioning behavior.
Before you begin
Make sure you have:
- Access to your webhook endpoint code to add a new route
- Permission to create event destinations in your Stripe Dashboard or with the API. Use a restricted API key with
Writeaccess to event destinations andReadaccess to the relevant resources rather than your secret key. - Access to a sandbox to validate the migration before touching production
- Monitoring and logging to compare behavior between handlers
- Signature verification configured for your new endpoint, and your server configured to only accept requests from Stripe’s IP addresses
Warning
Complete this entire migration process in a sandbox before attempting it in live mode.
Add a thin webhook route
Create a new endpoint in your application specifically for thin events. Start with a minimal implementation that only verifies signatures and returns a 200 status code.
const express = require('express'); const client = require('stripe')(process.env.STRIPE_SECRET_KEY, { apiVersion: '2026-09-30.endive', }); const app = express(); // New thin event endpoint app.post( '/webhook/thin', express.raw({type: 'application/json'}), async (req, res) => { const sig = req.headers['stripe-signature']; const thinWebhookSecret = process.env.THIN_WEBHOOK_SECRET; try { // Verify the signature and parse the thin event notification const thinNotification = client.parseEventNotification( req.body, sig, thinWebhookSecret, ); console.log(`Verified thin event: ${thinNotification.id}`); // For now, just acknowledge receipt res.sendStatus(200); } catch (err) { console.log(`Webhook Error: ${err.message}`); res.status(400).send(`Webhook Error: ${err.message}`); } }, ); app.listen(3000, () => console.log('Running on port 3000'));
Deploy this change and verify that the endpoint is accessible.
Create a thin event destination
In the Stripe Dashboard or API, create a new event destination configured for thin events.
- Go to Developers > Webhooks.
- Click Add destination.
- Under Payload style, select Thin.
- Subscribe to the same event types your snapshot destination uses, but with the
v1.prefix:customer.→created v1.customer. created payment_→intent. succeeded v1.payment_ intent. succeeded invoice.→paid v1.invoice. paid
- Enter your new endpoint URL (for example,
https://example.)com/webhook/thin
Store the new webhook signing secret separately from your snapshot webhook secret. Label them clearly (for example, SNAPSHOT_ and THIN_) to avoid mixing them up.
At this point, both destinations are active and delivering events to your application.
Run in shadow mode
Update your thin webhook handler to fetch event details and related objects, but don’t write to your database yet. Instead, log what actions you would take so you can monitor that your thin handler behaves the same as your snapshot handler.
Add these components to your thin event handler:
Enable a shadow mode flag (add it at the top of your file):
// Enable shadow mode via environment variable const SHADOW_MODE = process.env.SHADOW_MODE !== 'false';Fetch the complete event (add after signature verification):
// Fetch the complete event from the notification const event = await thinNotification.fetchEvent(); console.log(`Processing ${event.type} (thin ID: ${event.id})`); // For the thin version of snapshot events, log the original snapshot event ID if (event.snapshot_event) { console.log(`Correlated snapshot event: ${event.snapshot_event}`); }Fetch related object and shadow log (add event handling logic):
// Fetch the latest state of the related resource if (event.type === 'v1.customer.created') { const customer = await thinNotification.fetchRelatedObject(); if (SHADOW_MODE) { // SHADOW MODE: Log what you would do, but don't do it yet console.log(`[SHADOW] Would create customer record: ${customer.id}`); // recordMetric('customer.created.thin', 1); } else { // Production mode: Actually write to database await createCustomerInDatabase(customer); } }Complete the handler with shadow mode:
const SHADOW_MODE = process.env.SHADOW_MODE !== 'false'; // ← NEW app.post( '/webhook/thin', express.raw({type: 'application/json'}), async (req, res) => { const sig = req.headers['stripe-signature']; const thinWebhookSecret = process.env.THIN_WEBHOOK_SECRET; try { const thinNotification = client.parseEventNotification( req.body, sig, thinWebhookSecret, ); // ← NEW: Fetch the complete event const event = await thinNotification.fetchEvent(); console.log(`Processing ${event.type} (thin ID: ${event.id})`); // ← NEW: Log snapshot event ID for correlation if (event.snapshot_event) { console.log(`Correlated snapshot event: ${event.snapshot_event}`); } // ← NEW: Fetch the latest state of the related resource and handle in shadow mode if (event.type === 'v1.customer.created') { const customer = await thinNotification.fetchRelatedObject(); if (SHADOW_MODE) { console.log(`[SHADOW] Would create customer record: ${customer.id}`); } else { await createCustomerInDatabase(customer); } } res.sendStatus(200); } catch (err) { console.log(`Webhook Error: ${err.message}`); res.status(400).send(`Webhook Error: ${err.message}`); } }, );
What to look for in shadow mode
Run shadow mode for at least 24-48 hours and monitor:
- Signature verification: Confirm all thin events verify successfully.
- Fetch latency: Measure how long it takes to retrieve events and related objects.
- Behavior consistency: Compare shadow logs against your snapshot handler’s actual behavior.
- Error rates: Watch for any unexpected failures or missing data.
If your thin event handler’s shadow logs diverge from what the snapshot event handler actually does, investigate and fix the discrepancy now, while there’s no production impact.
When the retrieved complete event has a snapshot_ property, log it alongside event. to correlate the snapshot and thin events during the transition.
Cut over with idempotency
When shadow mode runs cleanly, enable real writes in your thin handler. Keep both destinations active during a brief overlap window to make sure you don’t miss any events.
Implement idempotency
During the overlap, you might receive the same logical event twice: once as a snapshot event and once as a thin event. Use idempotency keys to prevent duplicate processing.
For thin events with a corresponding snapshot event, the retrieved complete event’s snapshot_ property contains the original snapshot event ID. Use this property as your idempotency key so both handlers can deduplicate against the same key.
Here’s how this implementation prevents duplicates:
When a customer’s created, Stripe generates both events:
- Snapshot event:
evt_abc123 - Complete thin event:
evt_withxyz789 snapshot_event: "evt_ abc123"
- Snapshot event:
Both handlers receive events simultaneously:
- Snapshot handler:
idempotencyKey = event.>id "evt_abc123" - Thin handler:
idempotencyKey = event.→snapshot_ event || event. id "evt_abc123"
- Snapshot handler:
Both handlers save the same key in your processed-event store:
- The first handler saves
evt_and creates the customer.abc123 - The second handler finds
evt_and skips the event.abc123
- The first handler saves
Result: The customer is created once.
// Snapshot handler const idempotencyKey = event.id; // Thin handler. snapshot_event is the snapshot event ID when Stripe sent both. const idempotencyKey = event.snapshot_event || event.id;
Save that key before you process the event. If processing fails, delete the key before you return an error. Otherwise, when Stripe retries the delivery, your handler finds the key and skips the event.
If you already store processed events, save this key there. For a complete handler, including one example table, see Handle duplicate snapshot and thin events.
Monitor the cutover
With both handlers writing to your database:
- Watch duplicate detection: Confirm that your idempotency logic catches overlapping events.
- Compare write patterns: Make sure thin and snapshot handlers produce identical database states.
- Track error rates: Alert on any increase in failures.
- Monitor performance: Measure the impact of additional API calls to fetch related objects.
If anything looks wrong, disable writes in the thin event handler and investigate. Your snapshot handler remains your point of reference until you’re confident in the thin path.
Keep the overlap window short (a few hours to a day at most). This limits the period during which you process events twice, and it simplifies troubleshooting if issues arise.
Retire the snapshot destination
After the thin handler processes events reliably, disable the snapshot destination. Keep the snapshot handler code until the thin handler has succeeded for one full cycle of your slowest event. For a monthly Billing event, that means one billing cycle.
Phase 1: Disable (keep code in place)
- In the Stripe Dashboard, go to Event destinations.
- Find your snapshot event destination.
- Click Disable.
This stops Stripe from sending events to your snapshot endpoint, but leaves your code in place as a safety measure. Monitor your thin-only flow to confirm stability.
Phase 2: Delete the snapshot
If everything remains stable:
- Delete the snapshot event destination from the Dashboard.
- Remove the snapshot webhook handler code from your application.
- Delete the
SNAPSHOT_from your configuration.WEBHOOK_ SECRET - Update any documentation or runbooks that reference snapshot events.
Test and monitor your integration
Test your integration in a sandbox to confirm that it handles the new version as expected.
In addition to the general testing guidance, follow the guidelines for the products and resources that your integration uses:
- Billing: Use test clocks to simulate subscriptions.
- Invoicing: Test webhook notifications, payment failures, and other scenarios.
- Connect: Create test accounts and use them for verification testing.
- Terminal: Test simulated reader updates.
- Payment Intents: Create PaymentIntents and use test card numbers to simulate payments.