flutter_iamport 0.0.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 49

flutter_iamport #

Build Status

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>

model #

class Params {
  String pg;
  String pay_method;
  bool escrow;
  String merchant_uid;
  String name;
  int amount;
  Object custom_data;
  int tax_free;
  int vat;
  String currency;
  String language;
  String buyer_name;
  String buyer_tel;
  String buyer_email;
  String buyer_addr;
  String buyer_postcode;
  String notice_url;
  Display display;

  bool digital;
  String vbank_due;
  String m_redirect_url;
  String app_scheme;
  String biz_num;

  String customer_uid;
  bool popup;
  bool naverPopupMode;

  static Map<String, dynamic> toMap(Params json) {
    return {
      'pay_method': json.pay_method,
      'merchant_uid': json.merchant_uid,
      'amount': json.amount,
      ...
  }

  Params.fromJson(Map<String, dynamic> json) {
    this.pay_method = json['pay_method'];
    this.merchant_uid = json['merchant_uid'];
    this.amount = json['amount'];
    ...
  }

example #

1. Common / Regular billing usage example #

import 'package:flutter/material.dart';
import 'package:flutter_iamport/iamport_view.dart'; // Import iamport payment module.
import 'package:flutter_iamport/model/Params.dart';

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. */    
    Params state = Params.fromJson({
      'pg': 'html5_inicis',
      'pay_method': 'card',
      'name': '아임포트 결제데이터 분석',
      'merchant_uid': 'mid_${DateTime.now().millisecondsSinceEpoch}',
      'app_scheme': 'example',
      'amount': 39000,
      'buyer_name': '홍길동',
      'buyer_tel': '01012345678',
      'buyer_email': 'example@naver.com',
      'buyer_addr': '서울시 강남구 신사동 661-16',
      'buyer_postcode': '06018',
    });

    @override
    Widget build(BuildContext context) {
        return IamportView(
            appBar: new AppBar(
            title: const Text('Pament'),
            ),
            param: data,
            userCode: "iamport",
            callback: this.callback);
    }
}

0.0.7 #

  • ios html pod spec fix

0.0.6 #

  • ios html resource bundle load fix

0.0.5 #

  • Example Mobile phone small payment Ui bug fix
  • swift optimization

0.0.4 #

  • ErrorOnParams View Fix, Readme Add Model

0.0.3 #

  • Card installment Fix, Payment Model

0.0.2 #

  • Example Style Update, ios loadding splash

0.0.1 #

  • Initial release.

example/README.md

flutter_iamport_example #

Demonstrates how to use the flutter_iamport plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_iamport: ^0.0.7

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_iamport/flutter_iamport.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
9
Health:
Code health derived from static analysis. [more]
87
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Oct 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/model/Params.dart. (-12.66 points)

Analysis of lib/model/Params.dart reported 27 hints, including:

line 4 col 10: Name non-constant identifiers using lowerCamelCase.

line 6 col 10: Name non-constant identifiers using lowerCamelCase.

line 9 col 10: Name non-constant identifiers using lowerCamelCase.

line 10 col 7: Name non-constant identifiers using lowerCamelCase.

line 14 col 10: Name non-constant identifiers using lowerCamelCase.

Fix lib/iamport_view.dart. (-0.50 points)

Analysis of lib/iamport_view.dart reported 1 hint:

line 51 col 22: The declaration '_topMostRoute' isn't referenced.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test