AhsanAyaz / AhsanAyaz/flutter_stripe_payments

Please help. Do not working PayViaExistingCard()

オープン
#9 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Dart
スター
48
フォーク
40
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。