Skip to content

Commit 80d0442

Browse files
authored
ci: prepare stripe_web for release (flutter-stripe#1058)
* ci: prepare stripe_web for relase * fix: readme workflow
1 parent f4e03de commit 80d0442

File tree

8 files changed

+55
-74
lines changed

8 files changed

+55
-74
lines changed

.github/workflows/docs.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
jobs:
8+
readme:
9+
name: Readme
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 4
12+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: root readme matches stripe readme
16+
run: |
17+
sh ./.github/workflows/scripts/compare-readme.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
diff README.md packages/stripe/README.md
2+
if [ $? -eq 0 ]; then
3+
echo "Readme files are the same"
4+
else
5+
echo "Readme files are different. Please run ./tools/clone_readme.sh to update the stripe README.md file."
6+
exit 1
7+
fi

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ You will also need to update in your Podfile:
7373

7474
Now you can use Stripe with Flutter web! Notice right now it is highly experimental and only a subset of features is implemented.
7575

76-
Check the steps needed [here](https://github.com/flutter-stripe/flutter_stripe/tree/main/packages/stripe_web)
76+
To use Stripe on web, it is required to add `flutter_stripe_web` in your pubspec file
7777

7878
## Usage
7979

example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313
flutter_stripe: ^7.0.0
14-
flutter_stripe_web: ^2.0.0
14+
flutter_stripe_web: ^2.1.0
1515
stripe_checkout: ^1.0.0
1616
pay: ^1.0.10
1717
http: ^0.13.1

packages/stripe/README.md

+23-55
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ dart pub add flutter_stripe
4343

4444
#### Android
4545

46+
4647
This plugin requires several changes to be able to work on Android devices. Please make sure you follow all these steps:
4748

4849
1. Use Android 5.0 (API level 21) and above
49-
2. Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/build.gradle#L2)
50-
3. Using a descendant of `Theme.AppCompat` for your activity: [example](https://github.com/flutter-stripe/flutter_stripe/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)
50+
2. Use Kotlin version 1.5.0 and above: [example](https://github.com/flutter-stripe/flutter_stripe/blob/79b201a2e9b827196d6a97bb41e1d0e526632a5a/example/android/
51+
.gradle#L2)
52+
3. 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)
5153
4. 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)
5254
5. 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)
5355
6. Rebuild the app, as the above changes don't update with hot reload
@@ -60,68 +62,34 @@ If you are having troubles to make this package to work on Android, join [this d
6062

6163
Compatible with apps targeting iOS 12 or above.
6264

63-
#### Web (Experimental)
65+
To upgrade your iOS deployment target to 12.0, you can either do so in Xcode under your Build Settings, or by modifying IPHONEOS_DEPLOYMENT_TARGET in your project.pbxproj directly.
6466

65-
Now you can use Stripe with Flutter web! Notice right now it is highly experimental and only a subset of features is implemented.
67+
You will also need to update in your Podfile:
6668

67-
Check the steps needed [here](https://github.com/flutter-stripe/flutter_stripe/tree/main/packages/stripe_web)
69+
`platform :ios, '12.0'`
6870

69-
## Usage
7071

71-
The library provides three UI componets for accepting card payments: the `CardField`, `CardForm`, and the `Paymentsheet`.
72+
#### Web (Experimental)
7273

73-
We recommend using the `PaymentSheet` for the most easy and smooth Stripe integration. It provides out of the box support for:
74-
- Localized labels and error messages to the users
75-
- Build-in animations
76-
- Build-in Google Pay and Apple Pay buttons
77-
- Handling 3D-secure
74+
Now you can use Stripe with Flutter web! Notice right now it is highly experimental and only a subset of features is implemented.
7875

79-
Notice that `PaymentSheet` is only available for Android and iOS.
76+
To use Stripe on web, it is required to add `flutter_stripe_web` in your pubspec file
8077

81-
On the other side the `CardField` allows you to create a more customizable payment flow inside your app.
78+
## Usage
8279

83-
### Example
80+
### Card payments
8481

85-
```dart
86-
// main.dart
87-
import 'package:flutter_stripe/flutter_stripe.dart';
82+
There are 3 ways of handling card payments
8883

89-
void main() async {
90-
WidgetsFlutterBinding.ensureInitialized();
84+
Method | Ease of use | description | Implementation docs |
85+
------------- | ------------- |----------------------------------------------------------------------------------------------------------------- | ------------------- |
86+
Payment sheet | Easy | Our recommended way of handling payments. It offers localization, animations and error handling out of the box. | [docs](https://docs.page/flutter-stripe/flutter_stripe/sheet) |
87+
Cardfield | Medium | Single line cardfield. Offers more flexibility but has less built-in functionality. | [docs](https://docs.page/flutter-stripe/flutter_stripe/card_field) |
88+
Card form | Medium | Simular as the cardfield but the entry fields are spread across multi lines | [docs](https://docs.page/flutter-stripe/flutter_stripe/card_field) |
9189

92-
// set the publishable key for Stripe - this is mandatory
93-
Stripe.publishableKey = stripePublishableKey;
94-
runApp(PaymentScreen());
95-
}
9690

97-
// payment_screen.dart
98-
class PaymentScreen extends StatelessWidget {
99-
100-
@override
101-
Widget build(BuildContext context) {
102-
return Scaffold(
103-
appBar: AppBar(),
104-
body: Column(
105-
children: [
106-
CardField(
107-
onCardChanged: (card) {
108-
print(card);
109-
},
110-
),
111-
TextButton(
112-
onPressed: () async {
113-
// create payment method
114-
final paymentMethod =
115-
await Stripe.instance.createPaymentMethod(PaymentMethodParams.card());
116-
},
117-
child: Text('pay'),
118-
)
119-
],
120-
),
121-
);
122-
}
123-
}
124-
```
91+
### Financial connections
92+
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.
12593

12694
## Stripe initialization
12795

@@ -183,9 +151,9 @@ Future<void> onGooglePayResult(paymentResult) async {
183151
- [Get your test Stripe API keys](https://stripe.com/docs/keys)
184152
- `cp lib/.env.example.dart lib/.env.dart` and set your Stripe publishable key.
185153
- `cp server/.env.example server/.env` and set the variable values in your newly created `.env` file.
186-
- Install the server dependencies: `yarn --cwd "server"`
154+
- Install the server dependencies: `npm install` or `yarn --cwd "server"`
187155
- Start the example
188-
- Terminal 1: `yarn --cwd "server" start`
156+
- Terminal 1: `npm start` or `yarn --cwd "server" start`
189157
- Terminal 2: `flutter run`
190158

191159
##### Additional steps for webhook forwarding
@@ -208,7 +176,7 @@ This project uses [melos](https://github.com/invertase/melos) to manage all the
208176

209177
- Format `melos run format`
210178
- Analyze `melos run analyze`
211-
- Test `melos run test`
179+
- Test `melos run unittest`
212180
- Pub get `melos run get`
213181

214182
##### Publishing

packages/stripe_web/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.0
2+
- Stripe on web can be loaded without
3+
- The internals js binding have been refactored to be more stable
4+
15
## 2.0.1
26
- Sdk updates
37

packages/stripe_web/README.md

+1-16
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,4 @@ This package is in a very early stage so be cautious to use it in production.
44

55
## Getting Started
66

7-
1. Add `flutter_stripe` and `flutter_stripe_web` in your pubspec file
8-
2. Add the js library inside `web/index.html`
9-
10-
```html
11-
12-
<html>
13-
<head>
14-
...
15-
</head>
16-
<body>
17-
...
18-
<script src="https://js.stripe.com/v3/"></script>
19-
<script src="main.dart.js" type="application/javascript"></script>
20-
</body>
21-
</html>
22-
```
7+
Add `flutter_stripe` and `flutter_stripe_web` in your pubspec file

packages/stripe_web/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_stripe_web
22
description: Stripe sdk for Flutter web platform.
3-
version: 2.0.1
3+
version: 2.1.0
44
homepage: https://github.com/flutter-stripe/flutter_stripe
55

66
environment:

0 commit comments

Comments
 (0)