PayorcSdk class

Payorc Payment SDK.

Use PayorcSdk.init to configure the SDK, then PayorcSdk.instance to access it and call payment.

Properties

appId String?
Optional overrides for SDK metadata/device headers.
final
appVersion String?
final
browserToken String?
final
checkoutCustomization CheckoutCustomizationData?
Last successful checkout customization payload, if any.
getter/setter pair
checkoutCustomizationAmount num
Amount sent with the checkout customization request during init.
final
checkoutCustomizationCurrency String
Currency sent with the checkout customization request during init.
final
deviceBrand String?
Optional override for X-DEVICE-BRAND. When null, Android uses AndroidDeviceInfo.brand; iOS uses Apple.
final
deviceId String?
final
deviceModel String?
Optional override for X-Device-Model. When null, Android uses AndroidDeviceInfo.model; iOS uses IosDeviceInfo.utsname.machine (e.g. iPod7,1).
final
deviceOs String?
final
environment PayorcEnvironment
Current environment (sandbox or production).
final
fetchCheckoutCustomizationOnInit bool
When true, init loads checkout customization in the background and applies merchant_details colors to PayorcSdkUiConstants.
final
hashCode int
The hash code for this object.
no setterinherited
initialLanguage PayorcLanguage
final
logoPath String?
Optional path to logo image (asset path, e.g. "assets/logo.png", or URL). Used in the payment gateway UI when set.
getter/setter pair
merchantKey String
Merchant key from Payorc.
final
merchantSecret String
Merchant secret from Payorc.
final
primaryColor Color?
Optional primary color for SDK UI (buttons, accents).
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondaryColor Color?
Optional secondary color for SDK UI.
getter/setter pair
tabbyApiKey String?
Optional Tabby API key for Buy Now Pay Later. When set, the SDK initializes Tabby and enables Tabby in the payment options.
final
tabbyMerchantCode String
Tabby merchant code (provided by Tabby when you onboard). Required for Tabby to work. Use 'ae' for UAE, 'sa' for KSA, or your custom code from Tabby.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
payment(PaymentRequest request) Future<void>
Performs a payment with the given request.
presentPaymentOptionsSheet(BuildContext sheetContext, {required BuildContext themeHostContext, required void onAddNewCard(CardData input), required PaymentRequest paymentRequest, PaymentRequest? addCardRequest, void onApplePayWalletResult(WalletPaymentResult result)?, void onApplePayPaymentResponse(PaymentResponse response)?, void onApplePayResult(Map<String, dynamic> result)?, void onGooglePayResult(Map<String, dynamic> result)?, void onPaymentError(Object? error)?, void onTabbyAuthorized(BuildContext launchingContext, Map<String, dynamic> merchantResponse)?, void onTabbyError(Object? error)?, VoidCallback? onConfirm, VoidCallback? onSamsungPay}) Future<void>
Shows the payment options sheet (Apple Pay, Google Pay, Tabby, Pay with Card). Native wallet buttons use JSON built from checkout customization; if wallet JSON is missing, a Confirm button is shown. When tabbyApiKey is set, Tabby is shown and handled by the SDK. onApplePayResult / onGooglePayResult receive the payment token from the pay package. onPaymentError is called when Apple Pay or Google Pay fails. onTabbyAuthorized is called when Tabby payment is authorized. onTabbyError is called when Tabby payment fails or is rejected.
showOptionsSheet(BuildContext context, {required void onAddNewCard(CardData input), required PaymentRequest paymentRequest, String? customizationCurrency, num? customizationAmount, void onApplePayWalletResult(WalletPaymentResult result)?, void onApplePayPaymentResponse(PaymentResponse response)?, void onApplePayResult(Map<String, dynamic> result)?, void onGooglePayResult(Map<String, dynamic> result)?, void onPaymentError(Object? error)?, void onTabbyAuthorized(BuildContext launchingContext, Map<String, dynamic> merchantResponse)?, void onTabbyError(Object? error)?, VoidCallback? onConfirm, VoidCallback? onSamsungPay}) Future<void>
Shows payment options using PaymentOptionsSheetFlow (refresh customization, then presentPaymentOptionsSheet).
showPayment(BuildContext context, PaymentRequest request, {void onCardSelected(CardData card)?, void onCardAdded(CardData card)?, OrderSummary? orderSummary, List<BillingAddressOption> billingAddresses = const [], String? selectedBillingAddressId, void onBillingAddressSelected(String addressId)?, VoidCallback? onAddNewAddress, void onDeleteAddress(String addressId)?, VoidCallback? onProceedToPayment, void onAddNewCard(CardData card)?, Widget paymentGatewayScreen(BuildContext context, PaymentGatewayParams params)?}) → void
Shows the payment gateway UI (saved cards list + Use new card).
showTabbyCheckout(BuildContext context, {required PaymentRequest paymentRequest, void onTabbyAuthorized(BuildContext launchingContext, Map<String, dynamic> merchantResponse)?, void onTabbyError(Object? error)?}) Future<void>
Opens Tabby BNPL checkout in a WebView (same flow as choosing Tabby from presentPaymentOptionsSheet). Credentials come from POST .../sdk/tabby/init.
toString() String
A string representation of this object.
inherited
verifyCard({required BuildContext context, required CardData card, required void onCardVerified(CardData input), bool showCardVerifiedSheet = true, required PaymentRequest request}) Future<void>
Runs the "Proceed to Payment" flow: shows 3D Secure initiating sheet, then OTP entry sheet. Call this from your payment gateway screen when the user taps "Proceed to Payment". When request is provided, the OTP sheet shows the order amount from request.orderDetails instead of $0.00 (Verification).

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

addCardFormCustomization PayorcSdkAddCardFormCustomization?
Current add/edit card sheet copy overrides (merged from customization).
no setter
appBarStyle PayorcAppBarStyle
Current app bar behavior used by SDK native scaffolds.
no setter
autoselectColor int?
Resolved merchant_details.autoselect_color (host override, then API).
no setter
botToastNavigatorObservers List<NavigatorObserver>
BotToast (used by SDK base alerts) needs a one-time host setup.
no setter
cardFormValidation PayorcSdkCardFormValidationCustomization?
Current add-card form validation overrides.
no setter
checkoutCustomizationRevision ValueNotifier<int>
Incremented when checkout customization is applied; listen to rebuild payment UI (e.g. ListenableBuilder) after availableMethods update.
final
clientIp String?
Client public IP, sent as X-IP on signed PayOrc requests when set.
getter/setter pair
clientIpCountryCode String?
Client country code (e.g. ISO 3166-1 alpha-2), sent as X-IP-COUNTRY.
getter/setter pair
currentLanguage PayorcLanguage
no setter
currentLocale Locale
no setter
guidanceStyle PayorcGuidanceStyle
Current input guidance style used by AppTextField.
no setter
inputBorderStyle PayorcInputBorderStyle
Current input border style used by AppTextField.
no setter
instance PayorcSdk
Returns the current SDK instance.
no setter
isInitialized bool
Whether the SDK has been initialized.
no setter
serviceSdkCookie String?
Optional full Cookie header value for service-sdk requests (e.g. ingress INGRESSCOOKIE=...). Omit in normal mobile flows.
getter/setter pair
textDirection TextDirection
no setter
uiCustomizationRevision ValueNotifier<int>
final

Static Methods

applyCheckoutCustomizationResponse(PayorcSdk sdk, CheckoutCustomizationResponse response) → void
Updates sdk from response when sdk is still the active instance.
buildPaymentGatewayParams(PaymentRequest request, {PaymentRequest? addCardRequest, void onCardSelected(CardData card)?, OrderSummary? orderSummary, List<BillingAddressOption> billingAddresses = const [], String? selectedBillingAddressId, void onBillingAddressSelected(String addressId)?, VoidCallback? onAddNewAddress, void onDeleteAddress(String addressId)?, VoidCallback? onProceedToPayment, void onAddNewCard(CardData card)?}) PaymentGatewayParams
Builds PaymentGatewayParams for use with your own navigation (e.g. Navigator.push to PaymentGatewayScreen) instead of passing paymentGatewayScreen to showPayment.
customization({PayorcInputBorderStyle? inputBorderStyle, PayorcGuidanceStyle? guidanceStyle, PayorcAppBarStyle? appBarStyle, Color? brandColor, PayorcSdkButtonCustomization? button, Color? accentColor, PayorcSdkTextCustomization? text, Color? textPrimary, Color? textSecondary, PayorcSdkCardFormValidationCustomization? cardFormValidation, PayorcSdkAddCardFormCustomization? addCardForm, PayorcSdkAppTextFieldCustomization? appTextField, PayorcSdkBottomSheetCustomization? bottomSheet, Color? borderColor, int? autoselectColor}) → void
Applies host UI customization merged with checkout merchant_details.
customizationQueryForPaymentRequest(PaymentRequest paymentRequest, {String? customizationCurrency, num? customizationAmount}) → (String?, num?)
Resolves (currency, amount) for refreshCheckoutCustomization from paymentRequest, with optional overrides (same rules as PaymentOptionsSheetFlowBloc).
ensureCheckoutCustomizationLoaded(PaymentRequest paymentRequest, {String? currency, num? amount}) Future<void>
Ensures checkout customization is loaded before wallet or sheet flows need it.
init({required String merchantKey, required String merchantSecret, required PayorcEnvironment environment, String? tabbyApiKey, String tabbyMerchantCode = 'ae', PayorcLanguage language = PayorcLanguage.english, String? appId, String? appVersion, String? deviceId, String? deviceOs, String? deviceModel, String? deviceBrand, String? browserToken}) PayorcSdk
Initializes the SDK with merchant credentials and environment.
refreshCheckoutCustomization({String? currency, num? amount}) Future<void>
Reloads checkout customization from the service-sdk (same URL as init).
setClientGeoHeaders({String? ip, String? countryCode}) → void
Sets optional geo headers for add-card and payment API calls.
setServiceSdkCookie(String? cookie) → void
Sets optional Cookie on signed service-sdk calls. Pass null or empty to clear.
wrapMaterialAppBuilder({TransitionBuilder? builder}) TransitionBuilder
Composes BotToastInit with an optional host MaterialApp.builder.