zarinpal 1.0.3

Zarinpal Package for dar & flutter, support android and ios

Zarinpal WebSite

Usage #

A simple usage example:

import 'package:zarinpal/zarinpal.dart';

main() {
  
// Initialize payment request 
 PaymentRequest _paymentRequest = PaymentRequest()
  ..setIsSandBox(true) // if your application is in developer mode, then set the sandBox as True otherwise set sandBox as false
    ..setMerchantID("Zarinpal MerchantID")
    ..setAmount("integar Amount")
    ..setCallbackURL("Verfication Url callbacl") //The callback can be an android scheme or a website URL, you and can pass any data with The callback for both scheme and  URL
    ..setDescription("Payment Description");

// For scheme you can use uni_links dart Package 


String _paymentUrl = null;


// Call Start payment
ZarinPal().startPayment(_paymentRequest, (int status, String paymentGatewayUri){
     if(status == 100)
         _paymentUrl  = paymentGatewayUri;  // launch URL in browser
});


// Vefrication Payment
// if you set the scheme in your application, You can get the Status and Authority from scheme callback
// if your callback is a website URL like htt://mydomain.com you don't need verificationPayment function

ZarinPal().verificationPayment("Status", "Authority Call back", _paymentRequest, (isPaymentSuccess,refID, paymentRequest){
     if(isPaymentSuccess){
       // Payment Is Success
     }else{
       // Error Print Status
     }
   });



}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.3 #

  • fixed verification code

1.0.2 #

  • updated readme file

1.0.1 #

  • updated some code

1.0.0 #

  • Initial version

example/zarinpal_example.dart

import 'package:zarinpal/zarinpal.dart';

main() {

// Initialize payment request
// For scheme you can use uni_links flutter Package
  PaymentRequest _paymentRequest = PaymentRequest()
    ..setIsSandBox(true)
    ..setMerchantID("Zarinpal MerchantID")
    ..setAmount(1000)//integar Amount
    ..setCallbackURL("Verfication Url callbacl") //The callback can be an android scheme or a website URL, you and can pass any data with The callback for both scheme and  URL
    ..setDescription("Payment Description");




  String _paymentUrl = null;


// Call Start payment
  ZarinPal().startPayment(_paymentRequest, (int status, String paymentGatewayUri){
    if(status == 100)
      _paymentUrl = paymentGatewayUri; // launch URL in browser

  });


// Vefrication Payment
// if you set the scheme in your application, You can get the Status and Authority from scheme callback
// if your callback is a website URL like htt://mydomain.com you don't need verificationPayment function

  ZarinPal().verificationPayment("Status", "Authority Call back", _paymentRequest, (isPaymentSuccess,refID, paymentRequest){
    if(isPaymentSuccess){
      // Payment Is Success
      print("Success");
    }else{
      // Error Print Status
      print("Error");
    }
  });



}

Use this package as a library

1. Depend on it

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


dependencies:
  zarinpal: ^1.0.3

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:zarinpal/zarinpal.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
27
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health issues and suggestions

Document public APIs. (-1 points)

58 out of 58 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
dio ^3.0.8 3.0.8
flutter 0.0.0
sprintf ^4.0.2 4.0.2
Transitive dependencies
charcode 1.1.3
collection 1.14.11 1.14.12
http_parser 3.1.3
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
source_span 1.6.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
pedantic ^1.8.0
test ^1.6.0