triPOS Mobile Flutter Plugin

基于 Worldpay triPOS Mobile SDK 的 Flutter 插件,支持通过 Ingenico 蓝牙读卡器进行移动支付。
✨ 功能特性
| 功能 |
Android |
iOS |
说明 |
| 蓝牙扫描连接 |
✅ |
✅ |
设备扫描与连接 |
| 销售 (Sale) |
✅ |
✅ |
刷卡/插卡/NFC 销售 |
| 退款 (Refund) |
✅ |
✅ |
刷卡退款 |
| 关联退款 |
✅ |
✅ |
无需刷卡退款 |
| 作废 (Void) |
✅ |
✅ |
取消已完成交易 |
| 预授权 |
✅ |
✅ |
冻结/完成/增量授权 |
| Token 支付 |
✅ |
✅ |
无卡交易 |
| 离线模式 (S&F) |
✅ |
✅ |
离线存储转发 |
| 自动恢复 |
✅ |
- |
网络错误自动重置连接 |
🚀 快速开始
import 'package:tripos_mobile/tripos_mobile.dart';
final tripos = TriposMobile();
// 1. 配置
final config = TriposConfiguration(
hostConfiguration: HostConfiguration(
acceptorId: 'your_acceptor_id',
accountId: 'your_account_id',
accountToken: 'your_account_token',
),
deviceConfiguration: DeviceConfiguration(
deviceType: DeviceType.ingenicoMoby5500,
),
);
// 2. 扫描设备
final devices = await tripos.scanBluetoothDevices(config);
// 3. 初始化连接
await tripos.initialize(config.copyWith(
deviceConfiguration: config.deviceConfiguration.copyWith(
identifier: devices.first,
),
));
// 4. 销售交易
final response = await tripos.processSale(
SaleRequest(transactionAmount: 10.00),
);
if (response.isApproved) {
print('交易成功! ID: ${response.host?.transactionId}, 批准号: ${response.host?.approvalNumber}');
}
📖 详细文档
📋 API 概览
核心方法
| 方法 |
说明 |
scanBluetoothDevices(config) |
扫描附近的蓝牙支付设备 |
initialize(config) |
初始化 SDK 并连接设备 |
deinitialize() |
断开设备并释放资源 |
cancelTransaction() |
取消当前交易 |
getDeviceInfo() |
获取已连接设备信息 |
交易方法
| 方法 |
说明 |
processSale(request) |
销售交易 |
processRefund(request) |
退款交易 (需刷卡) |
processLinkedRefund(request) |
关联退款 (无需刷卡) |
processVoid(request) |
作废交易 |
processAuthorization(request) |
预授权 |
processAuthorizationCompletion(request) |
预授权完成 |
processIncrementalAuthorization(request) |
增量授权 |
processReversal(request) |
交易冲正 |
Token 方法
| 方法 |
说明 |
createToken(request) |
刷卡创建 Token |
createTokenWithTransactionId(request) |
从交易 ID 创建 Token |
processSaleWithToken(request) |
Token 销售 |
processRefundWithToken(request) |
Token 退款 |
processAuthorizationWithToken(request) |
Token 预授权 |
离线交易方法
| 方法 |
说明 |
getAllStoredTransactions() |
获取所有存储交易 |
getStoredTransactionsWithState(state) |
按状态筛选存储交易 |
getStoredTransactionByTpId(tpId) |
按 ID 获取存储交易 |
deleteStoredTransaction(tpId) |
删除存储交易 |
manuallyForwardTransaction(request) |
手动转发交易 |
事件流
| 流 |
说明 |
statusStream |
交易状态更新 (Stream<VtpStatus>) |
deviceEventStream |
设备连接事件 (Stream<DeviceEvent>) |
📱 支持的设备
- Ingenico Moby 5500
- Ingenico Moby 8500
- Lane 3000/5000/7000/8000
- BBPOS Chipper 2X BT
💡 示例应用
查看 example/lib/main.dart 获取完整示例。
cd example
flutter run
📄 许可证
本插件基于 Worldpay triPOS Mobile SDK 开发,使用需遵守 Worldpay 许可协议。
🤝 贡献
欢迎提交 Issue 和 Pull Request!