在Meteor/React應用程序中,我需要從mrgalaxy:stripe導入條紋。我想:流星 - 反應 - 條紋:如何導入條紋
import { Stripe } from 'meteor/mrgalaxy:stripe';
但它返回:
TypeError: Cannot read property 'setPublishableKey' of undefined
在我創建其中添加了以下stripe.js文件服務器的文件夾:
import { Meteor } from 'meteor/meteor';
import { Stripe } from 'meteor/mrgalaxy:stripe';
Meteor.startup(function(){
Stripe.setPublishableKey(Meteor.settings.public.StripePub);
});
這個軟件包使用API和一個過時版本npm包。由於您現在可以直接使用npm包並將腳本聲明添加到您的'
'模板中。 – MasterAM