flutter_iamport 0.0.2 flutter_iamport: ^0.0.2 copied to clipboard
A Flutter plugin for using the iamport for payment on Android and iOS.
flutter_iamport #
A Flutter plugin for using the iamport for payment on Android and iOS.
List of features #
- Nice pay
- Authenticate for phone
- Code optimization
Installation #
To get things up and running, you'll have to declare a pubspec dependency in your Flutter project. Also some minimal Android & iOS specific configuration must be done, otherise your app will crash.
On your Flutter project #
See the installation instructions on pub.
Seeting(Android) #
In order to use the iamport interworking module in iOS, you need to set the following items.
AndroidManifest permission
<uses-permission android:name="android.permission.INTERNET" />
<application
android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning"
android:icon="@mipmap/ic_launcher">
...
Seeting(IOS) #
In order to use the iamport interworking module in iOS, you have to set the following 3 items.
1. App Scheme Setting
You need to set the URL identifier to use when returning after payment in the external payment application (eg PACO, ShinhanPanPay).
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>flutter_iamport_example</string>
</array>
</dict>
</array>
2. Registration of external app list
3rd party app(example) You need to register your external apps list so that you can run it
<key>LSApplicationQueriesSchemes</key>
<array>
<string>kakao0123456789abcdefghijklmn</string>
<string>kakaokompassauth</string>
<string>storykompassauth</string>
<string>kakaolink</string>
<string>kakaotalk</string>
<string>kakaostory</string>
<string>storylink</string>
<string>payco</string>
<string>kftc-bankpay</string>
<string>ispmobile</string>
<string>itms-apps</string>
<string>hdcardappcardansimclick</string>
<string>smhyundaiansimclick</string>
<string>shinhan-sr-ansimclick</string>
<string>smshinhanansimclick</string>
<string>kb-acp</string>
<string>mpocket.online.ansimclick</string>
<string>ansimclickscard</string>
<string>ansimclickipcollect</string>
<string>vguardstart</string>
<string>samsungpay</string>
<string>scardcertiapp</string>
<string>lottesmartpay</string>
<string>lotteappcard</string>
<string>cloudpay</string>
<string>nhappvardansimclick</string>
<string>nonghyupcardansimclick</string>
<string>nhallonepayansimclick</string>
<string>citispay</string>
<string>citicardappkr</string>
<string>citimobileapp</string>
<string>itmss</string>
<string>lpayapp</string>
<string>kpay</string>
</array>
3. App Transport Security Setting
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
example #
1. Common / Regular billing usage example
import 'package:flutter/material.dart';
import 'package:flutter_iamport/iamport_view.dart'; // Import iamport payment module.
class Payment extends StatelessWidget {
callback(String url) { /* [Required] After the payment is finished, change the router and deliver the result. */
Map<String, dynamic> args = {
'success' : Uri.splitQueryString(url)['success'],
'impUid' : Uri.splitQueryString(url)['imp_uid'],
'errorMsg' : Uri.splitQueryString(url)['error_msg'],
};
Navigator.pushReplacementNamed(context, '/PaymentResult', arguments: args);
}
/* [Required] Enter the data required for payment. */
Map<String, dynamic> state = {
'pg': 'html5_inicis',
'payMethod': 'card',
'name': '아임포트 결제데이터 분석',
'merchantUid': 'mid_${DateTime.now().millisecondsSinceEpoch}',
'app_scheme': 'example',
'amount': '39000',
'buyerName': '홍길동',
'buyerTel': '01012345678',
'buyerEmail': 'example@naver.com',
'buyerAddr': '서울시 강남구 신사동 661-16',
'buyerPostcode': '06018',
'cardQuota': 0,
'vbankDue': null,
'bizNum': null,
'digital': null,
'escrow': null,
};
@override
Widget build(BuildContext context) {
return IamportView(
appBar: new AppBar(
title: const Text('Pament'),
),
param: data,
userCode: "iamport",
callback: this.callback);
}
}