elepay_flutter 1.0.0

  • Readme
  • Changelog
  • Installing
  • new44

elepay_flutter #

elepay native SDK(Android/iOS) wrapper for Flutter.

Requirement #

This plugin requires Flutter 1.12.0 with Dart SDK 2.6.0 and above.

Setup #

Add the following dependencies in your pubspec.yaml file:

dependencies:
  elepay_flutter: ^${latestVersion}

Usage #

  • Import package:elepay_flutter/elepay_flutter.dart.
  • Initialize the elepay SDK via ElepayFlutter.initELepay.
  • Pass the charge data(a JSON object string) to ElepayFlutter.handlePayment and process the ElepayResult data.

Example:

import 'package:elepay_flutter/elepay_flutter.dart';

...

// Initialize the elepay SDK. Only the first parameter `publicKey` is required.
// The following example also change the default localization used by elepay SDK UI to `japanese`.
var config = ElepayConfiguration(
  currentConfig['pk'],
  languageKey: ElepayLanguageKey.japanese);
ElepayFlutter.initElepay(config);

// Addtionally, you can change the default localization used by elepay SDK UI by calling the
// following method.
// By default, elepay SDK uses the system language settings if possible, and fallbacks to English.
// Note that changing language must be called after elepaySDK is initialized and before the
// invoking of `ElepayFlutter.handlePayment`.
ElepayFlutter.changeLanguage(ElepayLanguageKey.japanese);

...

// Create the charge data(a JSON object) by invoking elepay API
// Then transform the data to String instance and pass it to the elepay SDK to process the payment.
var res = await ElepayFlutter.handlePayment(chargePayload);
// Handle the result data.
if (res is ElepayResultSucceeded) {
  print('succeed. ' + res.paymentId);
} else if (res is ElepayResultFailed) {
  print('failed: ' + res.paymentId + ', code=' + res.code + ', reason=' + res.reason + ', message=' + res.message);
} else if (res is ElepayResultCancelled) {
  print('cancelled. ' + res.paymentId);
}

Native callbacks #

Some payment methods require to process the payment in their native app. For those payment methods, you need to config your app to be able to handle the callback.

Check the elepay document to see which methods require the extra configuration.

Android #

Add the following code to the Activity which you used to load ElepayFlutter in file AndroidManifest.xml.

Normally it's MainActivity

<intent-filter>
    <data android:scheme="Your-elepay-app-scheme" />
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

iOS #

URL schemes should be configured. Please refer to the elepay iOS SDK document for details.

1.0.0-beta01 #

First beta of elepay_flutter SDK. Embedded native SDK:

  • iOS: 1.7.9
  • Android: 1.8.2

Use this package as a library

1. Depend on it

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


dependencies:
  elepay_flutter: ^1.0.0

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

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:elepay_flutter/elepay_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:elepay_flutter/elepay_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:elepay_flutter/elepay_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:elepay_flutter/elepay_flutter.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [elepay_flutter] that is in a package requiring null.

Health suggestions

Format lib/elepay_config.dart.

Run flutter format to format lib/elepay_config.dart.

Format lib/elepay_flutter.dart.

Run flutter format to format lib/elepay_flutter.dart.

Format lib/elepay_result.dart.

Run flutter format to format lib/elepay_result.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and elepay_flutter.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test