PaymentBrowser class

A class that manages the in-app browser for processing payments.

This class handles:

  • Opening a secure in-app browser
  • Loading the payment interface
  • Monitoring payment progress
  • Detecting completion
  • Managing browser lifecycle

Example usage:

final browser = PaymentBrowser(
  paymentUrl: 'https://pay.cofee.com/order/123',
  redirectUrl: 'https://myapp.com/payment/complete',
  onFinishCallback: () => print('Payment completed'),
  onUrlChange: (url) => print('Browser navigated to: $url'),
);

await browser.open();

Constructors

PaymentBrowser.new({required String paymentUrl, required String redirectUrl, required BrowserCompletionCallback onFinishCallback, required UrlChangeCallback onUrlChange})
Creates a new PaymentBrowser instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
onFinishCallback BrowserCompletionCallback
Callback invoked when the payment process completes.
final
onUrlChange UrlChangeCallback
Callback invoked when the browser navigates to a new URL.
final
paymentUrl String
The URL of the payment page to load.
final
redirectUrl String
The URL where the browser should redirect after payment.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the payment browser.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open() Future<void>
Opens the payment browser and starts the payment process.
toString() String
A string representation of this object.
inherited

Operators

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