web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / How to use environment...
Power Pages
Answered

How to use environment variable in Power pages?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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:
I have the same question (0)
  • Verified answer
    oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

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

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

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

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

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

     

    {{settings['siteSettingsName']}}
  • GWham1 Profile Picture
    on at

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

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

  • enes Profile Picture
    150 on at

    @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.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @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.

  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    @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,482 Most Valuable Professional on at

    @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

  • PowerPlatform-P Profile Picture
    49 on at

    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?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Valantis Profile Picture

Valantis 41

#2
sannavajjala87 Profile Picture

sannavajjala87 28 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 26

Last 30 days Overall leaderboard