bootpay_flutter 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

bootpay_flutter #

This plugin is payment modules of Bootpay for Flutter.

Getting Started #

Add the module to your project pubspec.yaml:

...
dependencies:
 ...
 bootpay_flutter: last_version
...

And install it using flutter packages get on your project folder. After that, just import the module and use it:

Settings #

Android #

No configuration required.

iOS #

** {your project root}/ios/Runner/Info.plist **

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>kr.co.bootpaySample</string> // 사용하고자 하시는 앱의 bundle url name
            <key>CFBundleURLSchemes</key>
            <array>
                <string>bootpaySample</string> // 사용하고자 하시는 앱의 bundle url scheme
            </array>
        </dict>
    </array>

Done!

import 'dart:async';
import 'dart:io';

import 'package:bootpay_flutter/bootpay_flutter.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _paymentResult = '';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String bootpayApplicationId;
    if (Platform.isAndroid) {
      bootpayApplicationId = "59a4d326396fa607cbe75de5"; // 안드로이드용 bootpay applicationId
    } else {
      bootpayApplicationId = "59a4d328396fa607b9e75de6"; // ios용 bootpay applicationId
    }

    String paymentResult;
    final UserInfo userInfo = UserInfo(username: "홍길동", email: "test@test.com");
    final PayParam payParam = PayParam(
        price: "1000",
        applicationId: bootpayApplicationId, // your_bootpay_id (Android or iOS)
        name: "bootpay_flutter_테스트_결제",
        userInfo: userInfo,
        orderId: "BootpayTest000001");

    try {
      final PayResult result = await BootpayFlutter.pay(payParam);
      if (result.action == "BootpayDone") {
        // 결제성공
        print("결제 성공");
      } else if (result.action == "BootpayCancel") {
        // 사용자가 결제완료전에 결제를 중지한 상태.
        print("사용자 결제 취소");
      } else if (result.action == "BootpayError") {
        // 결제에러
        print("결제 에러");
      }
      paymentResult = result.toString();
    } on Exception {
      paymentResult = 'Payment Failed.';
    }

    setState(() {
      _paymentResult = paymentResult;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Bootpay flutter example app'),
        ),
        body: Center(
          child: Text('Payment Result : $_paymentResult'),
        ),
      ),
    );
  }
}

Enjoy!

Author #

Developed by Jace Shim (심천보)

Contributing #

Feel free to help!

[1.0.1]

  • 가상계좌 결제시 결제결과에 가상계좌정보 포함되도록 수정

[1.0.0]

  • payment method가 대문자로 치환하여 적용하도록 변경
  • bootpay실행부분 exception catch 되도록 변경
  • ios에서 결제수단을 무조건 소문자로 치환하여 처리되도록 수정.
  • android onActivityResult 수행시 결제모듈로 실행될 경우에만 MethodChannel로 응답처리되게 수정.

[0.0.9]

  • Flutter PlatformChannel에서 발생하는 에러 fix.
  • Example 수정

[0.0.8]

  • bootpay 미지원 method 주석처리

[0.0.7]

  • changed bootpay version for android
  • ignored .vscode directory

[0.0.6]

  • android back button 터치시 사용자에 의한 취소로 처리되게 수정함.
  • ios 결제값 return로직 변경

[0.0.5]

  • README example 오타 수정 ( ╥﹏╥) ノシ

[0.0.4]

  • README example 오타 수정.

[0.0.3]

  • 결제상태 처리를 bootpay의 action으로 대체.
  • README example 수정.
  • bootpay_flutter version변경.

[0.0.2]

  • Removed unused dependencies.
  • Updated package description.
  • Reformatted dart code.

[0.0.1]

  • initial release.

example/README.md

bootpay_flutter_example #

Demonstrates how to use the bootpay_flutter 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:
  bootpay_flutter: ^1.0.1

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:bootpay_flutter/bootpay_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/bootpay_flutter.dart.

Run flutter format to format lib/bootpay_flutter.dart.

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 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test