【发布时间】:2023-03-06 10:55:01
【问题描述】:
我在让 stripe_payment 1.0.7 颤振插件为我的应用程序工作时遇到问题。我已经设置了相关代码如下
RaisedButton(
onPressed: () {
StripeService.payWithNewCard();
},
child: Text(
'Pay with Credit Card'
),
),
import 'dart:convert';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:stripe_payment/stripe_payment.dart';
class StripeService {
static init() {
StripePayment.setOptions(
StripeOptions(
publishableKey: "pk_test_x6emjIeRejVh1qhghRpMHxpe00GQXfxIHz",
merchantId: "Test",
androidPayMode: 'test',
),
);
}
static Future<String> payWithNewCard() async {
try {
var paymentMethod = await StripePayment.paymentRequestWithCardForm(
CardFormPaymentRequest(),
);
return 'Success';
} catch (err) {
return 'Transaction failed: ${err.toString()}';
}
}
}
但是,在我的应用程序中,每当我尝试提交信用卡时,都会收到以下 API 密钥错误消息: ios Error Message
我很确定在调用 CardFormPaymentRequest() 方法时会发生错误,因为我在输入信用卡信息并点击“完成”后会弹出此错误消息。
不久前它还在工作,我正在向 Stripe 发送交易数据,但今天再次弹出此错误消息。你知道有什么问题吗?
谢谢!
【问题讨论】:
-
你确定你的公钥是正确的吗?看起来很小。再检查一次,以防万一
-
是的,我刚刚仔细检查,公钥是正确的。我觉得当我打电话给 StripePayment.paymentRequestWithCardForm( CardFormPaymentRequest() );它无法识别我在 init() 方法中设置的 StripeOptions()。
-
(因为你暗示它之前工作过)如何生成一个新的令牌?
-
根据ios错误,公钥或私钥有问题
-
另外,提供控制台或调试模式语句
标签: ios flutter dart static stripe-payments