MobiPayGooglePayButton class
Native-style Google Pay button that:
- Hides itself unless Google Pay is available on this device (Android only).
- On tap, presents the native Google Pay sheet (which collects the FULL billing address, phone, and email itself - Google enforces them in-sheet, so there is no Apple-style missing-field gap).
- Submits the resulting payment token to Mobibox as an S2S CARD
action=SALE&digital_wallet=googlepayrequest.
Mirrors MobiPayApplePayButton's API (callbacks, payer fallbacks,
enabled cross-locking) so MobiPayCheckout treats both wallets
identically. Only one of the two is ever visible on a given device:
Apple Pay is iOS-only, Google Pay is Android-only.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MobiPayGooglePayButton
Constructors
-
MobiPayGooglePayButton({Key? key, required MobiPay mobiPay, required MobiPayGooglePayConfig config, required String orderNumber, required String orderAmount, required String orderCurrency, required String orderDescription, required String returnUrl, String? payerIp, String? payerEmail, String? payerFirstName, String? payerLastName, String? payerAddress, String? payerCity, String? payerZip, String? payerState, String? payerCountry, String? payerPhone, double height = 48, BorderRadius? borderRadius, bool enabled = true, Color backgroundColor = Colors.white, Color foregroundColor = Colors.black, bool showDividerWhenAvailable = false, String dividerLabel = 'Or pay using', void onTransactionInitiated(MobiPayTransactionResult result)?, void onTransactionComplete(MobiPayTransactionResult result)?, void onTransactionFailed(MobiPayTransactionResult result)?, void onRedirectRequired(String url, List<
Map< ? redirectParams)?, void onError(Exception e)?, void onCancel()?, void onProcessingChanged(bool isProcessing)?})String, dynamic> > -
const
Properties
- backgroundColor → Color
-
Button fill color. Defaults to white (matching the Apple Pay button's
default and this package's dark checkout sheet) - use black instead
when placing it on a light background.
final
- borderRadius → BorderRadius?
-
final
- config → MobiPayGooglePayConfig
-
final
- dividerLabel → String
-
final
- enabled → bool
-
When
false, the button is shown but disabled (dimmed, taps ignored) - set while another payment method is in flight.final - foregroundColor → Color
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mobiPay → MobiPay
-
final
- onCancel → void Function()?
-
Called when the payer dismisses the Google Pay sheet without paying.
final
- onError → void Function(Exception e)?
-
final
- onProcessingChanged → void Function(bool isProcessing)?
-
Called with
trueright before the sheet / SALE request starts, andfalseonce it settles.final -
onRedirectRequired
→ void Function(String url, List<
Map< ? redirectParams)?String, dynamic> > -
Called when Mobibox requires a redirect (e.g. 3DS).
final
- onTransactionComplete → void Function(MobiPayTransactionResult result)?
-
final
- onTransactionFailed → void Function(MobiPayTransactionResult result)?
-
final
- onTransactionInitiated → void Function(MobiPayTransactionResult result)?
-
final
- orderAmount → String
-
final
- orderCurrency → String
-
final
- orderDescription → String
-
final
- orderNumber → String
-
final
- payerAddress → String?
-
final
- payerCity → String?
-
final
- payerCountry → String?
-
final
- payerEmail → String?
-
Fallback payer fields, used only for whichever of first/last name,
address, city, zip, state, country, phone, email Google Pay's sheet
didn't return. In practice Google returns all of them (it enforces
them in-sheet), so these mostly matter for defensive completeness.
final
- payerFirstName → String?
-
final
- payerIp → String?
-
Customer's IP address. If omitted, a best-effort public IP lookup is
performed (https://api.ipify.org).
final
- payerLastName → String?
-
final
- payerPhone → String?
-
final
- payerState → String?
-
final
- payerZip → String?
-
final
- returnUrl → String
-
Sent as S2S CARD's
term_url_3ds(required on every request).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showDividerWhenAvailable → bool
-
When
true, an "Or pay using" divider is rendered directly below the button, hidden together with it when Google Pay isn't available.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MobiPayGooglePayButton> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited