enableExternalWebCheckout method

  1. @override
Future<void> enableExternalWebCheckout({
  1. required String successURL,
  2. required String cancelURL,
  3. Set<HeliumWebCheckoutProcessor>? paymentProcessors,
})
override

Enable External Web Checkout (Paddle/Stripe). iOS only; no-op on Android.

Implementation

@override
Future<void> enableExternalWebCheckout({
  required String successURL,
  required String cancelURL,
  Set<HeliumWebCheckoutProcessor>? paymentProcessors,
}) async {
  if (!Platform.isIOS) {
    log('[Helium] enableExternalWebCheckout is only available on iOS');
    return;
  }
  if (paymentProcessors != null && paymentProcessors.isEmpty) {
    log('[Helium] enableExternalWebCheckout: paymentProcessors must not be empty. '
        'Omit it to enable all, or pass {HeliumWebCheckoutProcessor.paddle} or {HeliumWebCheckoutProcessor.stripe}.');
    return;
  }
  try {
    await methodChannel.invokeMethod<void>(
      enableExternalWebCheckoutMethodName,
      {
        'successURL': successURL,
        'cancelURL': cancelURL,
        if (paymentProcessors != null)
          'paymentProcessors':
              paymentProcessors.map((p) => p.name).toList(),
      },
    );
  } catch (e) {
    log('[Helium] Failed to enable External Web Checkout: $e');
  }
}