lpe_with_source
Learmond Pay Element with Source— lpe_with_source
This package provides a styling-focused Source pay button and convenience
wrappers around the published paysheet UI so apps can present a
consistent paysheet and native device-pay flows.
Quick start
Add the package to your pubspec.yaml and import the public barrel:
import 'package:lpe_with_source/lpe_with_source.dart';
The package re-exports the core paysheet helpers and common widgets:
presentPaysheet(...)/showLpePaysheet— present the paysheet UI (publishable key is optional)StripePaymentResult— result type returned from the paysheetLearmondPayButtons— re-exported frompackage:lpefor the single-line pay buttonsSourceandSourcePayButton— the styling-first Source button API provided by this package
Source button (recommended for styling-only integration)
This package exposes a single-instance Source helper to provide
default styles and convenience factories:
Source.present— mutable singleton withdefaultStyleanddefaultPublishableKey.Source.present.source_pay_button()— returns aSourcePayButtonbuilt with the singleton defaults.
If you need per-button overrides, instantiate SourcePayButton directly:
SourcePayButton(
style: Source.present.defaultStyle,
amount: '24.99',
merchantArgs: {
'merchantName': 'My Store',
'merchantInfo': 'Order #123',
'summaryItems': [
{'label': 'T-shirt', 'amountCents': 1999},
{'label': 'Shipping', 'amountCents': 500},
],
},
onResult: (result) { /* handle result */ },
)
Notes:
merchantArgs['summaryItems']should be aListof maps withlabel(String) andamountCents(int). Native pay sheets will render these as Line Items.- The package does not require a publishable key for styling.
presentPaysheet(...)andSourcePayButtonaccept optional
LearmondPayButtons
If you want the bundled single-line pay buttons, you can import and use
LearmondPayButtons directly (this package re-exports it from package:lpe):
LearmondPayButtons(
amount: '9.99',
onResult: (r) { /* handle StripePaymentResult */ },
)
Example app
See lpe_with_source_test_app/ for a small demo that shows SourcePayButton
usage and how to pass merchantArgs.summaryItems to display Line Items in
native pay flows.
Notes
- This package is intentionally styling-focused — it provides a consistent
Source button and convenience re-exports. Use
presentPaysheetor theLearmondPayButtonswidget for presenting the paysheet and native device pay flows as appropriate.
Libraries
- lpe_with_source
- Public package entry for
lpe_with_source. - main