Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions platforms/android/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ The sample is a separate Gradle composite (`samples/MobileBuyIntegration/setting

## Where to make changes

- Library source: `lib/src/main/java/com/shopify/checkoutkit/`. Flat package at the top level with a few subpackages (`errorevents/`, `lifecycleevents/`).
- Library source: `lib/src/main/java/com/shopify/checkoutkit/`. Flat package at the top level, including generated protocol models.
- Library tests: `lib/src/test/java/com/shopify/checkoutkit/`. "No test, no merge" is a listed reject criterion in the repo-root `.github/CONTRIBUTING.md`.
- Java interop is a first-class concern — the library is commonly consumed from Java code. `lib/src/test/java/com/shopify/checkoutkit/InteropTest.java` exercises the public API from Java specifically; treat breakage there as a consumer-facing issue.

## Key components

- **`ShopifyCheckoutKit.kt`** — the public singleton. Entry point for all consumer interactions (configure, present).
- **`CheckoutDialog.kt`** — the dialog that hosts the WebView, including the progress indicator and checkout error coordination.
- **`CheckoutWebView.kt`** — primary WebView. Instruments page loads; routes bridge messages.
- **`BaseWebView.kt`** — abstract base class. Any new WebView variant must extend this so shared configuration (JS interface name, user agent suffix, client handling) is consistent.
- **`CheckoutBridge.kt`** — the JS ↔ native bridge. `SCHEMA_VERSION` is a cross-boundary contract with the web checkout team; bumping it requires coordination with them.
- **`CheckoutWebView.kt`** — primary WebView. Instruments page loads and attaches the ECP JavaScript interface.
- **`BaseWebView.kt`** — abstract base class. Any new WebView variant must extend this so shared configuration (user agent suffix, WebChromeClient hooks, navigation error handling) is consistent.
- **`EmbeddedCheckoutProtocol.kt`** — the Embedded Checkout Protocol JavaScript interface. Handles `ec.ready`, ECP notifications, and request/response delegations.
- **`Configuration.kt`** — runtime config container (color scheme, log level).
- **`CheckoutListener.kt`** + **`DefaultCheckoutListener`** — consumer-implemented lifecycle interface (failure, cancellation, permission prompts, file chooser). Changes here are consumer API changes.
- **`CheckoutPresentation.kt`** — Kotlin-first builder for per-presentation callbacks (`onFail`, `onCancel`, browser/system hooks, ECP `connect(...)`). Builds a `DefaultCheckoutListener` internally.
Expand Down Expand Up @@ -94,5 +94,4 @@ Publishing goes through GitHub Releases → the repo-root `.github/workflows/and

- **Library Kotlin version pin.** Consumer compatibility floor; any migration is a deliberate major-version decision.
- **`minSdk` / JVM target.** Same story.
- **`CheckoutBridge.SCHEMA_VERSION`.** Cross-team contract with the web checkout — changing it without coordination breaks the bridge.
- **`-Xexplicit-api=strict`.** Removing this would let implicit public declarations ship; keeping it is a consumer-protection invariant.
23 changes: 3 additions & 20 deletions platforms/android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,9 @@ recreate the cart, retry later, or show an error state in the host app.

| Exception Class | Error Code | Description | Recommendation |
| ------------------------------ | ------------------------------ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `ConfigurationException` | 'storefront_password_required' | Access to checkout is password protected. | We are working on ways to enable the Checkout Kit for usage with password protected stores. |
| `ConfigurationException` | 'unknown' | Other configuration issue, see error details for more info. | Resolve the configuration issue in the error message. |
| `CheckoutExpiredException` | 'cart_expired' | The cart or checkout is no longer available. | Create a new cart and open a new checkout URL. |
| `CheckoutExpiredException` | 'cart_completed' | The cart associated with the checkout has completed checkout. | Create new cart and open a new checkout URL. |
| `CheckoutExpiredException` | 'invalid_cart' | The cart associated with the checkout is invalid (e.g. empty). | Create a new cart and open a new checkout URL. |
| `CheckoutKitException` | 'error_receiving_message' | Checkout Kit failed to receive a message from checkout. | Handle as a checkout failure in the host app. |
| `CheckoutKitException` | 'error_sending_message' | Checkout Kit failed to send a message to checkout. | Handle as a checkout failure in the host app. |
| `CheckoutKitException` | 'render_process_gone' | The render process for the checkout WebView is gone. | Handle as a checkout failure in the host app. |
| `CheckoutKitException` | 'unknown' | An error in Checkout Kit has occurred, see error details for more info. | Handle as a checkout failure in the host app. |
| `CheckoutKitException` | 'render_process_gone' | The render process for the checkout WebView is gone. | Handle as a checkout failure in the host app. |
| `HttpException` | 'http_error' | An unexpected server error has been encountered. | Handle as a checkout failure in the host app. |
| `ClientException` | 'client_error' | An unhandled client error was encountered. | Handle as a checkout failure in the host app. |
| `CheckoutUnavailableException` | 'unknown' | Checkout is unavailable for another reason, see error details for more info. | Handle as a checkout failure in the host app. |

#### Exception Hierarchy

Expand All @@ -361,32 +352,24 @@ recreate the cart, retry later, or show an error state in the host app.
title: Checkout Kit Exception Hierarchy
---
classDiagram
CheckoutException <|-- ConfigurationException
CheckoutException <|-- CheckoutExpiredException
CheckoutException <|-- CheckoutKitException
CheckoutException <|-- CheckoutUnavailableException
CheckoutUnavailableException <|-- HttpException
CheckoutUnavailableException <|-- ClientException

<<Abstract>> CheckoutException
CheckoutException : +String errorDescription
CheckoutException : +String errorCode
class ConfigurationException{
note: "Store or checkout configuration issues."
}
class CheckoutExpiredException{
note: "Expired or invalid carts/checkouts."
note: "Expired checkouts."
}
class CheckoutUnavailableException{
note: "Unexpected errors."
note: "Base class for availability failures."
}
class HttpException{
note: "Unexpected Http response"
+int statusCode
}
class ClientException{
note: "Unexpected client/web error"
}
class CheckoutKitException{
note: "Error in Checkout Kit code"
}
Expand Down
Loading
Loading