我尝试通过教程使用firebase-functions来创建Stripe临时密钥,下面是node.js代码:
exports.createEphemeralKey = functions.https.onCall(async (data, context) => {
const customerId = data.customer_id;
const stripeVersion = data.stripe_version;
const uid = context.auth.uid;
if (uid === null) {
console.log('Illegal access attempt due to unauthenticated attempt.')
throw new functions.https.HttpsError('internal', 'Illegal access attempt');
}
return stripe.ephemeralKeys.create(
{ customer: customerId },
{ stripe_version: stripeVersion }
).then((key) => {
return key
}).catch( (err) => {
functions.logger.log('Error creating ephemeral key', err)
throw new functions.https.HttpsError('internal', 'Unable to create ephemeral key: ' + err)
});
});
运行后,Xcode立即显示以下错误代码:
Error Domain=com.firebase.functions Code=13 "INTERNAL" UserInfo={NSLocalizedDescription=INTERNAL}
当我点击管理我的信用卡(这会触发条纹支付表)时,条纹支付表从不加载,只显示“正在加载...”
我的直觉是我的Swift代码没问题,这只是node.js createEphemeralKey函数的问题。我认为customerID很好,因为我可以用Xcode中的print函数生成它。这可能是stripeVersion的问题?还是其他什么问题?
1条答案
按热度按时间t40tm48m1#
here您将了解如何在创建了临时密钥的情况下检查Firebase日志