快速入门
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-stripe-identity`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/stripe-identity/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
“安装”章节bun add @capgo/capacitor-stripe-identitybunx cap sync导入
“导入”章节import { StripeIdentity } from '@capgo/capacitor-stripe-identity';快速入门
章节标题为“快速入门”import { StripeIdentity } from '@capgo/capacitor-stripe-identity';
await StripeIdentity.initialize({ publishableKey: 'publishable-key-123' });示例:创建
标题为“示例:创建”的章节import { StripeIdentity } from '@capgo/capacitor-stripe-identity';
await StripeIdentity.create({ verificationId: 'verification-id-123', ephemeralKeySecret: 'ephemeral-key-secret',});示例:展示
章节标题:“示例:present”import { StripeIdentity } from '@capgo/capacitor-stripe-identity';
await StripeIdentity.present();常见坑点
章节标题为“常见陷阱”- 监听器: 在页面卸载时移除句柄。
- 初始化一次: 在应用启动时运行 setup。
- 唯一可信来源:信任
src/definitions.ts在 GitHub 仓库中。
验证流程
“验证流程”部分在后端创建 VerificationSession,然后将 ID 传递给插件:
await StripeIdentity.initialize({ publishableKey: 'pk_test_...' });
await StripeIdentity.create({ verificationId: 'vs_...', ephemeralKeySecret: 'ek_...', clientSecret: 'vs_..._secret_...', // web only});
await StripeIdentity.present();示例应用
标题为“示例应用”的章节git clone https://github.com/Cap-go/capacitor-stripe-identity.gitcd capacitor-stripe-identity/example-appbun installbun run start单一事实来源
标题为“单一事实来源”的部分本页记录了当前公开的 API,来自 Capgo/capacitor-stripe-identity.