One package for Android and iOS. The portal opens in a full-screen WebView.
esaalat· DartAdd the package with Flutter.
flutter pub add esaalatwebview_flutter. Android 5+ and iOS 12+.Create the client once, then call open() with a mounted context.
1import 'package:esaalat/esaalat.dart';
2
3final checkout = EsaalatCheckout(publishableKey: 'pk_live_...');
4
5Future<void> pay() async {
6 final result = await checkout.open(
7 context,
8 amount: '5000.00',
9 currency: 'YER',
10 externalOrderId: 'order-123',
11 );
12
13 if (result.status == CheckoutResultStatus.verified) {
14 // Show success; fulfil only after payment.verified.
15 }
16}CANCELLED.Constructor and open() options. Amounts are decimal strings.
| Option | Type | Required | Description |
|---|---|---|---|
publishableKey | String | Required | Dashboard → API Keys. Safe to embed; it can only create checkout sessions. |
locale | EsaalatLocale | Optional | Portal language. Defaults to EsaalatLocale.ar; open(locale:) overrides it. |
apiBaseUrl | String | Optional | API root. Defaults to https://api.esaalat.com/api/v1. |
portalBaseUrl | String | Optional | Fallback portal origin when the response has no portal_url. Defaults to https://pay.esaalat.com. |
amount | String | Optional | Order total, for example '5000.00'. Required unless items or sessionToken is supplied. |
items | List<CheckoutItem> | Optional | Order lines with name, price, optional description and quantity. Items determine the amount. |
externalOrderId | String | Optional | Your order reference. Returned in the result and in the payment.verified webhook. |
sessionToken | String | Optional | Open a session created by your server instead of creating one in the app. |
portalUrl | String | Optional | Portal URL for that session. Optional; the SDK builds it when omitted. |
idempotencyKey | String | Optional | UUID v4 retry key. Reuse it when retrying a create; generated per call when omitted. |
simulateResult | CheckoutSimulation | Optional | Demo outcome: verified, underpaid, overpaid, cancelled or expired. Refused unless the key allows simulation. |
pollInterval | Duration | Optional | How often the WebView checks the public session. Defaults to four seconds. |
A checkout ends with one of these statuses.
{
"status": "VERIFIED",
"reason": null,
"sessionToken": "640c912d-3ffe-4703-b951-52970c693c41",
"intentCode": "ZR269MP",
"amount": "5000.00",
"paidAmount": null,
"currency": "YER",
"externalOrderId": "order-123",
"merchantName": "Esaalat Store"
}| Status | Meaning |
|---|---|
VERIFIED | The payment matched the order and the amount was verified. |
WRONG_AMOUNT | The payment matched the order, but the amount differs. Read paidAmount to see what arrived. |
EXPIRED | The buyer did not finish before the payment window closed. |
CANCELLED | The buyer closed the checkout, or the intent was cancelled. |
FAILED | The portal could not load a valid session. |
VERIFIED is not permission to fulfil. Confirm the order from the signed payment.verified webhook first.These errors occur before a checkout opens. A checkout that opens but ends with a bad status returns a result, not an exception.
| Code | When it happens |
|---|---|
configuration | Missing publishableKey, an invalid API URL, or no amount, items or sessionToken. |
network | The request timed out or could not reach the API. |
api | The API returned a non-2xx response. The error includes the HTTP status and response body where the platform supports it. |
session | The response was not a valid session, the session is unknown, or the portal URL is invalid. |
unavailable | The checkout could not be presented, for example because the host activity or app root no longer exists. |
aborted | The operation was cancelled before it settled. |
Failures throw EsaalatCheckoutError. Check code, and message.
Use the SDK result only for the buyer's screen. Confirm the order from the signed payment.verified webhook before fulfilment.