Skip to content

Checkout Controller Sketch.#13290

Closed
jaynewstrom-stripe wants to merge 6 commits into
masterfrom
jaynewstrom/checkout-flow-components-boilerplate
Closed

Checkout Controller Sketch.#13290
jaynewstrom-stripe wants to merge 6 commits into
masterfrom
jaynewstrom/checkout-flow-components-boilerplate

Conversation

@jaynewstrom-stripe

Copy link
Copy Markdown
Collaborator

Summary

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

Comment on lines +30 to +32
fun confirm() {
controller.confirm()
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if there are any issues with having this be top-level on CheckoutPresenter rather than a function on e.g. PaymentElement:

  • Can you confirm if you are just showing a currency selector or shipping address element? It seems unlikely that you'd have a payment method to confirm?
  • What if we wanted to provide different sets of confirmation definitions to different elements (e.g. maybe payment element and ECE have different confirmation definitions available to them)? This might be theoretical

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where it lives is more of an API design choice I think. This is the public confirm, which should only affect selections made via payment element (I might be over simplifying this, but it's my current assumption).

We can use different confirmation definitions for ECE, and an entirely different confirmationHandler instance if we desire to -- but that should be implementation details. But again, probably over simplifying things in my head right now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which should only affect selections made via payment element (I might be over simplifying this, but it's my current assumption)

oh yeah this makes sense. Because other integrations either don't enable selecting a payment option (e.g. currency selector) or they handle confirm within their own ui (e.g. ECE)


private lateinit var presenter: CheckoutPresenter

override fun onCreate(savedInstanceState: Bundle?) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this impl feels like a pretty nice separation between business logic + UI!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The roughest edge I see right now is how do we force the merchant to create the presenter? Maybe they have everything they need via the controller, until the user clicks a button to present/confirm. Which could be a failure mode.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the failure mode exactly? is the merchant creating the presenter in the wrong place? I don't understand how they'd not create the presenter if they are accessing it later in their code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure mode is they create the controller in the view model, and don't create the presenter unconditionally in onCreate. So it would basically be like in their "select a payment method" and "confirm" buttons -- they would do viewModel.createPresenter(this).makePaymentElement().presentPaymentOptions. But I think it's pretty easy to identify/fail during development. So maybe not a huge issue now that I write this out.

@jaynewstrom-stripe jaynewstrom-stripe marked this pull request as draft June 24, 2026 18:25
@jaynewstrom-stripe

Copy link
Copy Markdown
Collaborator Author

#13313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants