跳转到正文

快速入门

GitHub
终端窗口
bun add @capgo/capacitor-stripe-identity
bunx 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',
});
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.git
cd capacitor-stripe-identity/example-app
bun install
bun run start

本页记录了当前公开的 API,来自 Capgo/capacitor-stripe-identity.