nexi_payment 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new67

nexi_payment #

Flutter plugin for nexi payment integration.

Getting Started #

Init Nexi #

Initialize NexiPayment object with your secretKey and type of Environment(test or prod)

  @override
  void initState() {
    super.initState();
    _nexiPayment = new NexiPayment(secretKey:"_yourSecretKey_", environment: EnvironmentUtils.TEST);
  }

To start the payment process just call xPayFrontOfficePaga

var res = await _nexiPayment.xPayFrontOfficePagaNonce("YOUR_ALIAS", "codTrans", CurrencyUtilsQP.EUR, amount);
//handle response

Supported features: #

WebView payment #

  • xPayFrontOfficePaga

Dependencies #

Android & IOS #

Common errors #

IOS #

In some cases it's necessary to add these few lines in Podfile (flutter_app/ios/Podfile)

platform :ios, '10.0'
use_frameworks!

Special thanks #

for support and testing of the first implementation of the plugin

1.0.0 #

  • Format code, tested on IOS

0.0.1-dev.2 #

  • BugFix get activity, added comments

0.0.1-dev.1 #

  • Initial release, implementing Xpay.FrontOffice.paga web view

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:nexi_payment/nexi_payment.dart';
import 'package:nexi_payment/models/currency_utils_qp.dart';
import 'package:nexi_payment/models/environment_utils.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: TestPage(),
    );
  }
}

class TestPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => TestPageState();
}

class TestPageState extends State<TestPage> {
  NexiPayment _nexiPayment;

  @override
  void initState() {
    super.initState();
    _nexiPayment = new NexiPayment(secretKey:"_your_secret_key", environment: EnvironmentUtils.TEST);
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body:Center(
          child: Column(
              mainAxisAlignment:  MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                RaisedButton(child: Text("PAY"), onPressed:  () => _paga("insert_cod_trans") ),
              ]
          )
      ) ,
    );
  }

  void _paga(String codTrans) async {
    var res = await _nexiPayment.xPayFrontOfficePaga("_your_alias_", codTrans, CurrencyUtilsQP.EUR, 2500);
    openEndPaymentDialog(res);
  }


  openEndPaymentDialog(String response) async {

    await showDialog(
      barrierDismissible: false,
      context: context,
      builder: (BuildContext c2) {
        return AlertDialog(
          title:
          Container(
              margin: EdgeInsets.only(bottom: 10),
              child: Stack(children: <Widget>[

                Positioned(
                  bottom: -12,
                  left: -15,
                  child: IconButton(
                      icon: Icon(Icons.arrow_back),
                      color: Colors.blueAccent,
                      onPressed: () => Navigator.of(context).pop()),
                ),
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Container(
                      margin: EdgeInsets.only(right: 5),
                      child: Icon(Icons.euro_symbol, color: Colors.black38, size: 25,),
                    ) ,
                    Text("Response", style: TextStyle(fontSize: 22, color: Colors.black38, fontWeight: FontWeight.bold),),
                  ],
                )

              ],)),
          content:
          Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              Text(response, style: TextStyle(color: response == "OK" ? Colors.green : Colors.red))
            ],
          )
          ,
        );

      },
    );

  }

}

Use this package as a library

1. Depend on it

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


dependencies:
  nexi_payment: ^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:nexi_payment/nexi_payment.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
34
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]
67
Learn more about scoring.

We analyzed this package on Jul 2, 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:nexi_payment/nexi_payment.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

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

Package does not support Flutter platform web

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

Package does not support Flutter platform windows

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

Package not compatible with SDK dart

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.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