pay
4.0.0, released 2 weeks ago by google.dev
Integrate Apple Pay on iOS and Google Pay on Android with ready-made buttons.
What it does
Provides unified Flutter support for Apple Pay and Google Pay. It includes prebuilt, guideline-compliant payment buttons as well as lower-level client APIs to verify payment availability and request payment tokens. The resulting payment tokens can then be passed to a backend or payment processor.
AI-written summary of version 4.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to offer Apple Pay on iOS and Google Pay on Android for digital or physical purchases.
- You need standard branded Google Pay and Apple Pay button widgets that handle user payment triggers.
- You want a client-side wrapper to obtain payment tokens without implementing native PassKit or Google Pay SDKs manually.
Skip it when
- Selling digital goods governed by Google Play or App Store In-App Purchase policies (use in_app_purchase instead).
- Targeting platforms other than Android and iOS, such as web or desktop.
- You want an all-in-one payment processing solution that directly charges cards without a separate payment gateway.
Strengths
- Official style and guideline compliance for Apple Pay and Google Pay buttons.
- Provides both easy prebuilt widgets (GooglePayButton, ApplePayButton) and low-level imperative client control (Pay).
- Supports loading configuration profiles directly from JSON strings or asset files.
Weaknesses
- Requires substantial merchant and certificate configuration outside Flutter with Apple and Google.
- Advanced Android integrations require manual EventChannel setup to handle lifecycle recreation results.
- Does not process the transaction itself; only obtains payment tokens that must be sent to your PSP.
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 5
Requires setting up Apple Developer merchant IDs and payment processing certificates for Apple Pay, and signing up for the Google Pay Business Console with integration approval for Android.
GooglePayButton(
paymentConfiguration: PaymentConfiguration.fromJsonString(defaultGooglePayConfigString),
paymentItems: const [
PaymentItem(
label: 'Total',
amount: '99.99',
status: PaymentItemStatus.final_price,
)
],
type: GooglePayButtonType.buy,
onPaymentResult: (result) {
// Send token to your server or PSP
},
loadingIndicator: const Center(child: CircularProgressIndicator()),
)Alternatives
Packages that do the same job and could replace pay.
- flutter_stripe
Pick if you want a complete Stripe processing pipeline including cards, Apple Pay, and Google Pay in one SDK.
92Compare
Works with
Packages commonly used together with pay: ones it builds on, ones built on it, and its own family.