pub package

Flutter MobilePay payment

A Flutter plugin for integrating Scandinavian payment provider MobilePay.

Only Android support for now.

Usage

Install the package by adding the line flutter_mobilepay_payment: ^0.0.1 to pubspec.yaml and run flutter packages get.

Import it in main.dart;

import 'package:flutter_mobilepay_payment/flutter_mobilepay_payment.dart';

and once in your app, initialize a AppSwitchPayment instance:

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

class MyApp extends StatefulWidget {
  static AppSwitchPayment _mobilePay = AppSwitchPayment(
      "APPDK0000000000", Country.Denmark,
      captureType: CaptureType.Reserve);

  @override
  _MyAppState createState() => new _MyAppState(_mobilePay);
}

Then do a payment like this:

final payment = await mobilePay.pay("86715c57-8840-4a6f-af5f-07ee89107ece", 10.0);

If payment is null, that means that the payment was cancelled, i.e. the user backed out. If an error occurs, an exception will be thrown with the corresponding error code. Otherwise, the payment object will contain the paid amount and the transaction ID.

MobilePay

The plugin has MobilePay AppSwitch SDK v. 1.8.1 built in. See here if it's the latest one.

Troubleshooting

Q: I got a lovely java.lang.AbstractMethodError (no error message) from gradle after installing the package. A: That's been seen when using Kotlin 1.2.50, and it was fixed by upgrading to 1.2.60.

Flutter

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Libraries

flutter_mobilepay_payment