createTokenWithCard fails with version 1.1.2
dslingr opened this issue · 4 comments
dslingr commented
After upgrading to version 1.1.2 this morning, createTokenWithCard function fails (works fine in version 1.1.1):
import 'package:stripe_payment/stripe_payment.dart' as StripePackage;
...
final StripePackage.CreditCard newCard = StripePackage.CreditCard(
name: _fullNameController.text,
number: _cardNumberController.text,
expMonth: int.parse(_expDate.split("/").first),
expYear: int.parse(_expDate.split("/").last),
cvc: _cardCVCController.text,
addressLine1: _addressOneController.text,
addressLine2: _addressTwoController.text,
addressCity: _addressCityController.text,
addressState: _state,
addressZip: _addressZipController.text);
StripePackage.Token token =
await StripePackage.StripePayment.createTokenWithCard(newCard); // <-- fails here
Fails with the following error:
I/flutter (13350): Reportable Error: PlatformException(NullPointerException, Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference, null, null)
I/flutter (13350): Reportable Stack: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:597:7)
I/flutter (13350): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
I/flutter (13350): <asynchronous suspension>
I/flutter (13350): #2 StripePayment.createTokenWithCard (package:stripe_payment/src/stripe_payment.dart:126:19)
I/flutter (13350): <asynchronous suspension>
I/flutter (13350): #3 _AddCreditCardState._addCreditCard (package:carjoe_app/screens/user/add_credit_card.dart:366:11)
I/flutter (13350): <asynchronous suspension>
Is this due to upgrading the stripe SDK to 16.10.0?
jonasbark commented
Yes it is - can you check:
flutter_stripe_payment:
git:
url: git://github.com/jonasbark/flutter_stripe_payment.git
ref: fixes/301
that contains a fix.
dslingr commented
Thanks for the quick reply.
I must be doing something wrong, however. When I add that to my pubspec, I get the following error:
Error on line 1, column 7: "name" field doesn't match expected name "flutter_stripe_payment".
╷
1 │ name: stripe_payment
│ ^^^^^^^^^^^^^^
╵
pub get failed (65; ╵)
jonasbark commented
My bad, should have been
stripe_payment:
git:
url: git://github.com/jonasbark/flutter_stripe_payment.git
ref: fixes/301
dslingr commented
That did it. Working like it should now, thanks!