Skip to content

Add Basic Pay Later Buttons - #1723

Open
agedd wants to merge 16 commits into
pay-later-button-featurefrom
add-basic-pay-later-button
Open

agedd wants to merge 16 commits into
pay-later-button-featurefrom
add-basic-pay-later-button

Conversation

@agedd

@agedd agedd commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

  • Add a basic Pay Later button (XML view) to the existing payment button stack, following the same pattern as the PayPal and Venmo buttons.
Screen_recording_20261014_114913.webm

AI Usage

Which AI Agent Was Used?

  • Copilot
  • Claude
  • Other (Type Name Here)

How was AI used?
unit test generation and xml asset loading

Estimated AI Code Contribution

  • less than 30%
  • 30 - 60%
  • 60 - 100%

Checklist

  • [ ] Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.

@agedd
agedd requested a review from a team as a code owner October 14, 2026 16:07
@agedd
agedd changed the base branch from pay-later-button-feature to add-wordmark-assets October 14, 2026 16:07
@agedd
agedd added this pull request to stack #1724 October 14, 2026 16:07
Base automatically changed from add-wordmark-assets to pay-later-button-feature October 15, 2026 23:17
@agedd
agedd force-pushed the add-basic-pay-later-button branch from fd3c553 to b241352 Compare October 15, 2026 23:17

@saralvasquez saralvasquez left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This generally looks great! A couple high level questions I think are worth asking

  • The code for the pay later button is basically the same as that PayPalButton code. Is there any way to extract out a base class or something to reduce the amount of duplicated code?
  • I noticed there weren't any analytics in here. Are those getting added later?

Comment thread Demo/src/main/java/com/braintreepayments/demo/UIComponentsFragment.kt Outdated
@saralvasquez

Copy link
Copy Markdown
Contributor

Op also looks like there are lint errors somewhere

agedd and others added 2 commits October 21, 2026 10:32
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@agedd

agedd commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

This generally looks great! A couple high level questions I think are worth asking

  • The code for the pay later button is basically the same as that PayPalButton code. Is there any way to extract out a base class or something to reduce the amount of duplicated code?
  • I noticed there weren't any analytics in here. Are those getting added later?

ah yep, agreed. i pulled the color/style mapping into a shared PaymentButtonStyle. the remaining duplication appears to be the drawing and the paypal flow logic. analytics will be added in a follow-up PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@saralvasquez

Copy link
Copy Markdown
Contributor

Ok cool! I think I was also wondering if there was a way to separate out the drawing methods since they are also really similar and then have both the PayPalButton and PayLaterButton both use the shared class for style and drawing? Do you think that would be a possibility? I just think it would make future changes a bit easier if it was all in one place

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@agedd

agedd commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Ok cool! I think I was also wondering if there was a way to separate out the drawing methods since they are also really similar and then have both the PayPalButton and PayLaterButton both use the shared class for style and drawing? Do you think that would be a possibility? I just think it would make future changes a bit easier if it was all in one place

yes, great callout. i've pulled the drawing, sizing, spinner logic into an internal PaymentButtonRenderer that both PayPalButton and PayLaterButton now delegate to, so future style/drawing logic lives in one place.

@mzlangreder mzlangreder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there scenarios where we might fail while still loading?

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@saralvasquez

Copy link
Copy Markdown
Contributor

Op. The AI just uncovered a bug in the payment buttons. If there is a failure that doesn't route through handleReturnToApp, like sending a bad request, the button gets stuck in the loading state since hideLoading is never called. Not something that necessarily need to be fixed in this PR since it's pre-existing, but I'll write up a ticket for it

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@agedd

agedd commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Are there scenarios where we might fail while still loading?

ah yes, i think failures from createPaymentAuthRequest, a failed launch, and the null-activity case would have left the button disabled. added hideLoading(). each of those paths now calls hideLoading() before notifying the callback. i've also moved the re-enable in handleReturnToApp to after tokenize completes instead of when it starts.

@saralvasquez

Copy link
Copy Markdown
Contributor

added hideLoading(). each of those paths now calls hideLoading() before notifying the callback

Great! Thank you! I'll update the bug ticket to only include the venmo button since this fixes the other two. Also, are there tests for these cases? I'm not sure I see any where we check to make sure the button is re-enabled after the failure cases

@saralvasquez saralvasquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think with confirmation of the test cases I mentioned above this is ready to go. Great work!

This branch has not been deployed

No deployments
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.

3 participants