A Flutter project showcasing how to integrate WebView-based e-commerce functionality with the BlinkPay payment gateway. This project demonstrates a mobile implementation of BlinkPay's payment system using Flutter's WebView capabilities and deep linking for seamless payment flow.
- Flutter: Cross-platform framework for building mobile applications
- WebView: For rendering web-based payment interfaces
- Deep Linking: To handle payment callbacks and app navigation
- BlinkPay: Secure payment gateway integration for processing payments
Ensure you have the following installed:
- Flutter SDK (latest stable version)
- Android Studio or VS Code with Flutter extensions
- Xcode (for iOS development, macOS only)
- Git
- A BlinkPay Account (for processing payments)
- Clone the Repository:
git clone https://github.com/BlinkPay/blinkpay_flutter_mobile_app_demo
cd blinkpay_flutter_mobile_app_demo
- Install Dependencies:
flutter pub get
- Open Android Studio
- Install the Flutter and Dart plugins
- Configure an Android device or emulator
- Verify USB debugging is enabled if using a physical device
- Install Xcode from the Mac App Store
- Configure an iOS simulator or device
- Install CocoaPods if not already installed:
sudo gem install cocoapods
- Log into BlinkPay Merchant Portal
- Navigate to your app under Settings/API
- Add your Redirect URI e.g.
blinkpay://test-app/return
to your whitelist redirect URLs and save - Copy the API key and generate a new secret using "Rotate Secret"
Create a .env
file at the root of your project:
BLINKPAY_API_URL=https://sandbox.debit.blinkpay.co.nz # Use https://debit.blinkpay.co.nz for production
BLINKPAY_CLIENT_ID=<your_blinkpay_api_key>
BLINKPAY_CLIENT_SECRET=<your_blinkpay_secret>
APP_REDIRECT_URI=blinkpay://test-app/return
The below lists general app configurations needed to connect to our API and use the service. These have already been included in the codebase but are noted here in case you are creating your own app.
<!-- Add this permission at the top level -->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- Add this queries section for URL handling capability -->
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
If you're using a custom URL scheme for payment redirects (e.g., blinkpay://
), you'll need to add the following configurations to your app:
<!-- Inside the <activity> tag, add this intent filter for URL scheme handling -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="blinkpay" android:host="test-app" android:pathPrefix="/return"/>
</intent-filter>
Note: Replace with your actual bundle identifier.
If you're using a custom URL scheme for payment redirects (e.g., blinkpay://
), you'll need to add this URL scheme configuration to your ios/Runner/Info.plist
:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>blinkpay</string>
</array>
<key>CFBundleURLName</key>
<string>com.example.blinkpay</string>
</dict>
</array>
Note: Replace with your actual bundle identifier.
Before running the application, you need to set up your development environment with an emulator or physical device:
Ensure you have either:
- An Android emulator running (via Android Studio's Device Manager)
- An iOS simulator running (via Xcode's Developer Tools)
- A physical device connected with USB debugging enabled
See Flutter's device setup guides for macOS, Windows, or Linux.
Run the app in debug mode:
flutter run
We welcome contributions from the community! Your pull request will be reviewed by our team.
This project is licensed under the MIT License - see the LICENSE file for details.