flutter_stripe_payment
flutter_stripe_payment copied to clipboard
NullPointerException: When creating payment method
I am currently trying to create a payment method by supplying credit card.
var paymentMethod = await StripePayment.createPaymentMethod(PaymentMethodRequest(card: creditCard));
But I am getting this error (in Android only, works well in IOS)
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.stripe.android.Stripe.createPaymentMethod(com.stripe.android.model.PaymentMethodCreateParams, com.stripe.android.ApiResultCallback)' on a null object reference
I read the API for android sdk and saw that createPaymentMethod() method is expecting @NotNull ApiResultCallback.. How do I pass that if the PaymentMethodRequest only accepts the following?
final BillingAddress billingAddress; final CreditCard card; final Token token; final Map<String, String> metadata;
same here
did you init your StripePayment in the initState() on the page that has the error?