API Reference
YandexQuickPay
Точка входа в SDK. Синглтон — доступ через YandexQuickPay.instance после initialize().
class YandexQuickPay {
static Future<void> initialize({
required QuickPayConfig config,
required QuickPaymentStateListener listener,
});
static YandexQuickPay get instance;
Future<void> initUi();
Future<bool> isQuickPaymentEnabled();
Future<bool> enableQuickPayment();
Future<bool> disableQuickPayment();
Future<String> getPaymentSessionId();
Future<bool> login();
Future<void> logout();
Future<bool> handleUserActivity(String url);
Future<bool> handleOpenURL(String url);
Future<void> showActivePaymentMethod();
Future<void> hideActivePaymentMethod();
}
| Метод | Описание |
|---|---|
initialize(config, listener) |
Инициализация SDK. Вызывать в main() до runApp(). |
instance |
Экземпляр SDK |
initUi() |
Инициализация UI. Вызывать перед оплатой. |
isQuickPaymentEnabled() |
Проверяет, включена ли быстрая оплата |
enableQuickPayment() |
Включает быструю оплату |
disableQuickPayment() |
Отключает быструю оплату |
getPaymentSessionId() |
Возвращает sessionId для генерации QR |
logout() |
Выход, очистка данных |
handleUserActivity(url) |
Universal Links (iOS) |
handleOpenURL(url) |
URL Scheme (iOS) |
showActivePaymentMethod() |
Показать бейдж активного метода |
hideActivePaymentMethod() |
Скрыть бейдж |
QuickPayConfig
class QuickPayConfig {
const QuickPayConfig({
required this.merchantId,
required this.environment,
this.locale = QuickPayLocale.system,
this.theme = QuickPayThemeColorScheme.system,
});
final String merchantId;
final QuickPayEnvironment environment;
final QuickPayLocale locale;
final QuickPayThemeColorScheme theme;
}
QuickPaymentStateListener
class QuickPaymentStateListener {
const QuickPaymentStateListener({
this.onPaymentEnabledStateChanged,
this.onSessionExpired,
this.onPaymentResult,
});
final void Function(bool isEnabled)? onPaymentEnabledStateChanged;
final VoidCallback? onSessionExpired;
final void Function(QuickPayResult result)? onPaymentResult;
}
QuickPayResult
sealed class QuickPayResult {}
class QuickPaySuccess extends QuickPayResult {}
class QuickPayFailure extends QuickPayResult {}
YandexPaymentMethodsWidget
class YandexPaymentMethodsWidget extends StatefulWidget {
const YandexPaymentMethodsWidget({
super.key,
this.minHeight = 100,
this.width,
this.animationDuration = const Duration(milliseconds: 200),
});
final double minHeight;
final double? width;
final Duration animationDuration;
}
YandexActivePaymentMethodBadge
class YandexActivePaymentMethodBadge extends StatelessWidget {
const YandexActivePaymentMethodBadge({
super.key,
this.height = 48,
this.width,
});
final double height;
final double? width;
}
QuickPayEnvironment
enum QuickPayEnvironment {
sandbox,
production,
}
Была ли статья полезна?
Предыдущая
Следующая