yandex_checkout 0.1.4 copy "yandex_checkout: ^0.1.4" to clipboard
yandex_checkout: ^0.1.4 copied to clipboard

A Yandex.Checkout plugin for Flutter with convenient in-app payment without webview (Android implementation only!).

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
6
likes
30
pub points
24%
popularity

Publisher

unverified uploader

A Yandex.Checkout plugin for Flutter with convenient in-app payment without webview (Android implementation only!).

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on yandex_checkout