Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Answered

How to use environment variable in Power pages?

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I am building a page in Power pages site for making payment using Stripe and it is working fine. Now What the problem is I have mentioned the Keys for triggering the Stripe REST APIs explicitly in the HTML Code so anyone who view the page source can see those secret keys. Is there any way to hide this. And regarding this can we use Environment variable concept ? If we can, How to use environment variables in Power pages. 

Categories:
  • PowerPlatform-P Profile Picture
    49 on at
    Re: How to use environment variable in Power pages?

    I have used Site Settings as my environment variables but how can I swap the values when importing from Dev to UAT and from UAT to Prod?

    Like with regular Power Platform environment variables, I can use configuration file (https://learn.microsoft.com/en-us/power-platform/guidance/alm-accelerator/setup-data-deployment-configuration). Is there such thing for Site Setting when doing deployment?

  • oliver.rodrigues Profile Picture
    9,315 Most Valuable Professional on at
    Re: How to use environment variable in Power pages?

    @Anonymous you can also look into Azure Functions for securing the integration:Payments in PowerApps Portal — part 1/2 | by Andrew Grischenko | Microsoft Power Platform Tips & Tricks | Medium

  • oliver.rodrigues Profile Picture
    9,315 Most Valuable Professional on at
    Re: How to use environment variable in Power pages?

    @Anonymous you can also look into Azure Functions for securing the integration:Payments in PowerApps Portal — part 1/2 | by Andrew Grischenko | Microsoft Power Platform Tips & Tricks | Medium

  • Community Power Platform Member Profile Picture
    on at
    Re: How to use environment variable in Power pages?

    @bssienes Yes, We can still read values inside variables from the page source.

    I created the Payment Intent by leveraging Power Automate and getting the client secret in JS variable. With the help of the client secret I am making payment in JS. So I am not exposing the Stripe API Key here in JS.

  • enes Profile Picture
    150 on at
    Re: How to use environment variable in Power pages?

    @Anonymous I am building something similar. Is it safe to retrieve the StripeAPiKey into a Javascript variable? I believe we can still read values inside variables from the page source.

  • GWham1 Profile Picture
    on at
    Re: How to use environment variable in Power pages?

    {% assign StripeApiKey = settings['settingName'] %} then use {{ StripeApiKey }} in your JavaScript.

    Or simply use {{ settings['settingName'] }}

  • Community Power Platform Member Profile Picture
    on at
    Re: How to use environment variable in Power pages?

    I am able to use the site setting by following the below syntax,

     

    {{settings['siteSettingsName']}}
  • Community Power Platform Member Profile Picture
    on at
    Re: How to use environment variable in Power pages?

    I have created the site setting. Now how I refer this in my Html or JS code?

  • Verified answer
    oliver.rodrigues Profile Picture
    9,315 Most Valuable Professional on at
    Re: How to use environment variable in Power pages?

    The equivalent to Environment Variable in Power Pages are Site SettingsConfigure site settings for portals - Power Apps | Microsoft Learn

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 69 Super User 2025 Season 1

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 49 Most Valuable Professional

#3
Jon Unzueta Profile Picture

Jon Unzueta 43