initialize method
void
initialize({
- required String checkoutHost,
- required String merchantKey,
- required String password,
- MobiPayApplePayConfig? applePayConfig,
- MobiPayGooglePayConfig? googlePayConfig,
Initialize MobiPay with your credentials
checkoutHost - Your Mobibox checkout host (e.g., 'https://pay.mobibox.io')
merchantKey - Your merchant key
password - Your merchant password
applePayConfig - Optional Apple Pay configuration. When provided,
startPayment automatically shows a native Apple Pay button above the
card fields (see MobiPayApplePayConfig for prerequisites).
googlePayConfig - Optional Google Pay configuration, same behavior
on Android (see MobiPayGooglePayConfig for prerequisites).
Implementation
void initialize({
required String checkoutHost,
required String merchantKey,
required String password,
MobiPayApplePayConfig? applePayConfig,
MobiPayGooglePayConfig? googlePayConfig,
}) {
_checkoutHost = checkoutHost;
_merchantKey = merchantKey;
_password = password;
this.applePayConfig = applePayConfig;
this.googlePayConfig = googlePayConfig;
_sessionTokenService = MobiPaySessionTokenService(
checkoutHost: checkoutHost,
merchantKey: merchantKey,
password: password,
);
_paymentProcessor = MobiPayPaymentProcessor(
checkoutHost: checkoutHost,
merchantKey: merchantKey,
password: password,
);
}