Invalid API Key provided error using dotenv env for stripeUsing dotenv in production, or passing env variables to js/js.erb? and attempt with credentialsHeroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]Actionview::Template::Error with stripe when pushed to herokuWhere do I place Stripe's publishable and secret keys?Undefined method 'secret_key' in Stripe API integrationDjango Stripe API Key IssuesCannot charge a customer that has no active card stripeAPIConnectionError with Stripe APIStripe error in Express/React: You did not set a publishable keyCorrect way for Storing API keys to credentials.yml.enc?Using dotenv in production, or passing env variables to js/js.erb? and attempt with credentials

Game schedule where each player meets only once

Best way to explain to my boss that I cannot attend a team summit because it is on Rosh Hashana or any other Jewish Holiday

What is the German idiom or expression for when someone is being hypocritical against their own teachings?

How to continue a line in Latex in math mode?

How can I refer to something in a book?

Is Odin inconsistent about the powers of Mjolnir?

Capacitors with a "/" on schematic

Is it true that control+alt+delete only became a thing because IBM would not build Bill Gates a computer with a task manager button?

Access Remote Computer for Mostly Blind Person

Why should I "believe in" weak solutions to PDEs?

Will a paper be retracted if a flaw in released software code invalidates its central idea?

What could prevent players from leaving an island?

Decode a variable-length quantity

Why is there a need to prevent a racist, or homophobic, etc. vendor from discriminating who they sell to?

If someone else uploads my GPL'd code to Github without my permission, do they not put it at risk of being stolen by Microsoft?

Looking for a new job because of relocation - is it okay to tell the real reason?

Where to pee in London?

Who is the god Ao?

Did WWII Japanese soldiers engage in cannibalism of their enemies?

What are the examples (applications) of the MIPs in which the objective function has nonzero coefficients for only continuous variables?

How to draw a flow chart?

Is there such thing as a "3-dimensional surface?"

How to realistically deal with a shield user?

Traveling from Germany to other countries by train?



Invalid API Key provided error using dotenv env for stripe


Using dotenv in production, or passing env variables to js/js.erb? and attempt with credentialsHeroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]Actionview::Template::Error with stripe when pushed to herokuWhere do I place Stripe's publishable and secret keys?Undefined method 'secret_key' in Stripe API integrationDjango Stripe API Key IssuesCannot charge a customer that has no active card stripeAPIConnectionError with Stripe APIStripe error in Express/React: You did not set a publishable keyCorrect way for Storing API keys to credentials.yml.enc?Using dotenv in production, or passing env variables to js/js.erb? and attempt with credentials






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have my env file with the correct test codes. I then added the following to my stripe.rb:



Rails.configuration.stripe = 
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_SECRET_KEY']

Stripe.api_key = Rails.configuration.stripe[:secret_key]


In my env file:



export STRIPE_PUBLISHABLE_KEY=pk_test_x
export STRIPE_SECRET_KEY=sk_test_x


I tried with and without export and with and without quotations.



Then in the beginning of my stripe.js file



var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");


I believe this is the issue because when I manually enter the stripe key in this stripe.js file, it works.



Is assets/javascript not reached by the env file, or what is happening that made the stripe key not going through?



Using js.erb works locally, but not in production on heroku. I tried:



gem 'dotenv-rails', groups: [:development, :test, :production]


and



Rails.application.config.assets.precompile << '*.js.erb'


Both do not work in production on heroku. The ENV isn't working and making it through to production.










share|improve this question


























  • you can't use rails code in js file var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");

    – Vishal
    Mar 27 at 5:16











  • Oh, well what can i use to pass the key through without actually passing it directly?

    – uno
    Mar 27 at 5:16











  • You can do one thing, change extension to js.erb instead of js, but tell me why will you do with stripe var ?

    – Vishal
    Mar 27 at 5:20











  • This is a part of the stripe.js file for Stripe Connect. Just following the docs

    – uno
    Mar 27 at 5:21











  • can you share doc url?

    – Vishal
    Mar 27 at 5:22

















0















I have my env file with the correct test codes. I then added the following to my stripe.rb:



Rails.configuration.stripe = 
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_SECRET_KEY']

Stripe.api_key = Rails.configuration.stripe[:secret_key]


In my env file:



export STRIPE_PUBLISHABLE_KEY=pk_test_x
export STRIPE_SECRET_KEY=sk_test_x


I tried with and without export and with and without quotations.



Then in the beginning of my stripe.js file



var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");


I believe this is the issue because when I manually enter the stripe key in this stripe.js file, it works.



Is assets/javascript not reached by the env file, or what is happening that made the stripe key not going through?



Using js.erb works locally, but not in production on heroku. I tried:



gem 'dotenv-rails', groups: [:development, :test, :production]


and



Rails.application.config.assets.precompile << '*.js.erb'


Both do not work in production on heroku. The ENV isn't working and making it through to production.










share|improve this question


























  • you can't use rails code in js file var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");

    – Vishal
    Mar 27 at 5:16











  • Oh, well what can i use to pass the key through without actually passing it directly?

    – uno
    Mar 27 at 5:16











  • You can do one thing, change extension to js.erb instead of js, but tell me why will you do with stripe var ?

    – Vishal
    Mar 27 at 5:20











  • This is a part of the stripe.js file for Stripe Connect. Just following the docs

    – uno
    Mar 27 at 5:21











  • can you share doc url?

    – Vishal
    Mar 27 at 5:22













0












0








0








I have my env file with the correct test codes. I then added the following to my stripe.rb:



Rails.configuration.stripe = 
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_SECRET_KEY']

Stripe.api_key = Rails.configuration.stripe[:secret_key]


In my env file:



export STRIPE_PUBLISHABLE_KEY=pk_test_x
export STRIPE_SECRET_KEY=sk_test_x


I tried with and without export and with and without quotations.



Then in the beginning of my stripe.js file



var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");


I believe this is the issue because when I manually enter the stripe key in this stripe.js file, it works.



Is assets/javascript not reached by the env file, or what is happening that made the stripe key not going through?



Using js.erb works locally, but not in production on heroku. I tried:



gem 'dotenv-rails', groups: [:development, :test, :production]


and



Rails.application.config.assets.precompile << '*.js.erb'


Both do not work in production on heroku. The ENV isn't working and making it through to production.










share|improve this question
















I have my env file with the correct test codes. I then added the following to my stripe.rb:



Rails.configuration.stripe = 
:publishable_key => ENV['STRIPE_PUBLISHABLE_KEY'],
:secret_key => ENV['STRIPE_SECRET_KEY']

Stripe.api_key = Rails.configuration.stripe[:secret_key]


In my env file:



export STRIPE_PUBLISHABLE_KEY=pk_test_x
export STRIPE_SECRET_KEY=sk_test_x


I tried with and without export and with and without quotations.



Then in the beginning of my stripe.js file



var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");


I believe this is the issue because when I manually enter the stripe key in this stripe.js file, it works.



Is assets/javascript not reached by the env file, or what is happening that made the stripe key not going through?



Using js.erb works locally, but not in production on heroku. I tried:



gem 'dotenv-rails', groups: [:development, :test, :production]


and



Rails.application.config.assets.precompile << '*.js.erb'


Both do not work in production on heroku. The ENV isn't working and making it through to production.







ruby-on-rails stripe-payments






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 7:57









sawa

135k31 gold badges219 silver badges317 bronze badges




135k31 gold badges219 silver badges317 bronze badges










asked Mar 27 at 5:12









unouno

4311 silver badge10 bronze badges




4311 silver badge10 bronze badges















  • you can't use rails code in js file var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");

    – Vishal
    Mar 27 at 5:16











  • Oh, well what can i use to pass the key through without actually passing it directly?

    – uno
    Mar 27 at 5:16











  • You can do one thing, change extension to js.erb instead of js, but tell me why will you do with stripe var ?

    – Vishal
    Mar 27 at 5:20











  • This is a part of the stripe.js file for Stripe Connect. Just following the docs

    – uno
    Mar 27 at 5:21











  • can you share doc url?

    – Vishal
    Mar 27 at 5:22

















  • you can't use rails code in js file var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");

    – Vishal
    Mar 27 at 5:16











  • Oh, well what can i use to pass the key through without actually passing it directly?

    – uno
    Mar 27 at 5:16











  • You can do one thing, change extension to js.erb instead of js, but tell me why will you do with stripe var ?

    – Vishal
    Mar 27 at 5:20











  • This is a part of the stripe.js file for Stripe Connect. Just following the docs

    – uno
    Mar 27 at 5:21











  • can you share doc url?

    – Vishal
    Mar 27 at 5:22
















you can't use rails code in js file var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");

– Vishal
Mar 27 at 5:16





you can't use rails code in js file var stripe = Stripe("<%= ENV['STRIPE_PUBLISHABLE_KEY']%>");

– Vishal
Mar 27 at 5:16













Oh, well what can i use to pass the key through without actually passing it directly?

– uno
Mar 27 at 5:16





Oh, well what can i use to pass the key through without actually passing it directly?

– uno
Mar 27 at 5:16













You can do one thing, change extension to js.erb instead of js, but tell me why will you do with stripe var ?

– Vishal
Mar 27 at 5:20





You can do one thing, change extension to js.erb instead of js, but tell me why will you do with stripe var ?

– Vishal
Mar 27 at 5:20













This is a part of the stripe.js file for Stripe Connect. Just following the docs

– uno
Mar 27 at 5:21





This is a part of the stripe.js file for Stripe Connect. Just following the docs

– uno
Mar 27 at 5:21













can you share doc url?

– Vishal
Mar 27 at 5:22





can you share doc url?

– Vishal
Mar 27 at 5:22












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370201%2finvalid-api-key-provided-error-using-dotenv-env-for-stripe%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55370201%2finvalid-api-key-provided-error-using-dotenv-env-for-stripe%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript