omise_flutter 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

omise_flutter #

A third-party Flutter package for integrating with Omise API

Installation #

More information: https://pub.dev/packages/omise_flutter

  1. Add this to your package's pubspec.yaml file:
dependencies:
  omise_flutter: ^0.1.0
  1. Install it from the command
flutter pub get
  1. Import it
import 'package:omise_flutter/omise_flutter.dart';

Usage #

Create a token #

create(String name, String number, String expirationMonth,
      String expirationYear, String securityCode,
      {String city,
      String country,
      String postalCode,
      String state,
      String street1,
      String street2,
      String phoneNumber})

Usage

OmiseFlutter omise = OmiseFlutter(YOUR_PUBLIC_KEY);
final response = await omise.token.create("John Doe", "4242424242424242", "12", "2020", "123");

Create a source #

create(int amount, String currency, String type,
      {String barcode,
      String email,
      int installmentTerm,
      String name,
      String storeId,
      String storeName,
      String terminalId,
      String phoneNumber,
      bool zeroInterestInstallments})

Usage

OmiseFlutter omise = OmiseFlutter(YOUR_PUBLIC_KEY);
final response = await omise.source.create(10000, "thb", "internet_banking_bay");

Retrieve a capability #

retrieve()

Usage

OmiseFlutter omise = OmiseFlutter(YOUR_PUBLIC_KEY);
final response = await omise.capability.retrieve();

[0.1.2] - Update an example #

  • Bug fixes

[0.1.1] - Update an example #

  • Bug fixes

[0.1.0] - Update an example #

  • Update an example
  • Update package
  • Format code

[0.0.1] - Initial release #

  • Initial release

example/example.dart

import 'package:omise_flutter/omise_flutter.dart';

/// Get your public key on Omise Dashboard
const publicKey = "YOUR_PUBLIC_KEY";
OmiseFlutter omise = OmiseFlutter(publicKey);

/// OmiseFlutter provides direct access to Omise REST API
exampleCreateToken() async {
  // See Omise API documentation for details
  // https://www.omise.co/tokens-api
  final token = await omise.token
      .create("John Doe", "4242424242424242", "12", "2020", "123");

  if (token.card.securityCodeCheck == true) {
    // Send a token back to your server
  } else {
    // Show error: Invalid CVV or the card can't be used
  }
}

exampleCreateSource() async {
  // See Omise API documentation for details
  // https://www.omise.co/sources-api
  final source =
      await omise.source.create(10000, "thb", "internet_banking_bay");

  print(source.id);
}

exampleRetrieveCapability() async {
  // See Omise API documentation for details
  // https://www.omise.co/capability-api
  final capability = await omise.capability.retrieve();

  print(capability.paymentMethods);
}

Use this package as a library

1. Depend on it

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


dependencies:
  omise_flutter: ^0.1.2

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:omise_flutter/omise_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
38
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]
69
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
crypto >=1.0.0 <3.0.0 2.1.4
flutter 0.0.0
http >=0.11.1 <0.13.0 0.12.0+4
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
http_parser 3.1.4
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test