Stripe Integration
Connect your Stripe account to Vercel to accept payments and manage subscriptions in your app. The integration provisions your API keys as environment variables and supports Stripe sandbox and live modes. Test payment flows in Stripe sandbox, then deploy to production without manual key management.
This marketplace integration connects your Vercel project to Stripe. When you install it, Vercel:
- Creates a Stripe sandbox or connects your existing Stripe account
- Provisions your Stripe API keys as environment variables
- Updates environment variables when you connect a live account
You don't need to copy API keys by hand or manage variables across environments, which reduces the risk of exposing credentials.
Use this integration when you need to:
- Accept one-time payments for products and services
- Manage recurring billing for SaaS applications
- Process payments between buyers and sellers on a marketplace
- Sell downloadable content, courses, or media
Start in Stripe sandbox mode, build and test your payment flows, then connect your live Stripe account when you're ready.
Go to the Stripe integration page in the Vercel Marketplace and create the integration in Stripe sandbox mode.
- Click Install or click the drop-down and select Install New Stripe Sandbox
- Click Continue on Sandbox installation plan
- Update the Resource name if needed and click Create
Vercel provisions a Stripe sandbox and takes you to the integration settings page, where you can see the Stripe sandbox account API keys as environment variables.
Click Projects, then Connect Project to connect your project to the integration.
Go back to the Getting Started link and follow the instructions with code snippets to build your store with Next.js.
You can also deploy the Next.js + Stripe starter template, which creates the integration and connects it to your project automatically.
Use test card numbers to simulate successful and failed payments and verify your integration works end to end.
Once your store works in Stripe sandbox mode, connect your live Stripe account:
- Go to the Stripe installation page.
- Click the Install drop-down and select Import Existing Stripe Account.
- Click Continue to Stripe and follow the steps to connect your existing Stripe account.
- Click Done to proceed to the newly linked Stripe account page. From there, you can connect projects and manage environment variables.
The imported Stripe account's keys are already configured in Vercel. You can rotate them if needed on the Settings page of your Stripe resource in the Vercel Marketplace.
Redeploy your application so it picks up the new live keys. Your project can now accept real payments.
When using the Stripe integration:
Stripe provides two types of API keys:
- Secret keys (
STRIPE_SECRET_KEY): Never expose these in client-side code or commit them to version control. Use them only in server-side code (for example, API routes or Server Actions). - Publishable keys (
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY): Safe in client-side code. They identify your account but cannot perform sensitive operations.
Create checkout sessions, payment intents, handle webhooks, and process refunds on the server. In client-side code, only:
- Initialize Stripe Elements for collecting payment information
- Submit payment details to your server
- Display payment status to users
After connecting Stripe to your project, try these resources:
- Stripe documentation: Official Stripe API reference
Was this helpful?