feat: Added support for different Layout types#78
Open
Pradeep-kumar1202 wants to merge 5 commits into
Open
Conversation
| surface = "#F5F8F9".toColorInt(), | ||
| ) | ||
|
|
||
| val layout = PaymentSheet.Layout( |
Contributor
There was a problem hiding this comment.
change this structure to expose options for customizing layouts like spacedAcccordion only when layout is accordion
| fun locale(locale: String) = apply { this.locale = locale } | ||
| fun layout(layout: Layout) = apply { this.layout = layout } | ||
|
|
||
| fun build() = Appearance( |
Contributor
There was a problem hiding this comment.
why is this needed?
8684930 to
6b61d41
Compare
ChiragKV-Juspay
approved these changes
Mar 30, 2026
659def4 to
745466c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds native Android API support for structured layout configuration in the Payment Sheet. Merchants can now customize the payment UI layout type, arrangement, and saved method grouping behavior through a typed Kotlin API.
What's New
PaymentSheet.Layout— Sealed class withTabsandAccordionvariantsPaymentMethodsArrangement— Enum to switch betweenDefault(horizontal scroll) andGridlayoutGroupingBehavior— Controls whether saved methods are grouped by payment type or shown inlineSavedMethodCustomization— Wraps grouping behavior config for saved payment methodsspacedAccordionItems,maxAccordionItems,radiosKey Changes
PaymentSheet.ktLayoutsealed classPaymentMethodsArrangementenumGroupingBehaviorSavedMethodCustomizationwith builder supportAppearance.ConfigurationMainActivity.ktPaymentSheet.Layout.Tabs()for validationTest Cases
Screen recordings are attached for all scenarios below.
Tabs Layout
Tabs + groupByPaymentMethods: trueTabs()Tabs + PaymentMethodsArrangement.GridTabs + groupByPaymentMethods: falseAccordion Layout
Accordion + spacedAccordionItems: true + groupByPaymentMethods: trueAccordion()Accordion + spacedAccordionItems: trueAccordion + spacedAccordionItems: true + maxAccordionItems: 5Accordion + spacedAccordionItems: true + maxAccordionItems: 5 + radios: trueAccordion + radios: true + spacedAccordionItems: true + maxAccordionItems: 3Accordion + spacedAccordionItems: true + groupByPaymentMethods: falseTest Cases
Description
Adds native Android API support for structured layout configuration in the Payment Sheet. Merchants can now customize the payment UI layout type, arrangement, and saved method grouping behavior through a typed Kotlin API.
What's New
PaymentSheet.Layout— Sealed class withTabsandAccordionvariantsPaymentMethodsArrangement— Enum to switch betweenDefault(horizontal scroll) andGridlayoutGroupingBehavior— Controls whether saved methods are grouped by payment type or shown inlineSavedMethodCustomization— Wraps grouping behavior config for saved payment methodsspacedAccordionItems,maxAccordionItems,radiosKey Changes
PaymentSheet.ktLayoutsealed classPaymentMethodsArrangementenumGroupingBehaviorSavedMethodCustomizationwith builder supportAppearance.ConfigurationMainActivity.ktPaymentSheet.Layout.Tabs()for validationTest Cases
Screen recordings are attached for all scenarios below.
spacedAccordionItemsmaxAccordionItems = 5maxAccordionItems = 5maxAccordionItems = 3Layout Test Suite for Android
1. Tabs — Saved methods grouped by payment methods
2. Accordion — Saved methods grouped by payment methods
3. Accordion — Same as above with
spacedAccordionItems4. Accordion — Default
5. Tabs — Default
6. Accordion — Spaced items
7. Accordion — Spaced items with max 5 visible items
8. Accordion — Radio buttons with max 5 visible items
9. Accordion — Radio buttons with max 3 visible items
10. Tabs — Grid payment methods arrangement
11. Accordion — Saved methods shown inline
12. Tabs — Saved methods shown inline
Screenrecording
tabs.groupbeha.displayinsepisfalseandgroupbypmisfalse.mov
accord.groupbeha.displayinsepisfalseandgroupbypmisfalse.mov
Accor.spacedisTrue+radiosisTrue+maxItemsIs3.mov
Tabs-Grid.mov
Accor.spacedItems.+maxItemsIs5+radiosisTrue.mov
Accor.spacedItems.+maxItemsIs5.mov
Accor.spacedItems.mov
justTabs.mov
justAccordion.mov
Accordion.groupingBehaviour.+spacedAcc.mov
Accordion.groupingBehaviour.mov
Tabs.groupingBehavior.mov