{"id":21489599,"url":"https://github.com/renenielsendk/nextjs-stripe-webhook","last_synced_at":"2025-07-15T16:31:12.928Z","repository":{"id":253646255,"uuid":"844073010","full_name":"renenielsendk/nextjs-stripe-webhook","owner":"renenielsendk","description":"A plug-and-play Next.js application designed for seamless handling of Stripe webhooks. Start accepting events from Stripe in under 10 minutes.","archived":false,"fork":false,"pushed_at":"2024-08-29T21:59:29.000Z","size":3025,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-08-29T23:54:30.954Z","etag":null,"topics":["nextjs","nextjs14","stripe","webhook"],"latest_commit_sha":null,"homepage":"https://github.com/renenielsendk/nextjs-stripe-webhook/blob/main/README.md","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renenielsendk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-18T09:50:52.000Z","updated_at":"2024-08-29T22:04:45.000Z","dependencies_parsed_at":"2024-08-29T23:41:47.872Z","dependency_job_id":null,"html_url":"https://github.com/renenielsendk/nextjs-stripe-webhook","commit_stats":null,"previous_names":["renenielsendk/nextjs-api-starter","renenielsendk/nextjs-stripe-webhook"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renenielsendk%2Fnextjs-stripe-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renenielsendk%2Fnextjs-stripe-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renenielsendk%2Fnextjs-stripe-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renenielsendk%2Fnextjs-stripe-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renenielsendk","download_url":"https://codeload.github.com/renenielsendk/nextjs-stripe-webhook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226051383,"owners_count":17565970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nextjs","nextjs14","stripe","webhook"],"created_at":"2024-11-23T14:22:13.510Z","updated_at":"2024-11-23T14:22:13.971Z","avatar_url":"https://github.com/renenielsendk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NextJS Stripe Webhook\n\n\u003cp\u003e\n    \u003ca href=\"https://github.com/renenielsendk/nextjs-stripe-webhook/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/renenielsendk/nextjs-stripe-webhook\" alt=\"Github stargazers\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/renenielsendk/nextjs-stripe-webhook/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/renenielsendk/nextjs-stripe-webhook\" alt=\"Github issues\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/renenielsendk/nextjs-stripe-webhook/blob/main/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/github/license/renenielsendk/nextjs-stripe-webhook\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThe NextJS Stripe Webhook project sets up the core structure for handling Stripe webhook events in a Next.js app. It handles all the boilerplate around processing webhooks, letting you focus on implementing your custom logic.\n\nYou get a clean, ready-to-use setup—just drop in your business logic and start managing Stripe events effortlessly.\n\n- [Introduction](#introduction)\n- [Built with](#built-with)\n- [Features](#features)\n  - [Streamlined Logging](#streamlined-logging)\n  - [Uniform Error Handling](#uniform-error-handling)\n  - [Code Prettier](#code-prettier)\n  - [Code Validation](#code-validation)\n- [Example Implementations](#example-implementations)\n- [Getting Started](#getting-started)\n  - [Local Development](#step-1-local-development)\n  - [Deploy Your Application](#step-2-deploy-your-application)\n  - [Configure Stripe Webhook](#step-3-configure-stripe-webhook)\n- [License](#license)\n- [Links](#links)\n\n## Built with\n\n- [Next.js](https://nextjs.org/)\n- [Stripe](https://stripe.com/)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Node.js](https://nodejs.org/)\n\n## Features\n\n### Streamlined Logging\n\nThis project utilizes [Pino logger](https://github.com/pinojs/pino) for streamlined logging, enabling you to easily trace logs throughout the application.\n\n![Logging](./docs/logging.png)\n\n### Uniform Error Handling\n\nYou can throw errors anywhere in your implementation using the [APIError](https://github.com/renenielsendk/nextjs-stripe-webhook/blob/3f5c97cee5b270d28445dc06940be0744957ee6f/src/_shared/types/api.ts#L6).\n\nThese errors are consistently caught and returned as HTTP responses.\n\nExample:\n\n```\nconst user = await db.user.find({ id: '1' });\n\nif (!user) {\n  throw new ApiError({\n    type: 'NotFoundError',\n    message: 'User not found', // optional\n  });\n}\n```\n\nThe above example will return Http Status `404` with body `{ message: 'User not found'}`.\n\n![Postman error](./docs/postman-error.png)\n\n### Code Prettier\n\nRunning `yarn prettier` will format your code to a consistent style, ensuring a uniform codebase.\n\n### Code Validation\n\nRunning `yarn validate` will validate the entire codebase, helping to maintain code quality and consistency.\n\n![Validation](./docs/validating.png)\n\n## Example Implementations\n\nThis project includes example implementations for handling specific Stripe webhook events. These examples show how to manage the following events within your application:\n\n### API Route\n\n- **Method**: POST\n- **Path**: `/api/webhook`\n- **Description**: Handles incoming Stripe webhook events.\n\n### Supported Webhook Events\n\n- **`payment_intent.succeeded`**: Handles successful payment intents.\n- **`account.updated`**: Handles updates to Stripe accounts.\n\nThese events are implemented with example handlers, demonstrating how to process them effectively in your application.\n\n## Getting Started\n\n### Step 1: Local Development\n\nTo start working with this project locally, follow these steps:\n\n1. **Fork this repository**: Create your own fork of this repository on GitHub.\n2. **Clone the repository**: Clone your forked repository to your local machine.\n3. **Navigate to the project directory**: Move into the directory where the project was cloned.\n4. **Install dependencies**: Run `yarn install` to install all required dependencies.\n5. **Set up environment variables**: Copy `.env.example` to `.env.local` and update the environment variables with your Stripe secret keys and other necessary configurations.\n6. **Start the development server**: Run `yarn dev` to start the development server.\n\n### Step 2: Deploy Your Application\n\nOnce your business logic is implemented and tested locally, deploy your application using your preferred hosting service (e.g., Vercel, Netlify, Heroku).\n\n### Step 3: Configure Stripe Webhook\n\nAfter deploying your application, configure the Stripe webhook to point to your deployed endpoint. Follow [this guide](./docs/stripe-dashboard-add-webhook/README.md) to set up the webhook in your Stripe dashboard.\n\n### Step 4: Celebrate\n\n![Success](./docs/success-1.png)\n\n👇👇👇\n\n![Success 2](./docs/success-2.png)\n\n👇👇👇\n\n![Great success](./docs/success-3.gif)\n\n## License\n\nLicensed under [MIT](./LICENSE.md).\n\n## Links\n\nLooking for more exciting projects and insights?\n\n👇👇\n\nConnect with me on [𝕏 @renenielsendk](https://x.com/renenielsendk) for updates, tips, and more awesome content!\n\n#nextjs, #stripe, #stripe-checkout, #subscription, #api, #template, #webhook\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenenielsendk%2Fnextjs-stripe-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenenielsendk%2Fnextjs-stripe-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenenielsendk%2Fnextjs-stripe-webhook/lists"}