CofeeCheckout class

CoFee Checkout for Flutter. Opens the same checkout as the CoFee Checkout web SDK (@cofee/checkout-web-sdk), full screen in a native WebView.

Create one with your merchant settings and reuse it for every payment. Each open takes the order and returns its final CheckoutResult. on listeners receive every event as it happens, each with its order id.

Results are client-side signals only: always verify the payment on your server before fulfilling the order.

final cofee = CofeeCheckout(const CofeeCheckoutOptions(
  key: 'YOUR_KEY_ID',
  environment: CheckoutEnvironment.sandbox,
  name: 'Acme Corp',
));

final result = await cofee.open(orderId: 'ord_…');
if (result is CheckoutSuccess) {
  // Payment completed. Verify on your server.
} else if (result is CheckoutFailed) {
  print('${result.error.code}: ${result.error.description}');
} else {
  // CheckoutDismissed: closed without paying.
}

Constructors

CofeeCheckout(CofeeCheckoutOptions options)
Throws ArgumentError for invalid options, as the web SDK constructor throws.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isOpen → bool
Whether the checkout screen is showing.
no setter
options → CofeeCheckoutOptions
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → Future<void>
Closes the checkout. open then completes with CheckoutDismissed unless a payment already succeeded or failed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off<T extends CheckoutResult>(CheckoutEvent<T> event, [void handler(T result)?]) → void
Removes handler, or every listener for event when it is omitted.
on<T extends CheckoutResult>(CheckoutEvent<T> event, void handler(T result)) → void
Registers a listener for event. Listeners receive every event of every payment opened from this checkout, each with its order id.
open({required String orderId}) → Future<CheckoutResult>
Opens checkout for orderId and completes with the final result once checkout closes:
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

debugReset() → void
Resets the open checkout. Tests only.