koi_pay_kit_alipay 0.1.0
koi_pay_kit_alipay: ^0.1.0 copied to clipboard
Alipay (支付宝) SDK adapter for koi_pay_kit. Wraps the tobias package.
koi_pay_kit_alipay #
Alipay (支付宝) SDK adapter for koi_pay_kit. Wraps the tobias package.
Installation #
Add the package to your pubspec.yaml:
dependencies:
koi_pay_kit: ^0.1.0
koi_pay_kit_alipay: ^0.1.0
Then install dependencies:
flutter pub get
Usage #
import 'package:koi_pay_kit/koi_pay_kit.dart';
import 'package:koi_pay_kit_alipay/koi_pay_kit_alipay.dart';
final engine = PaymentEngine(
backend: MyOrderBackend(),
sdks: {'alipay': AlipaySdk()},
cache: SharedPrefsCache(prefs),
);
final sn = await engine.pay(
sdkId: 'alipay',
title: '充值',
amountInCents: 10000, // 100.00 元
channel: 2,
);
iOS Configuration #
Add URL Scheme in your Info.plist or configure via pubspec.yaml:
tobias:
url_scheme: your_app_scheme # e.g. tobiastms
This enables the Alipay app to redirect back to your app after payment.
Android Configuration #
No additional configuration required. The tobias package handles everything.
Status Code Mapping #
| Alipay Code | koi_pay_kit Status | Description |
|---|---|---|
9000 |
success |
Payment succeeded |
8000 |
processing |
Payment in progress |
6004 |
processing |
Payment result unknown |
6001 |
cancelled |
User cancelled |
6002 |
networkError |
Network connection error |
4000 |
failed |
Payment failed |
5000 |
failed |
Duplicate request |
Public APIs #
AlipaySdk— implementsPaymentSdkfor Alipay via tobias
Documentation #
License #
MIT. See LICENSE.