yandex_checkout 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 52

yandex_checkout #

A Yandex Checkout plugin for Flutter. (Note that there is an Android implementation only!)

Getting Started #

To try an example you need to set your own client application key and shop ID from checkout cabinet to the payment parameters as described below.

Please note that this example doesn't use Yandex Money payment method, so if you need it, you need to set up YandexLoginSdk for Android https://github.com/yandex-money/yandex-checkout-android-sdk#%D0%BF%D0%BE%D0%B4%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%B8%D0%B5-yandexloginsdk

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:yandex_checkout/yandex_checkout.dart';

void main() {
  runApp(Example());
}

class Example extends StatefulWidget {
  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  String resultToken;

  void _createYandexPaymentTokenization() async {
    String displayedMessage;
    final paymentParameters = PaymentParameters(
      title : "Yandex Payment",
      subtitle : "Test",
      amount : Amount(
        value: 100,
        currency: "RUB"
      ),
      // Set your own key
      clientApplicationKey : "<Client Application Key>",
      // Set your own shop id
      shopId : "<Your Shop ID>",
      paymentMethodTypes : {
        PaymentMethodType.BANK_CARD, PaymentMethodType.GOOGLE_PAY,
      }
    );

    try {
      final tokenizationResult = await Checkout.createTokenize(paymentParameters);
      displayedMessage = tokenizationResult.paymentToken;
    } catch (e) {
      displayedMessage = e.toString();
    }

    setState(() => resultToken = displayedMessage);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          primaryColor: Colors.yellowAccent,
          accentColor: Colors.yellowAccent
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Example'),
        ),
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.monetization_on),
          onPressed: _createYandexPaymentTokenization,
        ),
        body: Container(
          alignment: Alignment.center,
          padding: EdgeInsets.all(20),
          child: Text(resultToken ?? "There will be your payment token"),
        ),
      ),
    );
  }
}

TODO #

  1. Add test parameters
  2. Add ui parameters
  3. Add iOS implementation

0.1.4 2019/11/19 #

Added basic functionality

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:yandex_checkout/yandex_checkout.dart';

void main() {
  runApp(Example());
}

class Example extends StatefulWidget {
  @override
  _ExampleState createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  String resultToken;

  void _createYandexPaymentTokenization() async {
    String displayedMessage;
    final paymentParameters = PaymentParameters(
      title : "Yandex Payment",
      subtitle : "Test",
      amount : Amount(
        value: 100,
        currency: "RUB"
      ),
      // Set your own key
      clientApplicationKey : "<Client Application Key>",
      // Set your own shop id
      shopId : "<Your Shop ID>",
      paymentMethodTypes : {
        PaymentMethodType.BANK_CARD, PaymentMethodType.GOOGLE_PAY,
      }
    );

    try {
      final tokenizationResult = await Checkout.createTokenize(paymentParameters);
      displayedMessage = tokenizationResult.paymentToken;
    } catch (e) {
      displayedMessage = e.toString();
    }

    setState(() => resultToken = displayedMessage);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          primaryColor: Colors.yellowAccent,
          accentColor: Colors.yellowAccent
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Example'),
        ),
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.monetization_on),
          onPressed: _createYandexPaymentTokenization,
        ),
        body: Container(
          alignment: Alignment.center,
          padding: EdgeInsets.all(20),
          child: Text(resultToken ?? "There will be your payment token"),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  yandex_checkout: ^0.1.4

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

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:yandex_checkout/yandex_checkout.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Web

Because:

  • package:yandex_checkout/yandex_checkout.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Windows

Because:

  • package:yandex_checkout/yandex_checkout.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform macOS

Because:

  • package:yandex_checkout/yandex_checkout.dart that declares support for platforms: Android, iOS

Package not compatible with SDK dart

Because:

  • yandex_checkout that is a package requiring null.

Health suggestions

Format lib/src/amount.dart.

Run flutter format to format lib/src/amount.dart.

Format lib/src/checkout.dart.

Run flutter format to format lib/src/checkout.dart.

Format lib/src/google_pay_card_network.dart.

Run flutter format to format lib/src/google_pay_card_network.dart.

Fix additional 5 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/google_pay_parameters.dart (Run flutter format to format lib/src/google_pay_parameters.dart.)
  • lib/src/payment_method_type.dart (Run flutter format to format lib/src/payment_method_type.dart.)
  • lib/src/payment_parameters.dart (Run flutter format to format lib/src/payment_parameters.dart.)
  • lib/src/tokenization_result.dart (Run flutter format to format lib/src/tokenization_result.dart.)
  • lib/yandex_checkout.dart (Run flutter format to format lib/yandex_checkout.dart.)

Dependencies

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