调至内容部分
创建账户
或
登录
Stripe 文档徽标
/
询问人工智能
创建账户
登录
开始
付款
销售收入
平台和交易市场
资金管理
开发人员资源
概览
版本管理
更改日志
升级您的 API 版本
升级 SDK 版本
基础功能
SDK
API
测试
Stripe CLI
项目示例
工具
Workbench
开发人员管理平台
Stripe Shell
Stripe for Visual Studio Code
功能
工作流程
事件接收端
Stripe 健康警报文件上传
AI 解决方案
代理工具包
模型上下文协议
安全与隐私
安全
Stripebot web crawler
隐私
扩展 Stripe
构建 Stripe 应用程序
    概览
    开始
    创建应用程序
    Stripe Apps 的原理
    示例应用程序
    构建应用
    存储密钥
    API 认证方法
    授权流程
    服务器端逻辑
    侦听事件
    处理不同模式
    启用沙盒支持
    应用设置页面
    构建 UI
    轻松入驻
    发布您的应用
    分发选择
    上传您的应用
    版本与发布
    测试您的应用
    发布您的应用
    推广您的应用
    添加深度链接
    创建安装链接
    在 UI 扩展中分配角色
    安装后操作
    应用程序分析
    嵌入式组件
    嵌入第三方 Stripe 应用
    迁移到 Stripe 应用
    迁移或构建扩展
    将插件迁移到 Stripe 应用程序或 Stripe Connect
    参考编号
    应用描述文件
    CLI
    扩展 SDK
    权限
    视口
    设计样式
    组件
使用 Stripe 的应用程序
合作伙伴
合作伙伴生态
合作伙伴认证
首页开发人员资源Build Stripe apps

Getting started with Stripe Apps

Learn the basics of app development by building, previewing, and updating a Stripe app.

In this guide, build a “Hello, world!” sample app with a UI extension on the Customer details page in the Stripe Dashboard.

Before you begin

  1. If you have an existing Connect extension, see Migrate to Stripe Apps.
  2. Sign in to the Stripe Dashboard.
  3. If you haven’t already, install the Stripe CLI and log in using the same account.
    Command Line
    homebrew
    Install from source
    No results
    # Install Homebrew to run this command: https://brew.sh/ brew install stripe/stripe-cli/stripe # Connect the CLI to your dashboard stripe login

    For additional install options, see Get started with the Stripe CLI.

  4. Verify that you’re using CLI version 1.12.4 or newer. You can check by running:
    Command Line
    stripe version
    If your Stripe CLI version is older than 1.12.4, update your Stripe CLI version to the latest version.
  5. Verify that node is installed and up to date.
    Command Line
    node -v
    You can manage your app’s dependencies with NPM or Yarn. Use the latest stable version for the best development experience. If you plan to publish your app to the App Marketplace, there are additional restrictions:
  • Your account must be activated.
  • Currently to publish an app on the Stripe Marketplace, you can’t be a Platform account.

Install the Stripe Apps CLI plugin

To start building a Stripe app, install the Stripe Apps CLI plugin:

Command Line
stripe plugin install apps

If you already have the apps plugin installed, verify that you’re on version 1.5.12 or later.

Command Line
stripe apps -v # apps version 1.5.12

If you need to upgrade the apps plugin, you can run:

Command Line
stripe plugin upgrade apps

Create an app

  1. Build the basic structure of your “Hello, world!” app:

    Command Line
    stripe apps create helloworld
  2. Follow the prompts by entering the following information:

    • ID: You can accept the auto-generated app ID or customize one. This is how Stripe identifies your app. Your app ID must be globally unique.
    • Display name: Enter a display name. This is the name your Dashboard displays for your app. You can always change the name later.

Your directory file structure is now:

Stripe Apps only supports React 17. Make sure any dependency you install is compatible with this version. For more information see How UI extensions work.

Preview your app

You can run your app locally, update it, and preview your changes in the Dashboard:

  1. Go into the helloworld directory:

    Command Line
    cd helloworld
  2. To preview your app, start your local development server:

    Command Line
    stripe apps start
  3. Press Enter to open your browser.

    注意

    Use a browser that supports the Stripe Dashboard. Safari doesn’t support the Dashboard. For more updates, see the GitHub issue tracking browser support.

  4. Click Continue to preview your app in your Stripe account:

    Screenshot of enabling preview mode

    Enable app preview

    Hello World app

    Your app in the Dashboard

The App view only renders on the Customer details page in the Dashboard. If you don’t see your app, make sure you create a customer in the Dashboard.

Build your app

While you’re previewing your app in the Dashboard, the local development server enables real-time updates on your app:

  1. In your App.tsx file, change the title while you keep the Stripe Dashboard page open and your development server running. Save the file to see your changes in your app.

  2. In the same file, remove > from the </ContextView> closing tag, and save the file to see an error:

    Hello World error

    You can resolve the error in the Stripe Dashboard, your browser developer tools, or the Stripe CLI.

  3. To stop the development server, Ctrl+C from your command line.

Your sample app is complete. Next, start adding more features to your Stripe app.

另见

  • Build a UI extension
  • Add server-side logic
  • Distribution options
此页面的内容有帮助吗?
是否
  • 需要帮助?联系支持。
  • 加入我们的早期使用计划。
  • 查看我们的更改日志。
  • 有问题?联系销售。
  • LLM? Read llms.txt.
  • Powered by Markdoc