startCheckout method
Advanced — raw URL escape hatch. For ordinary use, prefer
ZeroSettle.instance.presentPaymentSheet(productId:) or
ZeroSettle.instance.purchase(productId:). Those handle offer
bookkeeping automatically — you don't need to call present() or
markCheckoutSucceeded() yourself.
Use this method only when you need full control over presentation or transport: a custom WebView with bespoke chrome, a third-party browser SDK, or a context where there's no view hierarchy at all.
When you go down this path, you are responsible for calling
markCheckoutSucceeded(transactionId:) after your out-of-band
checkout completes. The auto-bookkeeping path doesn't apply to URLs
you handle yourself.
stripeCustomerId: Optional existing Stripe customer ID for unified billing portal.- Returns the checkout URL for WebView, or
nullfor web-to-web upgrades (handled internally).
Implementation
Future<Uri?> startCheckout({String? stripeCustomerId}) async {
_ensureNotDisposed();
final result =
await _methodChannel.invokeMethod<String?>('startCheckout', {
if (stripeCustomerId != null) 'stripeCustomerId': stripeCustomerId,
});
return result == null ? null : Uri.parse(result);
}