AhsanAyaz / AhsanAyaz/flutter_stripe_payments

Please help. Do not working PayViaExistingCard()

Aperta
#9 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
48
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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);
}
}

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.