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

Notifications

Announcements

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

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,368 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
    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
    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
    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,368 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,368 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard