Exercise - Set up Stripe in Power Pages
To follow along with this exercise and have user payments process on your Power Pages website, you need an active Stripe account to use as your payment provider. Stripe is a well-known payment provider with integrations that are available directly in Power Pages.
The way that Stripe interacts with your Power Pages website is through an application programming interface (API). When you’re integrating an API into your own application, the API has a specific access code called an API key that allows communication between the API and your application.
An API key is like a secure password that grants authorized access to certain features of a software application. When you’re integrating a service like Stripe into a website that’s built on Microsoft Power Pages, the API key ensures that your webpages can safely communicate with Stripe’s servers. You embed the API key in your site’s back-end code, allowing Power Pages to help you send secure payment requests and receive transaction updates without exposing sensitive information to the public. Essentially, the API key is what lets your Power Pages application “speak” directly and safely to Stripe’s system.
For more information about Stripe API keys and their uses, go to the Stripe API key documentation.
Stripe setup
To set up Stripe, follow these steps:
Start by signing in to Stripe and turning on Test mode in the upper part of the Home page. Test mode allows you to test Stripe's connection to your website. Complete with test API keys and test card information, test mode allows you to debug your connection and settings without the commitment to a live key.
Note
When using Stripe in a live production environment, you would be using the live keys that are available in Stripe. This exercise uses test keys as an example for you to follow along.
You also need to install the Microsoft Power Pages Payments app from the Stripe app marketplace to integrate Microsoft Power Pages in Stripe.
Note
Depending on your Stripe account's status, you might only have the option to install in test mode. This is acceptable for the purpose of testing; however, if you intend on implementing this app to your live website, you need to continue with further account setup.
To find your API keys from the Home page, go to Developers > API keys in the left navigation menu.
Alternatively, you can find your keys in the Microsoft Power Pages Payments app under View API keys.
When choosing an API key, it's important that you understand the main difference between Standard and Restricted keys. A standard key unlocks full API access, which allows for extensive interaction with your account, while restricted keys provide more specific access limits and permissions. For the purpose of this course, you use the restricted key from the Microsoft Power Pages Payments app.
Select Reveal test key under Token in the Key for Microsoft Power Pages Payments restricted keys row to reveal the API key that you’re using in Power Pages.
Important
Because you’re in test mode for this exercise, you can reveal and hide this key at your discretion. If the environment is live, you would only have one chance to reveal the key. You can mitigate any mishandling of secret or restricted keys in a live environment by rolling a new key; retrieving the key again from your dashboard isn't possible. For more information, see Stripe key documentation.
Copy the key to your clipboard by left-clicking the token and pasting/saving it into a notepad or another text editor. Your key should have
rk_test_prepended to the front of the token.You also need the Publishable key. Keep this key in the same location as the restricted key.
Note
Each type of key has the following identification strings prepended to each token: Publishable:
pk, Secret:sk, and Restricted:rk. These identification strings help you identify the key's type after saving.
After saving the keys, you now have everything on Stripe's side ready for testing. In the next units, you learn how to modify your Power Pages website to handle Stripe's connection and build a form to implement Stripe's payment handling process.




