Code Monkey home page Code Monkey logo

flutter_zalo's Introduction

flutter_zalopay_sdk

A Zalo Pay SDK .

pub package

Getting Started

NOTE: Get your appid from Zalo in order for ZaloPaySDK to work. In this readme we will use appId = 2553, as this is demo appID from Zalo

flutter_zalopay_sdk

A Flutter Wrapper for ease of interacting with ZaloPaySDK.

https://docs.zalopay.vn/docs/apptoapp/api.html#ngu-canh-su-dung

Android setup:

  • Set up your AndroidManifest.xml as below:
 <activity
      ...
     android:launchMode="singleTask"
     ...>
   <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="demozpdk"
                    android:host="app" />
    </intent-filter>
  
   <meta-data
            android:name="com.vng.zalo.sdk.APP_ID"
            android:value="2553" />
   <meta-data
            android:name="com.vng.zalo.sdk.ENVIRONMENT"
            android:value="SANDBOX" /> // OR value="PRODUCTION"
</activity>
           

iOS setup:

  • Set up your Info.plist as below
<key>CFBundleURLTypes</key>
    	<array>
    		<dict>
    			<key>CFBundleTypeRole</key>
    			<string>Editor</string>
    			<key>CFBundleURLName</key>
    			<string>com.flutterzalopay.flutterZaloSdkExample</string>
    			<key>CFBundleURLSchemes</key>
    			<array>
    				<string>demozpdk</string>
    			</array>
    		</dict>
    		<dict>
    			<key>CFBundleTypeRole</key>
    			<string>Editor</string>
    			<key>CFBundleURLName</key>
    			<string>com.flutterzalopay.flutterZaloSdkExample</string>
    			<key>CFBundleURLSchemes</key>
    			<array>
    				<string>zp-redirect-2553</string>
    			</array>
    		</dict>
    	</array>
<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>zalo</string>
		<string>zalopay</string>
		<string>zalopay.api.v2</string>
	</array>
  • Add the following to your AppDelegate.swift file
...
import zpdk

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        return ZaloPaySDK.sharedInstance().application(app, open:url, sourceApplication: "vn.com.vng.zalopay", annotation:nil)
    }
  • In didFinishLaunchingWithOptions, add the line:
  ZaloPaySDK.sharedInstance()?.initWithAppId(2553, uriScheme: "demozpdk://app", environment: .sandbox) ///NOTE: If you want to use production, replace .sandbox with .production

How To Use

Call FlutterZaloPaySDK.payOrder(zpToken: String) to use. Latest status of the order can be accesed through FlutterZaloPaySDK.currentStatus. Default will be null

Applicable Staus can be found in class FlutterZaloPaymentStatus

FlutterZaloPaymentStatus.PROCESSING
FlutterZaloPaymentStatus.FAILED
FlutterZaloPaymentStatus.SUCCESS
FlutterZaloPaymentStatus.CANCELLED

flutter_zalo's People

Contributors

sonvp avatar tranvietha2809 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.