## Stripe Apps

Stripe Apps allow you to extend Stripe's functionality by integrating third-party services or embedding custom user interfaces directly within the Stripe Dashboard. This empowers you to authenticate users for external services, listen for Stripe events, automate workflows, and create tailored user experiences within the Stripe environment.

### Core Concepts

*   **Stripe Apps Marketplace:** A global platform where you can publish your apps for other Stripe users to discover and install.
*   **Private Distribution:** The ability to distribute apps only to your team members within your Stripe account.
*   **UI Extensions:** Develop custom user interfaces that integrate seamlessly into the Stripe Dashboard.
*   **Backend Component:** Implement server-side logic to handle data processing, integrations with third-party systems, and webhook event subscriptions.
*   **App Manifest (`stripe-app.json`):** A configuration file that describes how your app integrates with Stripe, including permissions, authentication methods, and other settings.
*   **Stripe CLI:** A command-line interface tool to help you create, develop, configure, and upload your Stripe apps.

### Getting Started

1.  **Create an App:** Begin by creating a new Stripe app, which involves setting up the basic structure and manifest file.
2.  **Understand How Stripe Apps Work:** Familiarize yourself with the different app patterns (backend, frontend, full-stack) and how to manage permissions.
3.  **Explore Sample Apps:** Browse available sample apps on GitHub to see practical implementations and get inspiration.

### Building Your App

*   **App Types:**
    *   **Backend App:** Runs in the background for data synchronization without a user interface.
    *   **Frontend App:** Renders a user interface within the Stripe Dashboard.
    *   **Full-Stack App:** Combines both a user interface and backend processing.
*   **API Authentication:** Choose the appropriate method for your app:
    *   **Platform Key:** Uses your account's secret API key for requests on behalf of your user's account.
    *   **OAuth 2.0:** An industry-standard protocol for secure authorization.
    *   **Restricted API Key (RAK):** Generates a key with specific, limited permissions for your app.
*   **Server-Side Logic:** Implement backend code to validate user actions, process data, integrate with third-party systems, and handle webhook events.
*   **Build a UI:** Utilize Stripe's UI Extensions SDK and UI toolkit (React, TypeScript) to create custom interfaces within the Stripe Dashboard.
    *   **UI Components:** A library of pre-built components (e.g., Buttons, Forms, Tables, Charts) to accelerate UI development.
    *   **Viewports:** Define where your app's UI elements will appear within the Dashboard.
    *   **Design Patterns:** Follow recommended patterns for consistent and user-friendly app design.
*   **App Settings Page:** Create a dedicated page for users to configure their app settings.
*   **Storing Secrets:** Securely store sensitive data like authentication credentials using the Secret Store API.

### Distribution and Deployment

*   **Distribution Options:** Choose between making your app publicly available on the Stripe App Marketplace or distributing it privately to your team.
*   **Upload and Install:** Upload your app to the test mode sandbox for testing and then install it in live mode.
*   **Publishing:** Follow the app publishing guide and review requirements to make your app available on the Stripe App Marketplace.
*   **Testing:** Set up external tests to allow other accounts to install and test your app before publication.
*   **Versioning and Releases:** Manage your app's versions and releases to ship updates and track changes over time.

### Migration

*   **Migrate Legacy Extensions:** If you have existing legacy extensions, migrate them to Stripe Apps for better discoverability and enhanced features.
*   **Migrate Plugins:** Transition your third-party integrations that relied on secret API keys to secure authentication methods like OAuth 2.0 or Restricted API Keys (RAKs).

### Key Features and Tools

*   **Deep Links:** Create links that navigate users directly to specific sections of your app within the Dashboard.
*   **Install Links:** Allow users to install your app outside of the Stripe App Marketplace.
*   **Sandbox Support:** Enable your app for sandbox installation to allow users to evaluate features in a testing environment.
*   **Local Network Access:** Configure local network access for app previewing.
*   **App Analytics:** Access data on how your apps are used and their marketplace performance.
*   **Developer Tools:** Utilize bundled tools for type checking, linting, and testing your UI extensions.
*   **UI Extension SDK:** A set of tools and utilities for building user interfaces within the Stripe Dashboard.
*   **Route Descriptors:** Implement soft, context-preserving navigation between Dashboard pages from your Stripe App.
*   **Roles in UI Extensions:** Tailor app functionality based on user roles within the Stripe Dashboard.