Add Google Pay display items support for line item breakdown.#13136
Add Google Pay display items support for line item breakdown.#13136jaynewstrom-stripe wants to merge 4 commits into
Conversation
|
Diffuse output: APKDEX |
bb39b4a to
486abb1
Compare
486abb1 to
8b2a30c
Compare
There was a problem hiding this comment.
Should we extract these detekt changes?
| return GooglePayJsonFactory.DisplayItem( | ||
| label = label, | ||
| type = GooglePayJsonFactory.DisplayItem.Type.LINE_ITEM, | ||
| price = unitAmount ?: total, |
There was a problem hiding this comment.
| price = unitAmount ?: total, | |
| price = subtotal, |
from claude's suggestion.
Current:
Widget x2: $10.00 (unit amount)
Tax: $1.60
Total: $21.60 ← doesn't add up
Should this be subtotal instead? That way:
Widget x2: $20.00 (line subtotal)
Tax: $1.60
Total: $21.60 ← adds up
There was a problem hiding this comment.
Also we should have tests for this.
There was a problem hiding this comment.
The fix needs #13187
I was going to follow up with a more complete fix.
|
|
||
| checkoutSession.totalSummary?.let { summary -> | ||
| items += summary.discountAmounts.map { it.asDisplayItem() } | ||
| items += summary.taxAmounts.map { it.asDisplayItem() } |
There was a problem hiding this comment.
For the TaxAmount that is already inclusive, this would double-counts the tax.
So if a line item costs $10.00 with 8% inclusive tax ($0.74 tax included in the $10.00):
Widget: $10.00 ← already includes tax
Tax: $0.74 ← adding this double-counts
---
Displayed: $10.74 but actual total is $10.00
There was a problem hiding this comment.
Line items won't include tax after #13187
| args: GooglePayPaymentMethodLauncherContractV2.Args | ||
| ): GooglePayJsonFactory.TransactionInfo { | ||
| // Google Pay requires totalPriceLabel when displayItems are present. | ||
| val label = args.label ?: if (args.displayItems.isNotEmpty()) "Total" else null |
There was a problem hiding this comment.
Do we need localized strings?
| class DisplayItem( | ||
| val label: String, | ||
| val type: Type, | ||
| val price: Long, | ||
| ) : Parcelable { |
There was a problem hiding this comment.
Do we need the status as well?
There was a problem hiding this comment.
What is status? What would we need it for?
There was a problem hiding this comment.
From goole pay documentation
The following variables define price variance:
FINAL
PENDING
Default to FINAL if not provided.
I only see this optional field on SHIPPING_OPTION in their example though.
There was a problem hiding this comment.
Is SHIPPING_OPTION out of scope here?
There was a problem hiding this comment.
For now, yes.
Summary
Adds support for displaying line items in the Google Pay payment sheet, allowing merchants to show a detailed breakdown of charges including subtotals, taxes, and discounts.
Motivation
Merchants need to display itemized pricing information in the Google Pay payment sheet to provide transparency to customers about what they're paying for. This feature enables showing individual line items alongside the total price.
Testing
Changelog