搜索插件、代码仓与 APP 分类

插件详情v1.2.3

stripe_native

使用 Apple 和 Google Pay 创建可收费的 Stripe 令牌。显示原生的 Apple 和 Google Pay 表单,然后收集一次性源令牌。

近 30 天下载
30
喜欢数
26
Pub 分数
40

安装插件

flutter pub add stripe_native

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

stripe_native 包使 Flutter 应用程序能够使用 Apple Pay 和 Google Pay 创建可收费的 Stripe 令牌。它提供原生支付表单集成,允许用户通过设备内置的支付系统安全地授权付款。在用户批准后,该包会收集一次性源令牌,用于 Stripe 交易。专为无缝结账体验设计,它利用平台特定 API,无需自定义 UI 实现。该包非常适合需要安全、原生支付流程且设置简单的应用程序。

适合场景

  • 通过 Apple Pay 的一次性付款
  • 通过 Google Pay 的一次性付款
  • Stripe 的安全令牌生成
  • 原生结账集成
  • 移动电子商务应用
  • 应用内购买

主要特点

  • 原生 Apple Pay 集成
  • 原生谷歌支付集成
  • 一次性源令牌收集
  • 最小化UI自定义
  • 平台特定的支付表单
  • 安全支付处理

适合对象

  • 电子商务移动应用
  • 基于订阅的服务
  • 需要安全支付的应用
  • 使用 Stripe 的开发者
  • 支持 Apple/Google Pay 的项目

使用建议

  • 需要设置 Stripe 账户
  • 仅限 iOS 和 Android
  • 需要正确的商户配置
  • 依赖设备支付功能的可用性
  • 不适用于定期付款
  • 不支持网页平台

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Stripe Native

Create chargeable stripe tokens using Apple and Google Pay.

This plugin will give you easy access to the Apple and Google Pay payment sheets. And provide one-time source tokens that are used to create a Stripe Charge.

Apple Pay

Setup

Both (Required)

To begin one will need a Stripe project, from there collect a publishable key.

iOS (Required)

On the Apple Developer portal, one will need to create a merchant identifier. Then connect that identifier to the Stripe project.

From the Stripe dashboard, create a signing certificate to share with Apple, then upload the signed certificate to Stripe.

Merchant Identifier

Lastly, open the apps' iOS module. Add the newly created identifier to the project's signing capabilities.

Signing Capablities

Android (Optional)

On the Google Play console, add the merchant identifier to the app capabilites. This makes the merchant known to Google Pay. With it, users will not see a warning saying this app is an unidentified merchant.

Functions

Set Publishable Key

Prior to calling native pay, set the publishable key.

StripeNative.setPublishableKey("pk_test_yZuUz6Sqm83H4lA7SrlAvYCh003MvJiJlR");
Set Merchant Identifier

Prior to calling native pay, set the merchant identifier.

StripeNative.setMerchantIdentifier("merchant.rbii.stripe-example");
Set Currency Key

In order to change the currency, pass in an ISO currency code prior to opening a payment sheet. On iOS it also requires passing in a country code.

StripeNative.setCurrencyKey("EUR");
// Not required on Android
StripeNative.setCountryKey("FR");
Native-Pay

There are two ways to create a payment sheet. With a list of items and prices, or with some subtotal, tax and tip.

Both methods require a merchant name to display at the bottom of the sheet.

// subtotal, tax, tip, merchant name
var order = Order(5.50, 1.0, 2.0, "Some Store");
var token = await StripeNative.useNativePay(order);
const itemPrices = <String, double>{"Nice Hat": 5.00, "Used Hat" : 1.50};
var receipt = Receipt(itemPrices, "Hat Store");
var token = await StripeNative.useReceiptNativePay(receipt);
Confirm Payment (iOS)

On iOS the payment sheet spins and ends with a check or X depending on the result passed in. During the spinning, query an endpoint for a charge using the token. This function does not affect Android.

// call charge endpoint w/ token
const wasCharged = await AppAPI.charge(token, amount);
// then show success or failure
StripeNative.confirmPayment(wasCharged);

所属分类

源码仓库

使用此插件的项目

暂无相关数据。