跳转到正文

快速入门

GitHub
终端窗口
bun add @capgo/capacitor-stripe-pay
bunx cap sync
import { Stripe } from '@capgo/capacitor-stripe-pay';
import { Stripe } from '@capgo/capacitor-stripe-pay';
await Stripe.initialize({ publishableKey: 'publishable-key-123' });
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 而非此插件。

await Stripe.initialize({ publishableKey: 'pk_test_...' });
await Stripe.createPaymentSheet({
paymentIntentClientSecret: 'pi_..._secret_...',
merchantDisplayName: 'My Store',
});
const result = await Stripe.presentPaymentSheet();

传入 stripeAccount 开启 initialize() 或每 createPaymentSheet() 在关联账户上创建 PaymentIntents 时。

终端窗口
git clone https://github.com/Cap-go/capacitor-stripe-pay.git
cd capacitor-stripe-pay/example-app
bun install
bun run start

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