FLUTTER ECOSYSTEM

xamelon/flutter_pay

Flutter용 Apple/Google/Samsung Pay 플러그인

flutter_pay 프로젝트 이미지
Stars
26
Forks
37
최근 푸시(UTC)
2022. 5. 29.
프로젝트 상태
활성
Stas Buldakov GitHub avatar
GITHUB User

Stas Buldakov ↗

언어KotlinDartSwiftRubyObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • effective_dart개발 의존성^1.2.3
  • flutter_test개발 의존성{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기
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

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