Skip to content

using Google Pay button API in demo app#1606

Open
dmengelt wants to merge 3 commits into
braintree:mainfrom
dmengelt:demo-app-google-pay-button
Open

using Google Pay button API in demo app#1606
dmengelt wants to merge 3 commits into
braintree:mainfrom
dmengelt:demo-app-google-pay-button

Conversation

@dmengelt

Copy link
Copy Markdown

Summary of changes

  • Uses Google Pay's Pay Button API in the Demo App
  • Updates play-services-wallet dependency to 19.5.0
screen-20260527-172756-1779895658031.mp4

AI Usage

Which AI Agent Was Used?

  • Copilot
  • Claude
  • Gemini

How was AI used?

  • code generation
  • refactoring, debugging

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.
@dmengelt

@dmengelt dmengelt requested a review from a team May 27, 2026 16:08
@dmengelt dmengelt requested a review from a team as a code owner May 27, 2026 16:08

@noguier noguier 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.

Hello, can you please add a CHANGELOG entry to record new playServicesWallet = "19.5.0" dependency

contentAlignment = Alignment.Center
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
if (isReadyToPay && allowedPaymentMethods.isNotEmpty()) {

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.

should we give user a feedback in case allowedPaymentMethods are empty here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done. PTAL

"USD",
"1.00",
GooglePayTotalPriceStatus.TOTAL_PRICE_STATUS_FINAL,
isPayPalEnabled = false

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.

if I set isPayPalEnabled to true nothing renders in this fragment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes. The dynamic Google Pay button doesn't work if there is an "type": "PAYPAL" object in the allowedPaymentMethods array.

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.

Interesting. Do you know why that is?

@dmengelt dmengelt Jun 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The dynamic button shows the the card art and last4 digits (if the user had a card on file) and therefore primarily works with "type": "CARD".

@dmengelt dmengelt force-pushed the demo-app-google-pay-button branch from c6f6829 to 5fe2d0f Compare June 2, 2026 09:23
@dmengelt

dmengelt commented Jun 2, 2026

Copy link
Copy Markdown
Author

Hello, can you please add a CHANGELOG entry to record new playServicesWallet = "19.5.0" dependency

Done. Sorry about that.

@dmengelt dmengelt requested a review from noguier June 2, 2026 09:25

@noguier noguier 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.

Thank you for addressing my comments!

@dmengelt

dmengelt commented Jun 8, 2026

Copy link
Copy Markdown
Author

@noguier anything more needed from my side or is this ready to merge? 🙂

@noguier

noguier commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@dmengelt we are just waiting on one more review from my team, thank you for your patience!

@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 button looks super cool! I also appreciate the labor to move over to compose. I just have a couple of comments that could use a look. Thanks!

Comment thread CHANGELOG.md Outdated
* BraintreeCore
* Allow fetching of `Configuration` to query supported integrations and card types (fixes #1302)
* Google Pay
* Update Google Pay dependency (play-services-wallet) to version 19.5.0

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.

Can you please move this under an unreleased header at the top of this file? We also try to keep spacing to 4 space tabs, could you try to match that for this entry as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I actually had this under the unreleased header: 5fe2d0f#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR7

Updated again 👍

"USD",
"1.00",
GooglePayTotalPriceStatus.TOTAL_PRICE_STATUS_FINAL,
isPayPalEnabled = false

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.

Interesting. Do you know why that is?

Comment on lines +79 to +92
val request = GooglePayRequest(
"USD",
"1.00",
GooglePayTotalPriceStatus.TOTAL_PRICE_STATUS_FINAL,
isPayPalEnabled = false
)
googlePayClient.createPaymentAuthRequest(request) { authRequest ->
if (authRequest is GooglePayPaymentAuthRequest.ReadyToLaunch) {
val json =
JSONObject(authRequest.requestParams.paymentDataRequest.toJson())
allowedPaymentMethods =
json.getJSONArray("allowedPaymentMethods").toString()
}
}

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.

Correct me if I'm reading this wrong, but this whole series of operations looks like a throw away just to gather the value of allowedPaymentMethods. Can you find a way to gather this information without making unnecessary calls? On top of this being slower, createPaymentAuthRequest triggers analytics that would just be noise

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done. PTAL

Comment thread gradle/libs.versions.toml
cardinal = { group = "org.jfrog.cardinalcommerce.gradle", name = "cardinalmobilesdk", version.ref = "cardinal" }
paypal-messages = { module = "com.paypal.messages:paypal-messages", version.ref = "paypalMessages" }
play-services-wallet = { group = "com.google.android.gms", name = "play-services-wallet", version.ref = "playServices" }
play-services-wallet = { group = "com.google.android.gms", name = "play-services-wallet", version.ref = "playServicesWallet" }

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.

If this rename isn't strictly necessary could you please leave this as is?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I can revert this but playServices is misleading IMO 🙂 WDYT?

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.

Yeah I agree it's not the most intuitive naming. I generally try to keep unnecessary changes to a minimum since it's critical to keep current integrations functioning as expected but I was too hasty here. Renaming something in this file should be 100% safe since it's only internally accessible. Feel free to leave it

@dmengelt dmengelt force-pushed the demo-app-google-pay-button branch from 992fe17 to e1642cb Compare June 15, 2026 10:12
@dmengelt

Copy link
Copy Markdown
Author

@saralvasquez let me know if any more changes are needed.

@dmengelt dmengelt force-pushed the demo-app-google-pay-button branch from e1642cb to 68d3ded Compare June 15, 2026 19:51
@dmengelt

Copy link
Copy Markdown
Author

Fixed the Android Lint errors

Comment thread CHANGELOG.md
Signed-off-by: Sara Vasquez <98496950+saralvasquez@users.noreply.github.com>

@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.

Looks good! 🎉

@dmengelt

Copy link
Copy Markdown
Author

@saralvasquez any clue why the dependency-review fails?

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