Syncing Products Between Stripe and Sanity for Ecommerce Site
Great question! You're asking about one of the most common architectural decisions when building a Sanity + Stripe store. For your metal band merch store, I'd strongly recommend managing products in Sanity and using Stripe dynamically for tax and shipping rather than syncing products between both systems.
The Recommended Approach: Sanity as Single Source of Truth
The guide you linked demonstrates this pattern perfectly. Here's why it works great for your use case:
When you create a Stripe Checkout session, you can pass product data dynamically using price_data and product_data parameters. This means you don't need to pre-create products in Stripe's dashboard at all:
const session = await stripe.checkout.sessions.create({
line_items: [{
price_data: {
currency: 'usd',
unit_amount: product.price * 100, // from Sanity
product_data: {
name: product.name, // from Sanity
description: product.description, // from Sanity
images: [product.imageUrl], // from Sanity
},
tax_behavior: 'exclusive',
tax_code: 'txcd_99999999', // optional: specific tax category
},
quantity: 1,
}],
automatic_tax: { enabled: true }, // Stripe calculates tax automatically
shipping_address_collection: {
allowed_countries: ['US', 'CA', 'GB']
},
shipping_options: [
{
shipping_rate_data: {
display_name: 'Standard Shipping',
fixed_amount: { amount: 500, currency: 'usd' },
delivery_estimate: {
minimum: { unit: 'business_day', value: 5 },
maximum: { unit: 'business_day', value: 7 },
},
tax_behavior: 'exclusive',
}
}
],
mode: 'payment',
success_url: `${YOUR_DOMAIN}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${YOUR_DOMAIN}/cancel`,
});What This Gives You
✅ Band manages everything in one place (Sanity) - products, descriptions, images, and all other content
✅ Stripe handles tax calculation automatically via automatic_tax based on customer location
✅ Define shipping rates in your code or create reusable Shipping Rates in Stripe dashboard
✅ No syncing headaches - no webhooks needed to keep products in sync
✅ Simpler architecture perfect for a small merch store
When to Actually Sync Products
You'd only need to create products in both Stripe and Sanity if you:
- Want to use Stripe's subscription/recurring billing features extensively
- Need Stripe's product catalog for detailed reporting/analytics in their dashboard
- Use the Stripe Customer Portal for self-service management
- Have complex pricing tiers or product variants managed in Stripe
For a straightforward band merch store with t-shirts, hoodies, and albums, the dynamic price_data approach gives you full access to Stripe's tax calculation, shipping rates, and payment processing while keeping your content management workflow simple.
Tax and Shipping Details
For tax rates: Enable automatic_tax: { enabled: true } and Stripe calculates sales tax based on the customer's location automatically. You can optionally specify tax_code for specific product categories (apparel, digital goods, etc.).
For shipping rates: You have two options:
- Dynamic rates defined in
shipping_rate_data(shown above) - best for simple flat-rate shipping - Pre-configured rates created in Stripe dashboard, then reference them by ID in
shipping_options: [{ shipping_rate: 'shr_xxxxx' }]- better if you want to manage rates outside your code
The pattern in that guide is the sweet spot for most small-to-medium ecommerce sites - Sanity as your product catalog, Stripe as your payment processor with smart tax/shipping features built in.
Show original thread3 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.