A standalone Flutter kit for handling Google Pay™ (Only for Android)
To use the SDK the following requirements must be met:
- Visual Studio - InteliJ Idea
- Dart 2.7.1 or newer
- Flutter: >=2.5.0 or newer
dependencies:
tap_google_pay_kit_flutter: ^0.0.4To use GooglePay in your app , you will be required to do additional configuration as follows:
- In build.gradle file add
implementation "com.google.android.gms:play-services-wallet:18.1.3"- Ensure your min sdk is 21
minSdk 21
targetSdk 32- In Manifest file , Inside the <application tag do the below:
<meta-data
android:name="com.google.android.gsm.wallet.api.enabled"
android:value="true"
/>TapGooglePayKit should be set up. To set it up, add the following lines of code somewhere in your project and make sure they will be called before any usage of TapGooglePayKit.
/**
* Configure SDK.
*/
TapGooglePayKitFlutter.configureSDK(
secretKey: "sk_test_xxxxxxxxxxxxxxxxxx",
bundleId: "com.xxx.xxxxxxx",
countryCode: "US",
transactionCurrency: "USD",
sdkMode: SDKMode.Sandbox,
allowedMethods: AllowedMethods.ALL,
allowedCardNetworks: [AllowedCardNetworks.VISA.name],
gatewayID: "xxxxx",
gatewayMerchantID: "122xxxxx",
amount: "23",
sdkCallbackMode: SDKCallbackMode.GetGooglePayToken,
);sdkMode: SDKMode.SandboxYou can set the sdk mode into one of the following modes:
- Sandbox
dart SDKMode.Sandbox
Testing mode
- Production
dart SDKMode.Production
Production mode
AllowedMethods
allowedMethods: AllowedMethods.ALLYou can set the allowed methods into one of the following modes:
- PAN_ONLY
dart AllowedMethods.PAN_ONLY
- CRYPTOGRAM
dart AllowedMethods.CRYPTOGRAM
- ALL
dart AllowedMethods.ALL
AllowedCardNetworks
allowedCardNetworks: [AllowedCardNetworks.VISA.name]You can set the allowed card networks mode into one of the following modes:
- AMEX
dart AllowedCardNetworks.AMEX.name
- MASTERCARD
dart AllowedCardNetworks.MASTERCARD.name
- VISA
dart AllowedCardNetworks.VISA.name
GooglePayButtonType
googlePayButtonType: GooglePayButtonType.NORMAL_GOOGLE_PAYYou can set the google pay button type into one of the following types:
- BUY_WITH_GOOGLE_PAY
dart GooglePayButtonType.BUY_WITH_GOOGLE_PAY
- DONATE_WITH_GOOGLE_PAY
dart GooglePayButtonType.DONATE_WITH_GOOGLE_PAY
- NORMAL_GOOGLE_PAY
dart GooglePayButtonType.NORMAL_GOOGLE_PAY
- PAY_WITH_GOOGLE_PAY
dart GooglePayButtonType.PAY_WITH_GOOGLE_PAY
- SUBSCRIBE_WITH_GOOGLE_PAY
dart GooglePayButtonType.SUBSCRIBE_WITH_GOOGLE_PAY
- CHECKOUT_WITH_GOOGLE_PAY
dart GooglePayButtonType.CHECKOUT_WITH_GOOGLE_PAY
- ORDER_WITH_GOOGLE_PAY
dart GooglePayButtonType.ORDER_WITH_GOOGLE_PAY
- BOOK_WITH_GOOGLE_PAY
dart GooglePayButtonType.BOOK_WITH_GOOGLE_PAY
Google Pay Button Widget
TapGooglePayKitFlutter.googlePayButton(
googlePayButtonType: GooglePayButtonType.NORMAL_GOOGLE_PAY,
onTap: () {
// Call available SDK Methods
},
),Get Google Pay Token
var tapGooglePaySDKResult = await TapGooglePayKitFlutter.getGooglePayToken;Get Tap Token
var tapTokenSDKResult = await TapGooglePayKitFlutter.getTapToken;