GithubHelp home page GithubHelp logo

dilave / flutter_pay Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xamelon/flutter_pay

0.0 0.0 0.0 559 KB

Apple/Google/Samsung Pay plugin for flutter

License: MIT License

Ruby 5.46% Objective-C 1.69% Kotlin 37.07% Dart 34.81% Swift 20.97%

flutter_pay's Introduction

flutter_pay

Google Pay Preparing

TODO

See Android documentation

Apple Pay Preparing

TODO

See Apple documentation

Usage

Firstly, you need to make sure, that Pay api is available on device:

import 'package:flutter_pay/flutter_pay.dart';
//..

FlutterPay flutterPay = FlutterPay();

bool isAvailable = await flutterPay.canMakePayments();
/..

If you need to check if user has at least one active card:

import 'package:flutter_pay/flutter_pay.dart';
//..

FlutterPay flutterPay = FlutterPay();

bool isAvailable = await flutterPay.canMakePaymentsWithActiveCard();

//Also you can state allowed payment card networks:
bool isAvailable = await flutterPay.canMakePaymentsWithActiveCard(
	allowedPaymentNetworks: [
		PaymentNetwork.visa, 
		PaymentNetwork.masterCard,
	],
);

To make payment is requestPayment method. This function will return to you token that you need to send to your gateway to complete payment. Example:

import 'package:flutter_pay/flutter_pay.dart';

PaymentItem item = PaymentItem(name: "T-Shirt", price: 2.98);

FlutterPay flutterPay = FlutterPay();

flutterPay.setEnvironment(environment: PaymentEnvironment.Test);

String token = await flutterPay.requestPayment(
      googleParameters: GoogleParameters(
        gatewayName: "example",
        gatewayMerchantId: "example_id",
		merchantId: "example_merchant_id",
		merchantName: "exampleMerchantName",
      ),
      appleParameters:
          AppleParameters(merchantIdentifier: "merchant.flutterpay.example"),
      currencyCode: "USD",
      countryCode: "US",
      paymentItems: items,
    );

Note that some arguments affects only Apple Pay or Google Pay. For example, paymentItems affects only Apple Pay. And the last item is used for grand total label.

merchantName affects only Google Pay and will be shown to user.

gatewayName also affects only Google Pay. See Google Pay integration section.

Payment Network matrix

Payment Network iOS Android
Visa + +
MasterCard + +
American Express + +
Interac + +
Discover + +
JCB + +
Maestro +
Electron +
Cartes Bancarries +
Union Pay +
EftPos +
Elo +
ID Credit +
Mada +
Private Label +
Quic Pay +
Suica +
V Pay +

Roadmap

  • Basic implementation
  • Complete docs
  • Add merchant capabilities support
  • Add billing and shipping info support

flutter_pay's People

Contributors

michael-gobbers avatar mit-73 avatar tumist76 avatar xamelon 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.