checkout/checkout_host_page
library
Constants
-
checkoutHostOrigin
→ const String
-
Origin the host page is loaded under (via a base URL, nothing is fetched
from it). payment-link treats it as the merchant page: it is passed as
parentOrigin and results are postMessaged to it.
-
checkoutHostUrl
→ const String
-
URL of the host page itself; also the
callbackUrl payment-link falls back
to when it cannot postMessage a result.
-
flutterSdkQueryParam
→ const String
-
Query parameter telling the payment page it runs inside this Flutter SDK,
always
true.
-
upiAppsQueryParam
→ const String
-
Query parameter carrying the installed UPI app ids to the payment page,
comma separated.
-
webSdkCheckoutUrlPlaceholder
→ const String
-
The checkout URL baked into the bundled web SDK by
tool/build_web_sdk.sh, replaced per environment at runtime.
-
webSdkUpiSessionStorageKey
→ const String
-
localStorage key of the web SDK's in-progress v2 UPI session
(
UPI_SESSION_STORAGE_KEY in the web SDK).
Functions
-
buildCheckoutHostPage({required String webSdk, required CofeeCheckoutOptions options, required String orderId, required String bridgeToken, List<String> upiApps = const []})
→ String
-
Builds the HTML page that runs the web SDK inside the native WebView and
relays its callbacks to the
CofeeNative bridge as JSON messages:
success, failed, dismiss and finally closed once the overlay is
gone. Each message carries bridgeToken. The payment page URL is built
by paymentPageUrl.
-
generateBridgeToken()
→ String
-
A random per-checkout secret the host page adds to every bridge message.
Native code drops messages without it, so other frames (the checkout
iframe, bank pages), which cannot read the host page's script, cannot
send results even where the bridge is visible to them.
-
loadWebSdk()
→ Future<String>
-
Loads the bundled web SDK script.
-
paymentPageUrl(String checkoutUrl, {List<String> upiApps = const []})
→ String
-
The payment page URL:
checkoutUrl plus flutterSdkQueryParam and, when
any are found, upiApps as upiAppsQueryParam. The web SDK keeps query
parameters already on its checkout URL when it adds its own.