Activate ECP mode: append ec_version, source, and ec_color_scheme to checkout URL#38
Open
tiagocandido wants to merge 1 commit into
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
9740f88 to
37129c1
Compare
b7ef569 to
f22155a
Compare
f22155a to
4667dde
Compare
4667dde to
3dacb21
Compare
markmur
approved these changes
May 13, 2026
Comment on lines
+116
to
+122
| val client = CheckoutProtocol.Client() | ||
| .on(CheckoutProtocol.start) { Timber.i("ECP ec.start: $it") } | ||
| .on(CheckoutProtocol.complete) { Timber.i("ECP ec.complete: $it") } | ||
| .on(CheckoutProtocol.error) { Timber.i("ECP ec.error: $it") } | ||
| .on(CheckoutProtocol.buyerChange) { Timber.i("ECP ec.buyer.change: $it") } | ||
| .on(CheckoutProtocol.totalsChange) { Timber.i("ECP ec.totals.change: $it") } | ||
| .on(CheckoutProtocol.lineItemsChange) { Timber.i("ECP ec.line_items.change: $it") } |
Contributor
There was a problem hiding this comment.
Just missing messages.change here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changes are you making?
Activates Embedded Checkout Protocol (ECP) mode on Android by appending the required query params to the checkout URL before it is loaded into the WebView, and aligns the typed consumer client with Swift PR #65.
Without
ec_versionin the URL, checkout-web'sisLikelyEmbedFromUrl()returnsfalseand ECP mode never initialises —ec.ready,ec.start, and all other protocol messages are never sent to the native side.URL activation:
CheckoutWebView.buildEcpUrl(): new private helper, called fromloadCheckout()beforeloadUrl(), that idempotently appends:ec_version— activates ECP mode in checkout-web.source— sameShopifyCheckoutKit/<version> (Android;<os>[;<platform>;<version>])token used in the User Agent, providing a redundant signal for iframes that can't read the UA header.ec_color_scheme—lightordarkwhen an explicit scheme is configured; omitted forAutomaticandWeb.BaseWebView.buildSourceToken(): extracted fromuserAgentSuffix()so the same token is shared by both the User Agent and thesourceparam.Platform: changed fromenum classtosealed classso each subtype can carry an instance-levelversion: String?.ReactNativegains an optional version argument (@JvmOverloadspreserves Java interop)."ShopifyCheckoutKit/x (Android; <os>[; <platform>; <version>])"— aligns with browser UA conventions and matches thesourceparam format.Typed client alignment with Swift PR #65:
CheckoutProtocol.specVersion: corrected from unrecognised"2026-01-11"to"2026-04-08"(the version that supports unauthenticated ECP).CheckoutProtocol.readyandCheckoutProtocol.paymentChangedescriptors — neither is exposed by Swift PR Wire Swift kit for UCP events #65.ec.readyis fully handled insideEmbeddedCheckoutProtocol(ACK-only) andec.payment.changeonly fires when payment is delegated, which this SDK does not yet support.CheckoutProtocol.errordescriptor with a typedCheckoutErrorpayload (code,content,severity) decoded fromparams.messages[0].ExtendsSerializerfor theExtendssealed class so it accepts both the string shape ("extends": "dev.ucp.shopping.checkout") and the array shape that checkout-web actually sends. Without this,kotlinx.serialization's generated serializer threw on everyCheckoutpayload and no typed handler ever fired.BaseWebView.ECP_LOG_TAG) across the bridge and the typed client; added a payload-decoded log line so consumers can see exactly what their handler is receiving.CheckoutWebViewJS;CheckoutECPis reserved for ECP bridge traffic so consumers can filter the protocol stream cleanly (adb logcat -s CheckoutECP:D).How to test
Unit tests (no device required):
Manual (sample app on device/emulator):
platforms/android/samples/MobileBuyIntegration.← RECV: method=ec.ready ...followed byec.start,ec.totals.change, etc., and aDecoded payload for method=...: Checkout(...)line for each typed handler.Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
platforms/swift/ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/CHANGELOG.mdplatforms/swift/README.md(major version only)Releasing a new Android version?
versionNameinplatforms/android/lib/build.gradleplatforms/android/CHANGELOG.mdplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.