パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v6.0.0

tobias

ユーザーがネイティブな Android/iOS/OpenHarmony Alipay SDK を使って認証または支払いを行うことを可能にする Flutter プラグインです。

AndroidiOS
30日間ダウンロード
2.7万
いいね数
106
Pub ポイント
130

パッケージをインストール

flutter pub add tobias

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Tobiasは、ネイティブなAndroid、iOS、OpenHarmonyのAliPay SDKを使用して、シームレスな認証および決済統合を可能にするFlutterプラグインです。開発者は、Flutterアプリケーション内でAliPayの安全で広く採用されている決済インフラストラクチャを活用できます。このプラグインは、Flutterとプラットフォーム固有のAliPay機能との間のブリッジを提供し、対応デバイス上でスムーズなユーザー体験を確保します。最小限のセットアップで、アプリ内決済およびAliPayによるユーザー認証の両方をサポートしており、ECサイトや金融関連アプリに最適です。

用途

  • アプリ内購入でAliPayを使用
  • AliPayを介したユーザー認証
  • クロスプラットフォーム決済ソリューション
  • 中国市場をターゲットとしたECアプリ
  • モバイルウォレット統合

主な機能

  • ネイティブAlipay SDKの統合
  • Android、iOS、OpenHarmony のサポート
  • セキュアな支払いおよび認証フロー
  • 最小限の構成が必要
  • プラットフォーム固有の最適化

適している対象

  • 支払い機能付きアプリを構築するFlutter開発者
  • 中国またはAlipayを使用する地域のユーザーを対象としたアプリ
  • ネイティブな支付宝機能を必要とする開発者
  • クロスプラットフォームの支払い対応を必要とするプロジェクト
  • AliPayを迅速に統合するスタートアップ

注意事項

  • AliPayアカウントとマーチャント設定が必要です
  • Alipay対応地域に限定
  • ネイティブSDKバージョンに依存
  • 追加のコンプライアンスチェックが必要になる場合があります
  • OpenHarmony のサポートは実験的です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

logo

pub package Build status GitHub stars GitHub forks GitHub license GitHub issues OpenFlutter

中文移步这里

Join QQ Group now: 1003811176

QQGroup

What's Tobias

Tobias is a flutter plugin for AliPaySDK, works on iOS, Android and OpenHarmony

Getting Started

I highly recommend that you read the official documents before using tobias.

  1. For iOS, you have to configure your Xcode project manually. See iOS Configuration.

  2. for OpenHarmony, you have to add scheme alipays to module.json5 in your project like this:

{
  "module": {
    "querySchemes": [
      "alipays"
    ],
  }
}

iOS Configuration

Breaking change in 6.0.0: tobias no longer modifies your Xcode project during pod install. The tobias: section in pubspec.yaml (url_scheme, no_utdid, ios.ignore_security, ios.universal_link) is obsolete and is ignored. Configure the following by hand.

Swift Package Manager

tobias supports both Swift Package Manager and CocoaPods. To use SPM, enable it once:

flutter config --enable-swift-package-manager

Nothing else is required — Flutter picks up ios/tobias/Package.swift automatically. If SPM is not enabled, the CocoaPods podspec is used as before.

1. Info.plist

Add your own url scheme (a unique string used to resume your app, _ is not allowed):

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>alipay</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>your_url_scheme</string>
        </array>
    </dict>
</array>

Allow your app to query the Alipay app:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>alipays</string>
</array>

Alipay still serves some content over HTTP, so unless you know what you are doing, add:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key>
    <true/>
</dict>
2. Runner.entitlements

Universal link is required by Alipay. Enable the Associated Domains capability and add the host of your universal link:

<key>com.apple.developer.associated-domains</key>
<array>
    <string>applinks:your.domain.com</string>
</array>

See example/ios/Runner for a working setup.

Payment

It's simple,pass Tobias your order info from server :

import 'package:tobias/tobias.dart' ;
Tobias tobias = Tobias();
tobias.pay(yourOrder);

If you're working with iOS, please add and pass universal link. See how to configure universal link.

The result is map contains results from AliPay.The result also contains an external filed named platform which means the result is from iOS or android. Result sample:

{
result: partner="2088411752388544"&seller_id="etongka123@163.com"&out_trade_no="180926084213001"&subject="test pay"&total_fee="0.01"&notify_url="http://127.0.0.1/alipay001"&service="mobile.securitypay.pay"&payment_type="1"&_input_charset="utf-8"&it_b_pay="30m"&return_url="m.alipay.com"&success="true"&sign_type="RSA"&sign="nCZ8MDhsNvYNAbrLZJZ2VUy6vydgAp+JCq1aQo6ORDYtI9zwtnja3qNGQNiDJCuktoIj7fSTM487XhjPDqnOreZjIA1GJpxu9D1I3nMXIn1M7DfZ0noDwXcYZ438/jbYac7g8mhpwdKGweLCAni9mO3Y6q3iBFkox8i9PcsGxJY=",
resultStatus: 9000,
 memo: ,
 platform:iOS
}

NOTE:Tobias use pay_V2.

NOTE: the no_utdid variant of the iOS SDK has been removed in 6.0.0. If you depend on it, stay on 5.x for now.

Auth

import 'package:tobias/tobias.dart' ;
Tobias tobias = Tobias();
tobias.auth("your auth str);

Check AliPay Installation

Tobias tobias = Tobias();
var result = await tobias.isAliPayInstalled;

You can also call tobias.version which returns a map contains version and platform.

Upgrade to 1.0.0

There's no need to override AppDelegate since tobais 1.0.0. If you have done that before, please remove the following code in your AppDelegate:


- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [TobiasPlugin handleOpenURL:url];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
{
  return [TobiasPlugin handleOpenURL:url];
}

If you have to override these two functions, make sure you have called the super:


- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    
  return [super application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options
{
    
  return [super application:application openURL:url options:options];
}
Donate

Buy me a cup of coffee。

Subscribe Us On WeChat

subscribe

LICENSE

Copyright 2018 OpenFlutter Project

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements.  See the NOTICE file distributed with this work for
additional information regarding copyright ownership.  The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License.  You may obtain a copy of
the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
License for the specific language governing permissions and limitations under
the License.

カテゴリー

依存関係

依存関係一覧 1 件

  • plugin_platform_interface^2.0.2

ソースリポジトリ

このパッケージを使用しているプロジェクト

ランキング