--- name: stripe description: Guidelines for using Stripe to integrate payments in mobile apps and any subsequent CRUD operations related to any Stripe entities --- ## Introduction Replit offers a native integration with Stripe that allows users to implement payments in their applications ## Prerequisites 1. These packages must be installed in the workspace root package.json: - `stripe` - Official Stripe SDK for API operations - `stripe-replit-sync` - Handles webhook processing and database sync. Documentation: https://www.npmjs.com/package/stripe-replit-sync Do not install them in any workspace package. If they are not installed, use pnpm to install them via the following command: `$ cd /home/runner/workspace && pnpm add -w ` 2. The Stripe integration must be connected to the repl. You can do this by proposing the integration. Reference the `integrations` skill if necessary. Once connected, create `stripeClient.ts` using the template from the code-templates reference -- this file fetches Stripe credentials from the Replit connection API and provides the authenticated client via `getUncachableStripeClient()`. Create it in both the API server directory and the scripts directory. 3. Ensure a PostgreSQL database exists. If you don't have one yet, use the tool to create a PostgreSQL database. Never use memory database for storing Stripe data. You are required to ensure these requirements are met before setting up or using Stripe. ## Project Structure - **Scripts directory**: The `@workspace/scripts` monorepo package (e.g., `src/seed-products.ts`) - **Run a script**: `pnpm --filter @workspace/scripts exec tsx src/