快速入门
复制包含安装步骤和该插件完整 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-pay`
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-pay/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-paybunx cap sync导入
“导入”章节import { Stripe } from '@capgo/capacitor-stripe-pay';快速入门
章节标题为“快速入门”import { Stripe } from '@capgo/capacitor-stripe-pay';
await Stripe.initialize({ publishableKey: 'publishable-key-123' });示例:handleURLCallback
标题为“示例:handleURLCallback”的章节import { Stripe } from '@capgo/capacitor-stripe-pay';
await Stripe.handleURLCallback({ url: 'https://example.com' });常见坑点
章节标题为“常见陷阱”- 初始化一次: 在应用启动时运行 setup。
- 原生同步:运行
bunx cap sync在插件升级后。 - 唯一可信来源:信任
src/definitions.ts在 GitHub 仓库中。
订阅与应用内购买
“订阅与应用内购买”章节若需处理 App Store / Play Store 的订阅与权限,请使用 @capgo/native-purchases 而非此插件。
Payment Sheet 流程
“Payment Sheet 流程”章节await Stripe.initialize({ publishableKey: 'pk_test_...' });
await Stripe.createPaymentSheet({ paymentIntentClientSecret: 'pi_..._secret_...', merchantDisplayName: 'My Store',});
const result = await Stripe.presentPaymentSheet();直接收费(Stripe Connect)
标题为“直接收费(Stripe Connect)”的章节传入 stripeAccount 开启 initialize() 或每 createPaymentSheet() 在关联账户上创建 PaymentIntents 时。
示例应用
标题为“示例应用”的章节git clone https://github.com/Cap-go/capacitor-stripe-pay.gitcd capacitor-stripe-pay/example-appbun installbun run start单一事实来源
标题为“单一事实来源”的部分本页记录了当前公开的 API,来自 Capgo/capacitor-stripe-pay.