-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sync android code * implement new parsing cardfield and paymentintent * comply to new result propagation for setupintent * sync ios * Update dart layer * Throw errors for easy debug + cancel login when error * workaround for stripe/stripe-react-native#368, also adjusted canceledAt * migrate to flutter_lints because pedantic is deprecated * implement create token method (#165) * implement create token method * add create token to example app * Add createToken for iOS * Make example tiles scrollable Co-authored-by: Jaime Blasco <[email protected]> * improve documentation for Android and issues #155 #142 * fix merge issue * add urlscheme to initialise method * BREAKING: rename threedsecure button config and add config theme for other buttons * BREAKING make paymentIntentClientSecret nullable and add setupIntentClientSecret for paymentsheet * add fontfamily and dangerouslyGetFullCardDetails to cardfield Co-authored-by: Remon <[email protected]> Co-authored-by: Remon Helmond <[email protected]> Co-authored-by: Jaime Blasco <[email protected]>
- Loading branch information
1 parent
ffe334b
commit a679954
Showing
65 changed files
with
3,791 additions
and
753 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_stripe/flutter_stripe.dart'; | ||
import 'package:stripe_example/widgets/loading_button.dart'; | ||
import 'package:stripe_platform_interface/stripe_platform_interface.dart'; | ||
|
||
class LegacyTokenScreen extends StatefulWidget { | ||
@override | ||
_LegacyTokenScreenState createState() => _LegacyTokenScreenState(); | ||
} | ||
|
||
class _LegacyTokenScreenState extends State<LegacyTokenScreen> { | ||
CardFieldInputDetails? _card; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(), | ||
body: Column( | ||
children: [ | ||
Padding( | ||
padding: EdgeInsets.all(16), | ||
child: CardField( | ||
onCardChanged: (card) { | ||
setState(() { | ||
_card = card; | ||
}); | ||
}, | ||
), | ||
), | ||
Padding( | ||
padding: EdgeInsets.symmetric(horizontal: 16), | ||
child: LoadingButton( | ||
onPressed: | ||
_card?.complete == true ? _handleCreateTokenPress : null, | ||
text: 'Create token', | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
|
||
Future<void> _handleCreateTokenPress() async { | ||
if (_card == null) { | ||
return; | ||
} | ||
|
||
try { | ||
// 1. Gather customer billing information (ex. email) | ||
|
||
final address = Address( | ||
city: 'Houston', | ||
country: 'US', | ||
line1: '1459 Circle Drive', | ||
line2: '', | ||
state: 'Texas', | ||
postalCode: '77063', | ||
); // mocked data for tests | ||
|
||
// 2. Create payment method | ||
await Stripe.instance.createToken( | ||
CreateTokenParams(type: TokenType.Card, address: address)); | ||
|
||
ScaffoldMessenger.of(context).showSnackBar(SnackBar( | ||
content: Text('Success!: The token was created successfully}!'))); | ||
return; | ||
} catch (e) { | ||
ScaffoldMessenger.of(context) | ||
.showSnackBar(SnackBar(content: Text('Error: $e'))); | ||
rethrow; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,7 @@ dependencies: | |
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter | ||
pedantic: ^1.11.0 | ||
|
||
flutter_lints: ^1.0.3 | ||
|
||
|
||
|
This file contains 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
This file contains 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
Oops, something went wrong.