Coder Social home page Coder Social logo

flutter_alipay's Introduction

flutter_alipay

A flutter plugin to use alipay.

有任何问题,欢迎加入qq群854192563交流

Features

Install

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

dependencies:
  flutter_alipay: "^0.1.0"

Getting Started

  • Android

  • Add following permissions to your AndroidManifest.xml

   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
   <uses-permission android:name="android.permission.READ_PHONE_STATE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

  • ios

  • Add a URL scheme in info.plist

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>alipay</string>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>YOUR APP SCHEME NAME</string>
            </array>
        </dict>
    </array>

Make sure you have a CFBundleURLName=alipay in CFBundleURLTypes.

  • In AppDelegate.m, do header import
#import "FlutterAlipayPlugin.h"

and add following code

     // ios 8.x or older
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{

    return [FlutterAlipayPlugin handleOpenURL:url];
}
// ios 9.0+
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
     return [FlutterAlipayPlugin handleOpenURL:url];
}

How to use

import 'package:flutter_alipay/flutter_alipay.dart';
var result = await FlutterAlipay.pay("you pay info from server");

Using flutter_alipay in Swift

Edit Runner-Bridging-Header.h,add

#import <flutter_alipay/FlutterAlipayPlugin.h>

Edit AppDelegate.swift,add


 override func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
        return FlutterAlipayPlugin.handleOpen(url);
    }

flutter_alipay's People

Contributors

jzoom avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.