https://github.com/openflutter/tobias
AliPay For Flutter.支付宝Flutter插件
https://github.com/openflutter/tobias
alipay alipysdk flutter flutteralipay
Last synced: 4 months ago
JSON representation
AliPay For Flutter.支付宝Flutter插件
- Host: GitHub
- URL: https://github.com/openflutter/tobias
- Owner: OpenFlutter
- License: apache-2.0
- Created: 2018-08-30T14:48:43.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2025-03-07T14:53:54.000Z (7 months ago)
- Last Synced: 2025-03-07T15:37:12.780Z (7 months ago)
- Topics: alipay, alipysdk, flutter, flutteralipay
- Language: Objective-C
- Homepage:
- Size: 29.8 MB
- Stars: 702
- Watchers: 14
- Forks: 117
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://pub.dartlang.org/packages/tobias)

[](https://github.com/OpenFlutter/tobias/stargazers)
[](https://github.com/OpenFlutter/tobias/network)
[](https://github.com/OpenFlutter/tobias/blob/master/LICENSE)
[](https://github.com/OpenFlutter/tobias/issues)[中文移步这里](./README_CN.md)
> Join QQ Group now: 1003811176

## 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](https://docs.open.alipay.com/204/105051/) before using tobias.
1. You have to config `url_scheme` in [pubspec.yaml](./example/pubspec.yaml). Url scheme is a unique string to
resume you app on iOS but please note that `_` is invalid.2. for OpenHarmony, you have to add scheme `alipays` to module.json5 in your project like this:
```json5
{
"module": {
"querySchemes": [
"alipays"
],
}
}
```## Payment
It's simple,pass Tobias your order info from server :
```dart
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](https://opendocs.alipay.com/open/0b9qzi).
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:```dart
{
result: partner="2088411752388544"&seller_id="etongka123@163.com"&out_trade_no="180926084213001"&subject="test pay"&total_fee="0.01"¬ify_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.
> If you're facing conflicts with `utdid` on iOS, you can set `no_utdid: true` in [pubspec.yaml](./example/pubspec.yaml)
## 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`:```objective-c
- (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 *)options
{
return [TobiasPlugin handleOpenURL:url];
}
```If you have to override these two functions, make sure you have called the `super`:
```objective-c
- (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 *)options
{
return [super application:application openURL:url options:options];
}
```### Donate
Buy me a cup of coffee。
![]()
### Subscribe Us On WeChat

## 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 athttp://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.