├── ios ├── Assets │ └── .gitkeep ├── Classes │ ├── FlutterGooglePayPlugin.h │ └── FlutterGooglePayPlugin.m ├── .gitignore └── flutter_google_pay.podspec ├── android ├── .idea │ ├── .name │ ├── caches │ │ ├── gradle_models.ser │ │ └── build_file_checksums.ser │ ├── encodings.xml │ ├── vcs.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── gradle.xml ├── settings.gradle ├── gradle.properties ├── .gitignore ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── snail │ │ └── app │ │ └── flutter │ │ └── google │ │ └── pay │ │ ├── PaymentInfo.java │ │ └── FlutterGooglePayPlugin.java ├── build.gradle ├── gradlew.bat └── gradlew ├── example ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── java │ │ │ │ │ └── snail │ │ │ │ │ │ └── app │ │ │ │ │ │ └── flutter │ │ │ │ │ │ └── google │ │ │ │ │ │ └── flutter_google_pay_example │ │ │ │ │ │ └── MainActivity.java │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── AppDelegate.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ └── Podfile ├── .metadata ├── .gitignore ├── pubspec.yaml ├── README.md └── lib │ └── main.dart ├── .idea ├── encodings.xml ├── vcs.xml ├── misc.xml └── runConfigurations │ └── example_lib_main_dart.xml ├── .metadata ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── pubspec.yaml ├── README.md └── lib └── flutter_google_pay.dart /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/.idea/.name: -------------------------------------------------------------------------------- 1 | flutter_google_pay -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | package android 2 | 3 | rootProject.name = 'flutter_google_pay' 4 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableJetifier=true 3 | android.useAndroidX=true -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableJetifier=true 3 | android.useAndroidX=true -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/.idea/caches/gradle_models.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/android/.idea/caches/gradle_models.ser -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Classes/FlutterGooglePayPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FlutterGooglePayPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /android/.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/android/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeonidVeremchuk/flutter-google-pay/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 13 17:51:30 EEST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-milestone-1-all.zip 7 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations/example_lib_main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | pubspec.lock 7 | 8 | build/ 9 | lib/generated/ 10 | 11 | # IntelliJ 12 | *.iml 13 | .idea/workspace.xml 14 | .idea/tasks.xml 15 | .idea/gradle.xml 16 | .idea/assetWizardSettings.xml 17 | .idea/dictionaries 18 | .idea/libraries 19 | # Android Studio 3 in .gitignore file. 20 | .idea/caches 21 | .idea/modules.xml 22 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 23 | .idea/navEditor.xml -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.4 2 | 3 | * Added PaymentBuilder for building custom requests 4 | 5 | ## 0.1.3+3 6 | 7 | * Added more data about payment info 8 | 9 | ## 0.1.3+1 10 | 11 | * Example update 12 | 13 | ## 0.1.3 14 | 15 | * Fix bug with payment result. Added environment pros. Sample update 16 | 17 | ## 0.1.2+2 18 | 19 | * Remove annotation 20 | 21 | ## 0.1.2+1 22 | 23 | * Docs update 24 | 25 | ## 0.1.0 26 | 27 | * First version of Google Pay 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/snail/app/flutter/google/flutter_google_pay_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package snail.app.flutter.google.flutter_google_pay_example; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /android/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /android/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Leonid Veremchuk 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.3.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /ios/flutter_google_pay.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'flutter_google_pay' 6 | s.version = '0.0.1' 7 | s.summary = 'Flutter Google Pay' 8 | s.description = <<-DESC 9 | Flutter Google Pay 10 | DESC 11 | s.homepage = 'http://example.com' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Your Company' => 'email@example.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | 19 | s.ios.deployment_target = '8.0' 20 | end 21 | 22 | -------------------------------------------------------------------------------- /ios/Classes/FlutterGooglePayPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterGooglePayPlugin.h" 2 | 3 | @implementation FlutterGooglePayPlugin 4 | + (void)registerWithRegistrar:(NSObject*)registrar { 5 | FlutterMethodChannel* channel = [FlutterMethodChannel 6 | methodChannelWithName:@"flutter_google_pay" 7 | binaryMessenger:[registrar messenger]]; 8 | FlutterGooglePayPlugin* instance = [[FlutterGooglePayPlugin alloc] init]; 9 | [registrar addMethodCallDelegate:instance channel:channel]; 10 | } 11 | 12 | - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { 13 | if ([@"getPlatformVersion" isEqualToString:call.method]) { 14 | result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); 15 | } else { 16 | result(FlutterMethodNotImplemented); 17 | } 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'snail.app.flutter.google.flutter_google_pay' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.3.0' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 28 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | dependencies { 35 | implementation 'com.google.android.gms:play-services-wallet:18.0.0' 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_google_pay_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 10 | 14 | 21 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "snail.app.flutter.google.flutter_google_pay_example" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works+. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | api 'com.android.support:appcompat-v7:28.0.0' 59 | } 60 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_google_pay_example 2 | description: Demonstrates how to use the flutter_google_pay plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | # The following adds the Cupertino Icons font to your application. 13 | # Use with the CupertinoIcons class for iOS style icons. 14 | cupertino_icons: ^0.1.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | flutter_google_pay: 21 | path: ../ 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://www.dartlang.org/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # The following line ensures that the Material Icons font is 30 | # included with your application, so that you can use the icons in 31 | # the material Icons class. 32 | uses-material-design: true 33 | 34 | # To add assets to your application, add an assets section, like this: 35 | # assets: 36 | # - images/a_dot_burr.jpeg 37 | # - images/a_dot_ham.jpeg 38 | 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.dev/assets-and-images/#resolution-aware. 41 | 42 | # For details regarding adding assets from package dependencies, see 43 | # https://flutter.dev/assets-and-images/#from-packages 44 | 45 | # To add custom fonts to your application, add a fonts section here, 46 | # in this "flutter" section. Each entry in this list should have a 47 | # "family" key with the font family name, and a "fonts" key with a 48 | # list giving the asset and other descriptors for the font. For 49 | # example: 50 | # fonts: 51 | # - family: Schyler 52 | # fonts: 53 | # - asset: fonts/Schyler-Regular.ttf 54 | # - asset: fonts/Schyler-Italic.ttf 55 | # style: italic 56 | # - family: Trajan Pro 57 | # fonts: 58 | # - asset: fonts/TrajanPro.ttf 59 | # - asset: fonts/TrajanPro_Bold.ttf 60 | # weight: 700 61 | # 62 | # For details regarding fonts from package dependencies, 63 | # see https://flutter.dev/custom-fonts/#from-packages 64 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_google_pay 2 | description: Porting of Google Pay (a digital wallet platform and online payment system) to Flutter. 3 | version: 0.1.4 4 | author: Leonid Veremchuk 5 | homepage: https://github.com/LeonidVeremchuk 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | # For information on the generic Dart part of this file, see the 19 | # following page: https://www.dartlang.org/tools/pub/pubspec 20 | 21 | # The following section is specific to Flutter. 22 | flutter: 23 | # This section identifies this Flutter project as a plugin project. 24 | # The androidPackage and pluginClass identifiers should not ordinarily 25 | # be modified. They are used by the tooling to maintain consistency when 26 | # adding or updating assets for this project. 27 | plugin: 28 | androidPackage: snail.app.flutter.google.pay 29 | pluginClass: FlutterGooglePayPlugin 30 | 31 | # To add assets to your plugin package, add an assets section, like this: 32 | # assets: 33 | # - images/a_dot_burr.jpeg 34 | # - images/a_dot_ham.jpeg 35 | # 36 | # For details regarding assets in packages, see 37 | # https://flutter.dev/assets-and-images/#from-packages 38 | # 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.dev/assets-and-images/#resolution-aware. 41 | 42 | # To add custom fonts to your plugin package, add a fonts section here, 43 | # in this "flutter" section. Each entry in this list should have a 44 | # "family" key with the font family name, and a "fonts" key with a 45 | # list giving the asset and other descriptors for the font. For 46 | # example: 47 | # fonts: 48 | # - family: Schyler 49 | # fonts: 50 | # - asset: fonts/Schyler-Regular.ttf 51 | # - asset: fonts/Schyler-Italic.ttf 52 | # style: italic 53 | # - family: Trajan Pro 54 | # fonts: 55 | # - asset: fonts/TrajanPro.ttf 56 | # - asset: fonts/TrajanPro_Bold.ttf 57 | # weight: 700 58 | # 59 | # For details regarding fonts in packages, see 60 | # https://flutter.dev/custom-fonts/#from-packages 61 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | 2 | ```dart 3 | import 'package:flutter_google_pay/flutter_google_pay.dart'; 4 | 5 | _makeStripePayment() async { 6 | var environment = 'test'; // or 'production' 7 | 8 | if (!(await FlutterGooglePay.isAvailable(environment))) { 9 | _showToast(scaffoldContext, 'Google pay not available'); 10 | } else { 11 | PaymentItem pm = PaymentItem( 12 | stripeToken: 'pk_test_1IV5H8NyhgGYOeK6vYV3Qw8f', 13 | stripeVersion: "2018-11-08", 14 | currencyCode: "usd", 15 | amount: "0.10", 16 | gateway: 'stripe'); 17 | 18 | FlutterGooglePay.makePayment(pm).then((Result result) { 19 | if (result.status == ResultStatus.SUCCESS) { 20 | _showToast(scaffoldContext, 'Success'); 21 | } 22 | }).catchError((dynamic error) { 23 | _showToast(scaffoldContext, error.toString()); 24 | }); 25 | } 26 | } 27 | 28 | _makeCustomPayment() async { 29 | var environment = 'test'; // or 'production' 30 | 31 | if (!(await FlutterGooglePay.isAvailable(environment))) { 32 | _showToast(scaffoldContext, 'Google pay not available'); 33 | } else { 34 | ///docs https://developers.google.com/pay/api/android/guides/tutorial 35 | PaymentBuilder pb = PaymentBuilder() 36 | ..addGateway("example") 37 | ..addTransactionInfo("1.0", "USD") 38 | ..addAllowedCardAuthMethods(["PAN_ONLY", "CRYPTOGRAM_3DS"]) 39 | ..addAllowedCardNetworks( 40 | ["AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA"]) 41 | ..addBillingAddressRequired(true) 42 | ..addPhoneNumberRequired(true) 43 | ..addShippingAddressRequired(true) 44 | ..addShippingSupportedCountries(["US", "GB"]) 45 | ..addMerchantInfo("Example"); 46 | 47 | FlutterGooglePay.makeCustomPayment(pb.build()).then((Result result) { 48 | if (result.status == ResultStatus.SUCCESS) { 49 | _showToast(scaffoldContext, 'Success'); 50 | } else if (result.error != null) { 51 | _showToast(context, result.error); 52 | } 53 | }).catchError((error) { 54 | //TODO 55 | }); 56 | } 57 | } 58 | 59 | ``` 60 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 37 | # referring to absolute paths on developers' machines. 38 | system('rm -rf .symlinks') 39 | system('mkdir -p .symlinks/plugins') 40 | 41 | # Flutter Pods 42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 43 | if generated_xcode_build_settings.empty? 44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 45 | end 46 | generated_xcode_build_settings.map { |p| 47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 48 | symlink = File.join('.symlinks', 'flutter') 49 | File.symlink(File.dirname(p[:path]), symlink) 50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 51 | end 52 | } 53 | 54 | # Plugin Pods 55 | plugin_pods = parse_KV_file('../.flutter-plugins') 56 | plugin_pods.map { |p| 57 | symlink = File.join('.symlinks', 'plugins', p[:name]) 58 | File.symlink(p[:path], symlink) 59 | pod p[:name], :path => File.join(symlink, 'ios') 60 | } 61 | end 62 | 63 | post_install do |installer| 64 | installer.pods_project.targets.each do |target| 65 | target.build_configurations.each do |config| 66 | config.build_settings['ENABLE_BITCODE'] = 'NO' 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_google_pay 2 | [![pub](https://img.shields.io/pub/v/flutter_google_pay.svg)](https://pub.dev/packages/flutter_google_pay) 3 | 4 | Accept Payments with Android Pay using the [Payment Request API](https://developers.google.com/pay/api/android/overview). 5 | 6 | ## Usage 7 | 8 | ```dart 9 | import 'package:flutter_google_pay/flutter_google_pay.dart'; 10 | 11 | 12 | _makeStripePayment() async { 13 | var environment = 'test'; // or 'production' 14 | 15 | if (!(await FlutterGooglePay.isAvailable(environment))) { 16 | _showToast(scaffoldContext, 'Google pay not available'); 17 | } else { 18 | PaymentItem pm = PaymentItem( 19 | stripeToken: 'pk_test_1IV5H8NyhgGYOeK6vYV3Qw8f', 20 | stripeVersion: "2018-11-08", 21 | currencyCode: "usd", 22 | amount: "0.10", 23 | gateway: 'stripe'); 24 | 25 | FlutterGooglePay.makePayment(pm).then((Result result) { 26 | if (result.status == ResultStatus.SUCCESS) { 27 | _showToast(scaffoldContext, 'Success'); 28 | } 29 | }).catchError((dynamic error) { 30 | _showToast(scaffoldContext, error.toString()); 31 | }); 32 | } 33 | } 34 | 35 | _makeCustomPayment() async { 36 | var environment = 'test'; // or 'production' 37 | 38 | if (!(await FlutterGooglePay.isAvailable(environment))) { 39 | _showToast(scaffoldContext, 'Google pay not available'); 40 | } else { 41 | ///docs https://developers.google.com/pay/api/android/guides/tutorial 42 | PaymentBuilder pb = PaymentBuilder() 43 | ..addGateway("example") 44 | ..addTransactionInfo("1.0", "USD") 45 | ..addAllowedCardAuthMethods(["PAN_ONLY", "CRYPTOGRAM_3DS"]) 46 | ..addAllowedCardNetworks( 47 | ["AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA"]) 48 | ..addBillingAddressRequired(true) 49 | ..addPhoneNumberRequired(true) 50 | ..addShippingAddressRequired(true) 51 | ..addShippingSupportedCountries(["US", "GB"]) 52 | ..addMerchantInfo("Example"); 53 | 54 | FlutterGooglePay.makeCustomPayment(pb.build()).then((Result result) { 55 | if (result.status == ResultStatus.SUCCESS) { 56 | _showToast(scaffoldContext, 'Success'); 57 | } else if (result.error != null) { 58 | _showToast(context, result.error); 59 | } 60 | }).catchError((error) { 61 | //TODO 62 | }); 63 | } 64 | } 65 | 66 | ``` 67 | ### Doc for creating custom payment data: 68 | 69 | [Google Pay](https://developers.google.com/pay/api/android/guides/tutorial) 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_google_pay/flutter_google_pay.dart'; 3 | 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatefulWidget { 7 | @override 8 | _MyAppState createState() => _MyAppState(); 9 | } 10 | 11 | class _MyAppState extends State { 12 | BuildContext scaffoldContext; 13 | 14 | @override 15 | void initState() { 16 | super.initState(); 17 | } 18 | 19 | _makeStripePayment() async { 20 | var environment = 'test'; // or 'production' 21 | 22 | if (!(await FlutterGooglePay.isAvailable(environment))) { 23 | _showToast(scaffoldContext, 'Google pay not available'); 24 | } else { 25 | PaymentItem pm = PaymentItem( 26 | stripeToken: 'pk_test_1IV5H8NyhgGYOeK6vYV3Qw8f', 27 | stripeVersion: "2018-11-08", 28 | currencyCode: "usd", 29 | amount: "0.10", 30 | gateway: 'stripe'); 31 | 32 | FlutterGooglePay.makePayment(pm).then((Result result) { 33 | if (result.status == ResultStatus.SUCCESS) { 34 | _showToast(scaffoldContext, 'Success'); 35 | } 36 | }).catchError((dynamic error) { 37 | _showToast(scaffoldContext, error.toString()); 38 | }); 39 | } 40 | } 41 | 42 | _makeCustomPayment() async { 43 | var environment = 'test'; // or 'production' 44 | 45 | if (!(await FlutterGooglePay.isAvailable(environment))) { 46 | _showToast(scaffoldContext, 'Google pay not available'); 47 | } else { 48 | ///docs https://developers.google.com/pay/api/android/guides/tutorial 49 | PaymentBuilder pb = PaymentBuilder() 50 | ..addGateway("example") 51 | ..addTransactionInfo("1.0", "USD") 52 | ..addAllowedCardAuthMethods(["PAN_ONLY", "CRYPTOGRAM_3DS"]) 53 | ..addAllowedCardNetworks( 54 | ["AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA"]) 55 | ..addBillingAddressRequired(true) 56 | ..addPhoneNumberRequired(true) 57 | ..addShippingAddressRequired(true) 58 | ..addShippingSupportedCountries(["US", "GB"]) 59 | ..addMerchantInfo("Example"); 60 | 61 | FlutterGooglePay.makeCustomPayment(pb.build()).then((Result result) { 62 | if (result.status == ResultStatus.SUCCESS) { 63 | _showToast(scaffoldContext, 'Success'); 64 | } else if (result.error != null) { 65 | _showToast(context, result.error); 66 | } 67 | }).catchError((error) { 68 | //TODO 69 | }); 70 | } 71 | } 72 | 73 | @override 74 | Widget build(BuildContext context) { 75 | return MaterialApp( 76 | home: Scaffold( 77 | appBar: AppBar( 78 | title: const Text('Plugin example app'), 79 | ), 80 | body: Builder(builder: (context) { 81 | scaffoldContext = context; 82 | return Center( 83 | child: Column( 84 | children: [ 85 | FlatButton( 86 | onPressed: _makeStripePayment, 87 | child: Text('Stripe pay'), 88 | ), 89 | FlatButton( 90 | onPressed: _makeCustomPayment, 91 | child: Text('Custom pay'), 92 | ), 93 | ], 94 | )); 95 | })), 96 | ); 97 | } 98 | 99 | void _showToast(BuildContext context, String message) { 100 | final scaffold = Scaffold.of(context); 101 | scaffold.showSnackBar(SnackBar( 102 | content: Text(message), 103 | action: SnackBarAction( 104 | label: 'UNDO', 105 | onPressed: () {}, 106 | ), 107 | )); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /android/src/main/java/snail/app/flutter/google/pay/PaymentInfo.java: -------------------------------------------------------------------------------- 1 | package snail.app.flutter.google.pay; 2 | 3 | import com.google.android.gms.wallet.CardRequirements; 4 | import com.google.android.gms.wallet.PaymentDataRequest; 5 | import com.google.android.gms.wallet.PaymentMethodTokenizationParameters; 6 | import com.google.android.gms.wallet.TransactionInfo; 7 | import com.google.android.gms.wallet.WalletConstants; 8 | 9 | import java.util.Arrays; 10 | 11 | final class PaymentInfo { 12 | private String mTotalPrice; 13 | private String mCurrencyCode; 14 | private String mGateway; 15 | private String mStripeToken; 16 | private String mStripeVersion; 17 | 18 | PaymentInfo() { 19 | } 20 | 21 | PaymentInfo setTotalPrice(String mTotalPrice) { 22 | this.mTotalPrice = mTotalPrice; 23 | return this; 24 | } 25 | 26 | PaymentInfo setCurrencyCode(String mCurrencyCode) { 27 | this.mCurrencyCode = mCurrencyCode; 28 | return this; 29 | } 30 | 31 | PaymentInfo setGateway(String mGateway) { 32 | this.mGateway = mGateway; 33 | return this; 34 | } 35 | 36 | PaymentInfo setStripeToken(String mStripeToken) { 37 | this.mStripeToken = mStripeToken; 38 | return this; 39 | } 40 | 41 | PaymentInfo setStripeVersion(String mStripeVersion) { 42 | this.mStripeVersion = mStripeVersion; 43 | return this; 44 | } 45 | 46 | 47 | private PaymentMethodTokenizationParameters createTokenizationParameters() { 48 | PaymentMethodTokenizationParameters.Builder builder = PaymentMethodTokenizationParameters.newBuilder() 49 | .setPaymentMethodTokenizationType(WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY); 50 | if (mGateway != null) { 51 | builder.addParameter("gateway", mGateway); 52 | } 53 | if (mStripeToken != null) { 54 | builder.addParameter("stripe:publishableKey", mStripeToken); 55 | } 56 | 57 | if (mStripeVersion != null) { 58 | builder.addParameter("stripe:version", mStripeVersion); 59 | } 60 | return builder.build(); 61 | } 62 | 63 | PaymentDataRequest createPaymentDataRequest(boolean withTokenizationParameters) { 64 | PaymentDataRequest.Builder request = 65 | PaymentDataRequest.newBuilder() 66 | .setTransactionInfo( 67 | TransactionInfo.newBuilder() 68 | .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL) 69 | .setTotalPrice(mTotalPrice) 70 | .setCurrencyCode(mCurrencyCode) 71 | .build()) 72 | .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD) 73 | .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD) 74 | .setCardRequirements( 75 | CardRequirements.newBuilder() 76 | .addAllowedCardNetworks(Arrays.asList( 77 | WalletConstants.CARD_NETWORK_AMEX, 78 | WalletConstants.CARD_NETWORK_DISCOVER, 79 | WalletConstants.CARD_NETWORK_VISA, 80 | WalletConstants.CARD_NETWORK_MASTERCARD)) 81 | .build()); 82 | if (withTokenizationParameters) { 83 | request.setPaymentMethodTokenizationParameters(createTokenizationParameters()); 84 | } 85 | return request.build(); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /android/src/main/java/snail/app/flutter/google/pay/FlutterGooglePayPlugin.java: -------------------------------------------------------------------------------- 1 | package snail.app.flutter.google.pay; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.text.TextUtils; 6 | import android.util.Log; 7 | 8 | import com.google.android.gms.common.api.Status; 9 | import com.google.android.gms.tasks.OnCompleteListener; 10 | import com.google.android.gms.tasks.Task; 11 | import com.google.android.gms.wallet.AutoResolveHelper; 12 | import com.google.android.gms.wallet.IsReadyToPayRequest; 13 | import com.google.android.gms.wallet.PaymentData; 14 | import com.google.android.gms.wallet.PaymentDataRequest; 15 | import com.google.android.gms.wallet.PaymentsClient; 16 | import com.google.android.gms.wallet.Wallet; 17 | import com.google.android.gms.wallet.WalletConstants; 18 | 19 | import org.json.JSONException; 20 | import org.json.JSONObject; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | import io.flutter.plugin.common.MethodCall; 26 | import io.flutter.plugin.common.MethodChannel; 27 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler; 28 | import io.flutter.plugin.common.MethodChannel.Result; 29 | import io.flutter.plugin.common.PluginRegistry; 30 | import io.flutter.plugin.common.PluginRegistry.Registrar; 31 | 32 | /** 33 | * FlutterGooglePayPlugin 34 | */ 35 | public class FlutterGooglePayPlugin implements MethodCallHandler, PluginRegistry.ActivityResultListener { 36 | private static final String CHANNEL_NAME = "flutter_google_pay"; 37 | private final String METHOD_REQUEST_PAYMENT = "request_payment"; 38 | private final String METHOD_REQUEST_CUSTOM_PAYMENT = "request_payment_custom_payment"; 39 | private final String METHOD_IS_AVAILABLE = "is_available"; 40 | private final String KEY_METHOD = "method_name"; 41 | 42 | private Result mLastResult; 43 | private MethodCall mLastMethodCall; 44 | /** 45 | * Arbitrarily-picked constant integer you define to track a request for payment data activity. 46 | * 47 | * @value #LOAD_PAYMENT_DATA_REQUEST_CODE 48 | */ 49 | private static final int LOAD_PAYMENT_DATA_REQUEST_CODE = 991; 50 | /** 51 | * A client for interacting with the Google Pay API. 52 | * 53 | * @see PaymentsClient 55 | */ 56 | private PaymentsClient mPaymentsClient; 57 | private Activity mActivity; 58 | 59 | private FlutterGooglePayPlugin(Activity activity) { 60 | this.mActivity = activity; 61 | } 62 | 63 | private PaymentsClient client() { 64 | if (mPaymentsClient == null) { 65 | String environment = String.valueOf(mLastMethodCall.argument("environment")); 66 | int env = WalletConstants.ENVIRONMENT_TEST; 67 | if (environment.equals("production")) { 68 | env = WalletConstants.ENVIRONMENT_PRODUCTION; 69 | } 70 | mPaymentsClient = 71 | Wallet.getPaymentsClient(mActivity, 72 | new Wallet.WalletOptions.Builder().setEnvironment(env) 73 | .build()); 74 | } 75 | return mPaymentsClient; 76 | } 77 | 78 | /** 79 | * Plugin registration. 80 | */ 81 | public static void registerWith(Registrar registrar) { 82 | final MethodChannel channel = new MethodChannel(registrar.messenger(), CHANNEL_NAME); 83 | FlutterGooglePayPlugin plugin = new FlutterGooglePayPlugin(registrar.activity()); 84 | registrar.addActivityResultListener(plugin); 85 | channel.setMethodCallHandler(plugin); 86 | } 87 | 88 | @Override 89 | public void onMethodCall(MethodCall call, Result result) { 90 | mLastMethodCall = call; 91 | mLastResult = result; 92 | switch (call.method) { 93 | case METHOD_REQUEST_PAYMENT: 94 | this.requestPayment(); 95 | break; 96 | case METHOD_IS_AVAILABLE: 97 | this.checkIsGooglePayAvailable(); 98 | break; 99 | case (METHOD_REQUEST_CUSTOM_PAYMENT): 100 | this.requestPaymentCustom(); 101 | break; 102 | } 103 | } 104 | 105 | /** 106 | * PaymentData response object contains the payment information, as well as any additional 107 | * requested information, such as billing and shipping address. 108 | * 109 | * @param paymentData A response object returned by Google after a payer approves payment. 110 | * @see Payment 112 | * Data 113 | */ 114 | private void callToDartOnPaymentSuccess(PaymentData paymentData) { 115 | String paymentInfo = paymentData.toJson(); 116 | Map data = new HashMap<>(); 117 | data.put("status", paymentInfo != null ? "SUCCESS" : "UNKNOWN"); 118 | if (paymentInfo != null) { 119 | data.put("result", paymentInfo); 120 | } 121 | mLastResult.success(data); 122 | } 123 | 124 | private void callToDartOnGooglePayIsAvailable(boolean isAvailable) { 125 | if (mLastResult != null) { 126 | Map data = new HashMap<>(); 127 | data.put(KEY_METHOD, METHOD_IS_AVAILABLE); 128 | data.put("isAvailable", isAvailable); 129 | mLastResult.success(data); 130 | mLastResult = null; 131 | } 132 | } 133 | 134 | private void callToDartOnError(String error) { 135 | if (mLastResult != null) { 136 | Map data = new HashMap<>(); 137 | data.put("error", error); 138 | mLastResult.success(data); 139 | mLastResult = null; 140 | } 141 | } 142 | 143 | private void callToDartOnError(Status status) { 144 | if (mLastResult != null) { 145 | Map data = new HashMap<>(); 146 | if (status != null) { 147 | String statusMessage = status.getStatusMessage(); 148 | if (TextUtils.isEmpty(statusMessage)) { 149 | statusMessage = "payment error"; 150 | } 151 | int code = status.getStatusCode(); 152 | String statusCode; 153 | switch (code) { 154 | case 8: 155 | statusCode = "RESULT_INTERNAL_ERROR"; 156 | break; 157 | case 10: 158 | statusCode = "DEVELOPER_ERROR"; 159 | break; 160 | case 15: 161 | statusCode = "RESULT_TIMEOUT"; 162 | break; 163 | case 16: 164 | statusCode = "RESULT_CANCELED"; 165 | break; 166 | case 18: 167 | statusCode = "RESULT_DEAD_CLIENT"; 168 | break; 169 | default: 170 | statusCode = "UNKNOWN"; 171 | } 172 | 173 | data.put("error", statusMessage); 174 | data.put("status", statusCode); 175 | data.put("description", status.toString()); 176 | } else { 177 | data.put("error", "Wrong payment data"); 178 | data.put("status", "UNKNOWN"); 179 | data.put("description", "Payment finished without additional information"); 180 | } 181 | mLastResult.success(data); 182 | mLastResult = null; 183 | } 184 | } 185 | 186 | private void callToDartOnCanceled() { 187 | if (mLastResult != null) { 188 | Map data = new HashMap<>(); 189 | data.put("status", "RESULT_CANCELED"); 190 | data.put("description", "Canceled by user"); 191 | mLastResult.success(data); 192 | mLastResult = null; 193 | } 194 | } 195 | 196 | private void requestPaymentCustom() { 197 | try { 198 | JSONObject paymentData = new JSONObject((Map)mLastMethodCall.arguments); 199 | PaymentDataRequest request = 200 | PaymentDataRequest.fromJson(paymentData.toString()); 201 | this.makePayment(request); 202 | } catch (Exception e) { 203 | callToDartOnError(e.getMessage()); 204 | } 205 | } 206 | 207 | private void requestPayment() { 208 | String amount = mLastMethodCall.argument("amount"); 209 | String currencyCode = mLastMethodCall.argument("currencyCode"); 210 | String gateway = mLastMethodCall.argument("gateway"); 211 | String stripeToken = mLastMethodCall.argument("stripeToken"); 212 | String stripeVersion = mLastMethodCall.argument("stripeVersion"); 213 | 214 | PaymentInfo paymentInfo = new PaymentInfo(); 215 | paymentInfo.setTotalPrice(amount) 216 | .setCurrencyCode(currencyCode) 217 | .setGateway(gateway) 218 | .setStripeToken(stripeToken) 219 | .setStripeVersion(stripeVersion); 220 | 221 | PaymentDataRequest request = 222 | paymentInfo.createPaymentDataRequest(!TextUtils.isEmpty(stripeToken)); 223 | this.makePayment(request); 224 | } 225 | 226 | private void makePayment(PaymentDataRequest request) { 227 | // Since loadPaymentData may show the UI asking the user to select a payment method, we use 228 | // AutoResolveHelper to wait for the user interacting with it. Once completed, 229 | // onActivityResult will be called with the result. 230 | if (request != null) { 231 | Task task = client().loadPaymentData(request); 232 | AutoResolveHelper.resolveTask(task, mActivity, LOAD_PAYMENT_DATA_REQUEST_CODE); 233 | } 234 | } 235 | 236 | /** 237 | * Determine the viewer's ability to pay with a payment method supported by your app and display a 238 | * Google Pay payment button. 239 | * 240 | * @see PaymentsClient#IsReadyToPay 242 | */ 243 | private void checkIsGooglePayAvailable() { 244 | IsReadyToPayRequest request = IsReadyToPayRequest.newBuilder() 245 | .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD) 246 | .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD) 247 | .build(); 248 | // The call to isReadyToPay is asynchronous and returns a Task. We need to provide an 249 | // OnCompleteListener to be triggered when the result of the call is known. 250 | Task task = client().isReadyToPay(request); 251 | task.addOnCompleteListener(mActivity, 252 | new OnCompleteListener() { 253 | @Override 254 | public void onComplete(Task task) { 255 | if (task.isSuccessful()) { 256 | callToDartOnGooglePayIsAvailable(true); 257 | 258 | } else { 259 | callToDartOnGooglePayIsAvailable(false); 260 | Log.w("isReadyToPay failed", task.getException()); 261 | } 262 | } 263 | }); 264 | } 265 | 266 | /** 267 | * Handle a resolved activity from the Google Pay payment sheet. 268 | * 269 | * @param requestCode Request code originally supplied to AutoResolveHelper in requestPayment(). 270 | * @param resultCode Result code returned by the Google Pay API. 271 | * @param data Intent from the Google Pay API containing payment or error data. 272 | * @see Getting a result 273 | * from an Activity 274 | */ 275 | @Override 276 | public boolean onActivityResult(int requestCode, int resultCode, Intent data) { 277 | if (requestCode == LOAD_PAYMENT_DATA_REQUEST_CODE) { 278 | switch (resultCode) { 279 | case Activity.RESULT_OK: 280 | PaymentData paymentData = PaymentData.getFromIntent(data); 281 | if (paymentData != null) { 282 | this.callToDartOnPaymentSuccess(paymentData); 283 | } 284 | return true; 285 | case Activity.RESULT_CANCELED: 286 | this.callToDartOnCanceled(); 287 | return true; 288 | case AutoResolveHelper.RESULT_ERROR: 289 | Status status = AutoResolveHelper.getStatusFromIntent(data); 290 | this.callToDartOnError(status); 291 | return true; 292 | } 293 | } 294 | return false; 295 | } 296 | 297 | } 298 | -------------------------------------------------------------------------------- /lib/flutter_google_pay.dart: -------------------------------------------------------------------------------- 1 | import "dart:async"; 2 | import 'dart:convert'; 3 | import "dart:io"; 4 | 5 | import 'package:flutter/foundation.dart'; 6 | import "package:flutter/services.dart"; 7 | 8 | class FlutterGooglePay { 9 | static const MethodChannel _channel = 10 | const MethodChannel("flutter_google_pay"); 11 | 12 | static Future makePayment(PaymentItem data) async { 13 | return _call("request_payment", data.toMap()); 14 | } 15 | 16 | static Future makeCustomPayment(Map data) async { 17 | return _call("request_payment_custom_payment", data); 18 | } 19 | 20 | static Future _call(String methodName, dynamic data) async { 21 | Result result = 22 | await _channel.invokeMethod(methodName, data).then((dynamic data) { 23 | return _parseResult(data); 24 | }).catchError((dynamic error) { 25 | return Result(error?.toString() ?? 'unknow error', null, 26 | ResultStatus.ERROR, (error?.toString()) ?? ""); 27 | }); 28 | if (result != null) { 29 | return result; 30 | } 31 | return Result('unknow', null, ResultStatus.UNKNOWN, ""); 32 | } 33 | 34 | static Future isAvailable(String environment) async { 35 | if (!Platform.isAndroid) { 36 | return false; 37 | } 38 | try { 39 | Map map = await _channel 40 | .invokeMethod("is_available", {"environment": environment}); 41 | return map['isAvailable']; 42 | } catch (error) { 43 | return false; 44 | } 45 | } 46 | 47 | static Result _parseResult(dynamic map) { 48 | var error = map['error']; 49 | var status = map['status']; 50 | var result = map['result']; 51 | var description = map["description"]; 52 | if (result != null) { 53 | result = json.decode(result); 54 | } 55 | ResultStatus resultStatus; 56 | if (error != null) { 57 | resultStatus = ResultStatus.ERROR; 58 | } else if (status != null) { 59 | resultStatus = parseStatus(status); 60 | } else if (result != null) { 61 | resultStatus = ResultStatus.SUCCESS; 62 | } else { 63 | resultStatus = ResultStatus.UNKNOWN; 64 | } 65 | return Result(error, result, resultStatus, description); 66 | } 67 | 68 | static ResultStatus parseStatus(String status) { 69 | switch (status) { 70 | case "SUCCESS": 71 | return ResultStatus.SUCCESS; 72 | case "ERROR": 73 | return ResultStatus.ERROR; 74 | case "RESULT_CANCELED": 75 | return ResultStatus.RESULT_CANCELED; 76 | case "RESULT_INTERNAL_ERROR": 77 | return ResultStatus.RESULT_INTERNAL_ERROR; 78 | case "DEVELOPER_ERROR": 79 | return ResultStatus.DEVELOPER_ERROR; 80 | case "RESULT_TIMEOUT": 81 | return ResultStatus.RESULT_TIMEOUT; 82 | case "RESULT_DEAD_CLIENT": 83 | return ResultStatus.RESULT_DEAD_CLIENT; 84 | default: 85 | return ResultStatus.UNKNOWN; 86 | } 87 | } 88 | } 89 | 90 | class PaymentItem { 91 | String currencyCode; 92 | String amount; 93 | String gateway; 94 | String stripeToken; 95 | String stripeVersion; 96 | 97 | PaymentItem( 98 | {@required this.currencyCode, 99 | @required this.amount, 100 | @required this.gateway, 101 | @required this.stripeToken, 102 | @required this.stripeVersion}); 103 | 104 | Map toMap() { 105 | Map args = Map(); 106 | args["amount"] = amount; 107 | args["currencyCode"] = currencyCode; 108 | if (!_validateAmount(amount)) { 109 | throw Exception("Wrong amount: ${amount ?? "unknow"}"); 110 | } 111 | if (!_validateCurrencyCode(currencyCode)) { 112 | throw Exception("Wrong currency code: ${currencyCode ?? "unknow"}"); 113 | } 114 | 115 | args["gateway"] = gateway; 116 | args["stripeToken"] = stripeToken; 117 | args["stripeVersion"] = stripeVersion; 118 | 119 | return args; 120 | } 121 | } 122 | 123 | enum ResultStatus { 124 | SUCCESS, 125 | ERROR, 126 | RESULT_CANCELED, 127 | RESULT_INTERNAL_ERROR, 128 | DEVELOPER_ERROR, 129 | RESULT_TIMEOUT, 130 | RESULT_DEAD_CLIENT, 131 | UNKNOWN, 132 | } 133 | 134 | class Result { 135 | String error; 136 | String description; 137 | Map data; 138 | ResultStatus status; 139 | 140 | Result(this.error, this.data, this.status, this.description); 141 | } 142 | 143 | bool _validateAmount(dynamic amount) { 144 | return (amount?.toString() ?? "").length > 0 ?? false; 145 | } 146 | 147 | bool _validateCurrencyCode(dynamic currencyCode) { 148 | bool isNotEmpty = (currencyCode?.toString() ?? "").length > 0 ?? false; 149 | if (!isNotEmpty) { 150 | return false; 151 | } 152 | 153 | // String lowerCaseCode = currencyCode.toString().toLowerCase(); 154 | //TODO currency check 155 | return true; 156 | } 157 | 158 | class PaymentBuilder { 159 | Map _gatewayTokenizationSpecification; 160 | Map _directTokenizationSpecification; 161 | Map _transactionInfo; 162 | Map _merchantInfo; 163 | List _allowedCardNetworks; 164 | List _allowedCardAuthMethods; 165 | List _shippingSupportedCountries; 166 | bool _billingAddressRequired; 167 | bool _shippingAddressRequired; 168 | bool _phoneNumberRequred; 169 | 170 | /// An object describing information requested in a Google Pay payment sheet 171 | /// 172 | /// @return Payment data expected by your app. 173 | Map build() { 174 | Map paymentDataRequest = _baseRequest; 175 | paymentDataRequest["allowedPaymentMethods"] = [_cardPaymentMethod]; 176 | if (_transactionInfo == null) { 177 | throw Exception('Please provide transaction info'); 178 | } 179 | paymentDataRequest["transactionInfo"] = _transactionInfo; 180 | if (_merchantInfo != null) { 181 | paymentDataRequest["merchantInfo"] = _merchantInfo; 182 | } 183 | if (_shippingAddressRequired != null) { 184 | paymentDataRequest["shippingAddressRequired"] = _shippingAddressRequired; 185 | } 186 | Map shippingAddressParameters = Map(); 187 | if (_phoneNumberRequred != null) { 188 | shippingAddressParameters["phoneNumberRequired"] = _phoneNumberRequred; 189 | } 190 | if (_shippingSupportedCountries != null) { 191 | List allowedCountryCodes = _shippingSupportedCountries; 192 | shippingAddressParameters["allowedCountryCodes"] = allowedCountryCodes; 193 | paymentDataRequest["shippingAddressParameters"] = 194 | shippingAddressParameters; 195 | } 196 | return paymentDataRequest; 197 | } 198 | 199 | /// Gateway Integration: Identify your gateway and your app's gateway merchant identifier. 200 | /// * 201 | /// *

The Google Pay API response will return an encrypted payment method capable of being charged 202 | /// * by a supported gateway after payer authorization. 203 | /// * 204 | addGateway([String gateway, String gatewayMerchantId]) { 205 | if (_directTokenizationSpecification != null) { 206 | throw Exception( 207 | "You already set a DIRRECT. You can use DIRECT or Gateway."); 208 | } 209 | Map gateway = Map(); 210 | gateway["gateway"] = gateway; 211 | if (!isEmpty(gatewayMerchantId)) { 212 | gateway["gatewayMerchantId"] = gatewayMerchantId; 213 | } 214 | _gatewayTokenizationSpecification = { 215 | "type": "PAYMENT_GATEWAY", 216 | "parameters": gateway 217 | }; 218 | } 219 | 220 | /// {@code DIRECT} Integration: Decrypt a response directly on your servers. This configuration has 221 | /// additional data security requirements from Google and additional PCI DSS compliance complexity. 222 | /// 223 | ///

Please refer to the documentation for more information about {@code DIRECT} integration. The 224 | /// type of integration you use depends on your payment processor. 225 | addDirectTokenizationSpecification(String directTokenizationPublikKey, 226 | {String protocolVersion = "ECv2"}) { 227 | if (_gatewayTokenizationSpecification != null) { 228 | throw Exception( 229 | "You already set a gateway. You can use DIRECT or Gateway."); 230 | } 231 | if (isEmpty(directTokenizationPublikKey)) { 232 | throw Exception("Please add protocol version & public key."); 233 | } 234 | Map directTokenizationParameters = { 235 | "protocolVersion": protocolVersion, 236 | "publicKey": directTokenizationPublikKey 237 | }; 238 | _directTokenizationSpecification = { 239 | "type": "DIRECT", 240 | "parameters": directTokenizationParameters 241 | }; 242 | } 243 | 244 | /// Provide Google Pay API with a payment amount, currency, and amount status. 245 | addTransactionInfo(String price, String currencyCode) { 246 | _transactionInfo = { 247 | "totalPrice": price, 248 | "totalPriceStatus": "FINAL", 249 | "currencyCode": currencyCode, 250 | }; 251 | } 252 | 253 | /// Information about the merchant requesting payment information 254 | addMerchantInfo(String info) { 255 | _merchantInfo = {"merchantName": info}; 256 | } 257 | 258 | /// Card networks supported by your app and your gateway. 259 | /// Card networks: 260 | /// "AMEX", 261 | /// "DISCOVER", 262 | /// "JCB", 263 | /// "MASTERCARD", 264 | /// "VISA" 265 | addAllowedCardNetworks(List allowedCardNetworks) { 266 | if (allowedCardNetworks != null && allowedCardNetworks.length > 0) { 267 | _allowedCardNetworks = allowedCardNetworks; 268 | } 269 | } 270 | 271 | /// Card authentication methods supported by your app and your gateway. 272 | /// Card methods: 273 | /// "PAN_ONLY" 274 | /// "CRYPTOGRAM_3DS" 275 | /// 276 | /// The Google Pay API may return cards on file on Google.com (PAN_ONLY) and/or a device token on 277 | /// an Android device authenticated with a 3-D Secure cryptogram (CRYPTOGRAM_3DS). 278 | addAllowedCardAuthMethods(List allowedCardAuthMethods) { 279 | if (allowedCardAuthMethods != null && allowedCardAuthMethods.length > 0) { 280 | _allowedCardAuthMethods = allowedCardAuthMethods; 281 | } 282 | } 283 | 284 | /// Optionally, you can add billing address/phone number associated with a CARD payment method. 285 | /// 286 | /// Please, skipp this function call if no need to add this parameter. 287 | addBillingAddressRequired(bool required) { 288 | _billingAddressRequired = required; 289 | } 290 | 291 | /// An optional shipping address requirement is a top-level property 292 | /// 293 | /// Please, skipp this function call if no need to add this parameter. 294 | addShippingAddressRequired(bool required) { 295 | _shippingAddressRequired = required; 296 | } 297 | 298 | addPhoneNumberRequired(bool required) { 299 | _phoneNumberRequred = required; 300 | } 301 | 302 | /// Supported countries for shipping (use ISO 3166-1 alpha-2 country codes). Relevant only when 303 | /// requesting a shipping address. 304 | addShippingSupportedCountries(List shippingSupportedCountries) { 305 | if (shippingSupportedCountries != null && 306 | shippingSupportedCountries.length > 0) { 307 | _shippingSupportedCountries = shippingSupportedCountries; 308 | } 309 | } 310 | 311 | /// Create a Google Pay API base request object with properties used in all requests. 312 | /// @return Google Pay API base request object. 313 | Map get _baseRequest { 314 | return {"apiVersion": 2, "apiVersionMinor": 0}; 315 | } 316 | 317 | /// Describe your app's support for the CARD payment method. 318 | /// The provided properties are applicable to both an IsReadyToPayRequest and a 319 | /// PaymentDataRequest. 320 | /// 321 | /// @return A CARD PaymentMethod object describing accepted cards. 322 | Map get _baseCardPaymentMethod { 323 | Map cardPaymentMethod = Map(); 324 | cardPaymentMethod["type"] = "CARD"; 325 | Map parameters = new Map(); 326 | if (_allowedCardNetworks == null) { 327 | throw Exception("Please provide information about card networds"); 328 | } 329 | if (_allowedCardAuthMethods == null) { 330 | throw Exception("Please provide information about card auth methods"); 331 | } 332 | parameters["allowedAuthMethods"] = _allowedCardAuthMethods; 333 | parameters["allowedCardNetworks"] = _allowedCardNetworks; 334 | if (_billingAddressRequired != null) { 335 | parameters["billingAddressRequired"] = _billingAddressRequired; 336 | } 337 | Map billingAddressParameters = Map(); 338 | billingAddressParameters["format"] = "FULL"; 339 | parameters["billingAddressParameters"] = billingAddressParameters; 340 | cardPaymentMethod["parameters"] = parameters; 341 | return cardPaymentMethod; 342 | } 343 | 344 | /// Describe the expected returned payment data for the CARD payment method 345 | /// 346 | /// @return A CARD PaymentMethod describing accepted cards and optional fields. 347 | Map get _cardPaymentMethod { 348 | Map cardPaymentMethod = _baseCardPaymentMethod; 349 | if (_gatewayTokenizationSpecification != null || 350 | _directTokenizationSpecification != null) { 351 | cardPaymentMethod["tokenizationSpecification"] = 352 | _gatewayTokenizationSpecification ?? _directTokenizationSpecification; 353 | } 354 | return cardPaymentMethod; 355 | } 356 | } 357 | 358 | bool isEmpty(String value) { 359 | return value == null || value.length == 0; 360 | } 361 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 97C146EF1CF9000F007C117D /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 97C146EE1CF9000F007C117D /* Runner.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 97C146F01CF9000F007C117D /* Runner */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 106 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 107 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 108 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 109 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 110 | 97C147021CF9000F007C117D /* Info.plist */, 111 | 97C146F11CF9000F007C117D /* Supporting Files */, 112 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 113 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 114 | ); 115 | path = Runner; 116 | sourceTree = ""; 117 | }; 118 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 97C146F21CF9000F007C117D /* main.m */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | /* End PBXGroup section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | 97C146ED1CF9000F007C117D /* Runner */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 132 | buildPhases = ( 133 | 9740EEB61CF901F6004384FC /* Run Script */, 134 | 97C146EA1CF9000F007C117D /* Sources */, 135 | 97C146EB1CF9000F007C117D /* Frameworks */, 136 | 97C146EC1CF9000F007C117D /* Resources */, 137 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 138 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = Runner; 145 | productName = Runner; 146 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 97C146E61CF9000F007C117D /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 0910; 156 | ORGANIZATIONNAME = "The Chromium Authors"; 157 | TargetAttributes = { 158 | 97C146ED1CF9000F007C117D = { 159 | CreatedOnToolsVersion = 7.3.1; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = English; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 97C146E51CF9000F007C117D; 172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 97C146ED1CF9000F007C117D /* Runner */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 97C146EC1CF9000F007C117D /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Thin Binary"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 210 | }; 211 | 9740EEB61CF901F6004384FC /* Run Script */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Run Script"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 224 | }; 225 | /* End PBXShellScriptBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | 97C146EA1CF9000F007C117D /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 233 | 97C146F31CF9000F007C117D /* main.m in Sources */, 234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXVariantGroup section */ 241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 97C146FB1CF9000F007C117D /* Base */, 245 | ); 246 | name = Main.storyboard; 247 | sourceTree = ""; 248 | }; 249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 97C147001CF9000F007C117D /* Base */, 253 | ); 254 | name = LaunchScreen.storyboard; 255 | sourceTree = ""; 256 | }; 257 | /* End PBXVariantGroup section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | SDKROOT = iphoneos; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Profile; 307 | }; 308 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 309 | isa = XCBuildConfiguration; 310 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 314 | DEVELOPMENT_TEAM = S8QB4VV633; 315 | ENABLE_BITCODE = NO; 316 | FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(PROJECT_DIR)/Flutter", 319 | ); 320 | INFOPLIST_FILE = Runner/Info.plist; 321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 322 | LIBRARY_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "$(PROJECT_DIR)/Flutter", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = snail.app.flutter.google.flutterGooglePayExample; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 379 | MTL_ENABLE_DEBUG_INFO = YES; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | TARGETED_DEVICE_FAMILY = "1,2"; 383 | }; 384 | name = Debug; 385 | }; 386 | 97C147041CF9000F007C117D /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 408 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 409 | CLANG_WARN_STRICT_PROTOTYPES = YES; 410 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 97C147061CF9000F007C117D /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 440 | ENABLE_BITCODE = NO; 441 | FRAMEWORK_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 447 | LIBRARY_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | PRODUCT_BUNDLE_IDENTIFIER = snail.app.flutter.google.flutterGooglePayExample; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | VERSIONING_SYSTEM = "apple-generic"; 454 | }; 455 | name = Debug; 456 | }; 457 | 97C147071CF9000F007C117D /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 463 | ENABLE_BITCODE = NO; 464 | FRAMEWORK_SEARCH_PATHS = ( 465 | "$(inherited)", 466 | "$(PROJECT_DIR)/Flutter", 467 | ); 468 | INFOPLIST_FILE = Runner/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 470 | LIBRARY_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "$(PROJECT_DIR)/Flutter", 473 | ); 474 | PRODUCT_BUNDLE_IDENTIFIER = snail.app.flutter.google.flutterGooglePayExample; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | --------------------------------------------------------------------------------