---
title: "How do I store inventory data in my Stripe application"
description: "The DevRel Swag Store uses Stripe payments and AWS services to keep product inventory accurate and visible in near real time. Stripe products retain core payment information, while Amazon DynamoDB stores inventory and other attributes, keyed by Stripe product ID and store ID; EventBridge routes payment events to Lambda, which atomically decrements stock and publishes updates through AWS IoT Core to the frontend. DynamoDB condition expressions prevent decrements when stock is insufficient, while post-payment validation and refunds address the delay before a Stripe Payment Link is disabled, although Stripe fees may be non-refundable. A custom Payment Intent flow can check stock before payment, authorize funds with manual capture for up to seven days, update inventory after payment success, and then capture the charge."
---

# How do I store inventory data in my Stripe application

[Stripe](https://yomu.fyi/company/stripe) · Ben Smith · Dec 16, 2024

**Type:** Tutorial

## Summary

The DevRel Swag Store uses Stripe payments and AWS services to keep product inventory accurate and visible in near real time. Stripe products retain core payment information, while Amazon DynamoDB stores inventory and other attributes, keyed by Stripe product ID and store ID; EventBridge routes payment events to Lambda, which atomically decrements stock and publishes updates through AWS IoT Core to the frontend. DynamoDB condition expressions prevent decrements when stock is insufficient, while post-payment validation and refunds address the delay before a Stripe Payment Link is disabled, although Stripe fees may be non-refundable. A custom Payment Intent flow can check stock before payment, authorize funds with manual capture for up to seven days, update inventory after payment success, and then capture the charge.

## Context

The store needed accurate, near-real-time inventory updates, protection against overselling during concurrent purchases, and a way to reflect stock changes in both the backend inventory system and frontend. Payment Links can be completed during the delay before they are disabled, so unavailable purchases may require refunds.

## Approach / What changed

The architecture uses Stripe with Amazon EventBridge, AWS Lambda, Amazon DynamoDB, and AWS IoT Core. DynamoDB stores inventory and product attributes, using the Stripe product ID as the partition key and store ID as the sort key. Lambda processes payment events, performs atomic conditional decrements, publishes frontend updates, and validates inventory for refunds. An alternative custom flow checks stock before creating a manually captured Payment Intent.

## Takeaways

- DynamoDB UpdateItem with atomic decrements and condition expressions keeps concurrent inventory updates isolated and prevents stock from becoming negative.
- Payment Link processing can require post-payment refunds when inventory is unavailable; Stripe transaction fees collected on refunded payments may be non-refundable.
- A custom Payment Intent flow performs a pre-payment stock check and uses manual capture, with a seven-day authorization validity window, to reduce inventory discrepancies.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [AWS](https://yomu.fyi/topic/aws), [Reliability](https://yomu.fyi/topic/reliability), [Scalability](https://yomu.fyi/topic/scalability), [Serverless](https://yomu.fyi/topic/serverless)

- Source: [Stripe](https://stripe.dev/blog/how-do-i-store-inventory-data-in-my-stripe-application)
- Source URL: https://stripe.dev/blog/how-do-i-store-inventory-data-in-my-stripe-application
- Ingested by Yomu: 2026-08-28T08:57:29.567Z

[Read original post](https://stripe.dev/blog/how-do-i-store-inventory-data-in-my-stripe-application)
