my_fatoorah 2.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

my_fatoorah #

My Fatoorah Payment SDK Integration

Getting Started #

Installation #

add this to your pubspec.yaml
my_fatoorah: any

Config #

Ios #

add this line to your Info.plist #

<key>io.flutter.embedded_views_preview</key>
<true>

if this url is not using ssl you have to use clear text traffic . put this value in your manifest for android #

and allow arbitrary loads in your Info.plist for ios #

Android #

 <application
  ...
  android:usesCleartextTraffic="true"
  ...>
  ...
  </application>

Ios #

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Usage #

import 'package:my_fatoorah/my_fatoorah.dart';
...
 MyFatoorah.startPayment(
                  context: context,
                  request: MyfatoorahRequest(
                      currencyIso: Country.SaudiArabia,
                      successUrl:
                          "Your success call back",
                      errorUrl:
                          "Your error call back",
                      invoiceAmount: 100,
                      language: ApiLanguage.Arabic,
                      token: null,
                      afterPaymentBehaviour:AfterPaymentBehaviour.None, //See the describe for this property for more details
                      ),
                );

See the example for more details

Notes #

  1. because my fatoorah sdk itself uses webview i removed all platform specified code and used webview plugin since v2
  2. after payment done the web view redirect automatically to error or success url thats mean these url has to return html content

2.1.0 #

  • Remove finishAfterCallback property
  • add afterPaymentBehaviour property

2.0.0 #

  • Remove platform specified code and use pure dart
  • Simplify behaviour
  • Add webview_flutter to dependencies
  • Edit README with new docs

1.0.1 #

  • Add internet permission for android

1.0.0 #

  • Formatting code

0.0.1 #

  • TODO: initial release.For the api

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:my_fatoorah/my_fatoorah.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      locale: Locale("ar"),
      supportedLocales: [
        const Locale('ar'),
      ],
      home: InnerPage(),
    );
  }
}

class InnerPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("دفع ماى فاتورة"),
      ),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Text("قيمة الطلب هى 100 ريال سعودى"),
            SizedBox(height: 20),
            RaisedButton(
              onPressed: () {
                MyFatoorah.startPayment(
                  context: context,
                  request: MyfatoorahRequest(
                    currencyIso: Country.SaudiArabia,
                    successUrl:
                        "https://assets.materialup.com/uploads/473ef52c-8b96-46f7-9771-cac4b112ae28/preview.png",
                    errorUrl:
                        "https://www.digitalpaymentguru.com/wp-content/uploads/2019/08/Transaction-Failed.png",
                    invoiceAmount: 100,
                    language: ApiLanguage.Arabic,
                    token: null,
                    afterPaymentBehaviour:
                        AfterPaymentBehaviour.BeforeCalbacksExecution,
                  ),
                ).then((response) {
                  print(response);
                });
              },
              child: Text("دفع"),
            )
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


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

We analyzed this package on Apr 6, 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.2.2 <3.0.0
flutter 0.0.0
http ^0.12.0+4 0.12.0+4
webview_flutter ^0.3.19+8 0.3.19+9
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
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