AhsanAyaz / AhsanAyaz/flutter_stripe_payments

Please help. Do not working PayViaExistingCard()

Offen
#9 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Dart
Sterne
48
Forks
40
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I get null in paymentIntent.

I/flutter (23072): NoSuchMethodError: The method '[]' was called on null.
I/flutter (23072): Receiver: null
I/flutter (23072): Tried calling: [] ("client_secret")

static Future payViaExistingCard({
String amount,
String currency,
String offerId,
CreditCard card,
}) async {
try {
var paymentMethod = await StripePayment.createPaymentMethod(
PaymentMethodRequest(
card: CreditCard(
number: '5555555555554444',
cvc: '123',
expMonth: 03,
expYear: 22,
currency: 'USD',
),
),
);

var paymentIntent =
await StripeService.createPaymentIntent(amount, currency, offerId).catchError((e){
print('EERROORR$e');
});
print('paymentIntent:$paymentIntent');

_______

static Future> createPaymentIntent(
String amount, String currency, String offerId) async {
try {
Map body = {
'amount': amount,
'currency': currency,
'payment_method_types[]': 'card',
'description': offerId,
};
var response = await http.post(
StripeService.paymentApiUrl,
body: body,
headers: StripeService.headers,
);
return jsonDecode(response.body);
} catch (e) {
Get.snackbar('Error', 'Transaction failed',
backgroundColor: Colors.red, colorText: Colors.white);
}
}

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.