Skip to content

Commit b392acc

Browse files
remonh87jonasbark
andauthored
Improve and update docs (#2305)
* fix broken index file * doc: clarify status of cardfield * fix add documentation for apple pay * fix links in the readme * doc: updated payment element screens * doc: update the docs for paymentsheet --------- Co-authored-by: jonasbark <jonas.bark@gmx.de>
1 parent 5dd3966 commit b392acc

File tree

9 files changed

+923
-298
lines changed

9 files changed

+923
-298
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This plugin requires several changes to be able to work on Android devices. Plea
5050
2. Use Kotlin version 1.8.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/settings.gradle#L22)
5151
3. Requires Android Gradle plugin 8 and higher
5252
4. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values/styles.xml#L15), [example night theme](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/app/src/main/res/values-night/styles.xml#L16)
53-
5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/build.gradle#L9) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L6)
53+
5. Using an up-to-date Android gradle build tools version: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/settings.gradle#L21) and an up-to-date gradle version accordingly: [example](https://github.com/flutter-stripe/flutter_stripe/blob/main/example/android/gradle/wrapper/gradle-wrapper.properties#L4)
5454
6. Using `FlutterFragmentActivity` instead of `FlutterActivity` in `MainActivity.kt`: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/app/src/main/kotlin/com/flutter/stripe/example/MainActivity.kt#L6)
5555
7. Add the following rules to your `proguard-rules.pro` file: [example](https://github.com/flutter-stripe/flutter_stripe/blob/master/example/android/app/proguard-rules.pro)
5656
```proguard
@@ -108,7 +108,7 @@ To use Stripe on web, it is required to add `flutter_stripe_web` in your pubspec
108108

109109
## Usage
110110

111-
### Card payments
111+
### Card payments
112112

113113
There are 3 ways of handling card payments
114114

@@ -118,11 +118,13 @@ Payment sheet | Easy | Our recommended way of handling payments. It off
118118
Cardfield | Medium | Single line cardfield. Offers more flexibility but has less built-in functionality. | [docs](https://docs.page/flutter-stripe/flutter_stripe/card_field) |
119119
Card form | Medium | Similar as the cardfield but the entry fields are spread across multi lines | [docs](https://docs.page/flutter-stripe/flutter_stripe/card_field) |
120120

121+
> **Note:** Stripe is sunsetting CardField and CardForm in favor of PaymentSheet. We recommend using PaymentSheet for all new integrations. See [Stripe's documentation](https://stripe.com/docs/payments/payment-sheet) for more details.
122+
121123
### Wallets
122-
This library fully supports native Apple Pay and [Google pay](https://docs.page/flutter-stripe/flutter_stripe/google_pay) integration.
124+
This library fully supports native [Apple Pay](https://docs.page/flutter-stripe/flutter_stripe/apple_pay) and [Google pay](https://docs.page/flutter-stripe/flutter_stripe/google_pay) integration.
123125

124-
### Mobile elements [BETA]
125-
We also support the customer sheet mobile element. Check out the [docs](https://docs.page/flutter-stripe/flutter_stripe/customer_sheet) to learn more on how to set it up.
126+
### Mobile elements
127+
We also support the [Customer Sheet](https://docs.page/flutter-stripe/flutter_stripe/customer_sheet) and the [Address sheet](https://docs.page/flutter-stripe/flutter_stripe/address_sheet) mobile elements to collect and manage customer payment methods and addresses.
126128

127129
### Financial connections
128130
We also support Financial connections in our latest sdk. Check out the [docs](https://docs.page/flutter-stripe/flutter_stripe/financial_connections) to learn more on how to set it up.

docs.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
["CardFormField", "/card_field"]
1212
]
1313
],
14-
["Mobile elements",
14+
["Mobile elements", [
1515
["Address Sheet", "/address_sheet"],
1616
["Customer Sheet", "/customer_sheet"]
17-
],
17+
]],
1818
["Regional payments", [
1919
["ACH direct debit", "/ach"],
2020
["Ideal", "/ideal"]
2121
]
2222
],
2323
["Wallets", [
24-
["Google pay", "/google_pay"]
24+
["Apple Pay", "/apple_pay"],
25+
["Google Pay", "/google_pay"]
2526
]],
2627
["Financial connections", "/financial_connections" ],
2728
["Troubleshooting", "/troubleshooting"],
Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,27 @@
1-
# Address Sheet Implementation Guide
1+
---
2+
title: Address Sheet
3+
description: Collect shipping or billing addresses using Stripe's pre-built UI component.
4+
---
25

3-
The Address Sheet is a pre-built UI component that allows you to collect shipping or billing addresses from your users in a Flutter application using Stripe's native UI components.
4-
5-
## Installation
6-
7-
Make sure you have the `flutter_stripe` package installed in your `pubspec.yaml`:
6+
# Address Sheet
87

9-
```yaml
10-
dependencies:
11-
flutter_stripe: ^latest_version
12-
```
8+
The Address Sheet is a pre-built UI component that allows you to collect shipping or billing addresses from your users in a Flutter application using Stripe's native UI components.
139

14-
### Set up Stripe [Server Side] [Client Side]
10+
## 1. Set up Stripe [Client Side]
1511

1612
First, you need a Stripe account. [Register now](https://dashboard.stripe.com/register).
1713

18-
#### Server-side
19-
20-
This integration requires endpoints on your server that talk to the Stripe API. Use one official libraries for access to the Stripe API from your server. [Follow the steps here](https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=payment-sheet#setup-server-side)
21-
2214
#### Client-side
2315

24-
The Flutter SDK is open source, fully documented.
16+
The Flutter SDK is open source and fully documented.
2517

2618
To install the SDK, follow these steps:
27-
- Run the commmand `flutter pub add flutter_stripe`
19+
- Run the command `flutter pub add flutter_stripe`
2820
- This will add a line like this to your project's pubspec.yaml with the latest package version
2921

30-
3122
For details on the latest SDK release and past versions, see the [Releases](https://github.com/flutter-stripe/flutter_stripe/releases) page on GitHub. To receive notifications when a new release is published, [watch releases for the repository](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/managing-subscriptions-for-activity-on-github/viewing-your-subscriptions#watching-releases-for-a-repository).
3223

33-
34-
When your app starts, configure the SDK with your Stripe [publishable key](https://dashboard.stripe.com/) so that it can make requests to the Stripe API.
24+
When your app starts, configure the SDK with your Stripe [publishable key](https://dashboard.stripe.com/) so that it can make requests to the Stripe API.
3525

3626
```dart
3727
void main() async {
@@ -42,8 +32,9 @@ void main() async {
4232

4333
Use your [test mode](https://stripe.com/docs/keys#obtain-api-keys) keys while you test and develop, and your [live mode](https://stripe.com/docs/keys#test-live-modes) keys when you publish your app.
4434

35+
## 2. Basic Implementation [Client Side]
4536

46-
### Basic Implementation
37+
The Address Sheet is a widget that you embed directly in your UI. When the user interacts with it, it presents a native address collection form.
4738

4839
Here's a basic example of how to implement the Address Sheet:
4940

@@ -64,34 +55,31 @@ AddressSheet(
6455
)
6556
```
6657

67-
## Parameters
58+
## 3. Parameters
6859

6960
### Required Parameters
7061

71-
- `onSubmit`: Callback function that is called when the user successfully submits their address information. Receives a `CollectAddressResult` object containing:
72-
- `address`: The collected address details
73-
- `name`: The customer's name
74-
- `phoneNumber`: The customer's phone number (optional)
75-
76-
- `onError`: Callback function that is called when an error occurs or when the user closes the sheet before submitting. Receives a `StripeException` object.
77-
78-
- `params`: An `AddressSheetParams` object that configures the address sheet behavior and appearance.
62+
| Parameter | Type | Description |
63+
|-----------|------|-------------|
64+
| `onSubmit` | `OnAddressSheetSubmit` | Callback when the user successfully submits their address. Receives a `CollectAddressResult` object. |
65+
| `onError` | `OnAddressSheetError` | Callback when an error occurs or the user closes the sheet before submitting. Receives a `StripeException` object. |
66+
| `params` | `AddressSheetParams` | Configuration object for the address sheet behavior and appearance. |
7967

80-
### Address Result Structure
68+
### CollectAddressResult Structure
8169

8270
The `CollectAddressResult` object contains the following information:
8371

8472
```dart
8573
class CollectAddressResult {
86-
final Address address;
87-
final String name;
88-
final String? phoneNumber;
74+
final Address address; // The collected address details
75+
final String name; // The customer's name
76+
final String? phoneNumber; // The customer's phone number (optional)
8977
}
9078
```
9179

9280
The `Address` object contains standard address fields like street, city, state, postal code, and country.
9381

94-
## Example Implementation
82+
## 4. Complete Example [Client Side]
9583

9684
Here's a complete example showing how to implement the Address Sheet in a Flutter screen:
9785

@@ -142,10 +130,10 @@ class _AddressSheetExampleState extends State<AddressSheetExample> {
142130
}
143131
```
144132

145-
### Customization
133+
## 5. Customization
146134

147135
You can customize the Address Sheet behavior by configuring the `AddressSheetParams`. This allows you to:
148-
- Set default values
136+
- Set default values for address fields
149137
- Configure which fields are required
150138
- Customize the appearance
151139
- Set specific country restrictions

0 commit comments

Comments
 (0)