This example guide shows how to integrate UniFi Hotspot with Stripe's testing environment.
NOTES & REQUIREMENTS: This article applies for the current version of the UniFi Controller but cannot assure applicability for Stripe. Please be familiar with Stripe Documentation when following this guide.
Table of Contents
- Steps: Preparing the Stripe Account
- Steps: Preparing the UniFi Controller
- Testing & Going Live
- Related Material
The UniFi Controller includes Stripe as one of the payment gateway options. It communicates with Stripe directly via Stripe API over HTTPS. Stripe has benefits such as easy setup, easy sign-up and configuration. For Stripe applicability in your country, please visit see Stripe Documentation.
This example guide shows how to integrate UniFi Hotspot with Stripe. In this way, users can pay for WiFi usage via the UniFi Hotspot portal page through Stripe. Every account in Stripe is divided into two possibilities: one for testing and one for running in live or production environment. This example is developed under the test environment provided by Stripe. Related UI / API interface in the test environment shall be the same as in the live environment.
Steps: Preparing the Stripe Account
- Go to https://stripe.com/ and create an account if you don't already have one.
- You will be redirected to the Stripe dashboard and a welcome frame is shown.
- Navigate to Go straight to your dashboard > Your Account > Account Settings > API Keys.
- Make a copy of Test Secret Key and Live Secret Key, that's all you will need to set up Stripe on UniFi.
- Make sure the UI switch in the upper left of Stripe dashboard is adjusted to Test.
Steps: Preparing the UniFi Controller
- In the UniFi Controller navigate to Settings > Guest Control > Enable Guest Portal.
- For Authentication, select Hotspot.
- Scroll down to the Hotspot section, and check the box for Enable payment-based authorization.
- This will expose a new Payments section. From the dropdown, choose "Stripe (US, Canada, UK)" as Payment Gateway.
- This example is developed under test environment, so for the API Key copy and paste the Test Secret Key obtained from the Stripe dashboard. If you are ready for live environment, you should copy and paste the Live Secret Key.
- Click Apply Changes.
- Create a WLAN and check the option to Apply guest policies. See this article for more: UniFi - Wireless Guest Network Setup.
Testing & Going Live
- After associating to a guest WLAN, test that you are redirected to the portal page and you are able to select different packages.
- Fill in the required fields and pay with the test credit card number provided by Stripe.
test credit card number : 4242424242424242 expiration date : any date in the future will be considered valid.
CVC : any 3-digits numbers is valid
- Verify that you can see the transaction in the Stripe dashboard.
- In the UniFi Controller, navigate to Settings > Guest Control > Hotspot Section > Click Go to Hotspot Manager link.
- Verify that you can see the corresponding payment in the Payments/Transactions page.
- Check that package chosen and time allocated for this guest is correct.
- If you get an error, or the test payment does not go through, allow Less Secure Payments in Stripe. Find this option under Stripe Dashboard > Business Settings > Integration > Enable Process Payments Unsafely. This should in no way impact the safety of your transactions, but if you are concerned, please contact Stripe support.
- Switch Test to Live in the upper left of your Stripe dashboard.
- Replace Test Secret Key with Live Secret Key in the UniFi Controller (see section above)
- You will receive a confirmation email, make sure to activate it via said email.
- UniFi - Wireless Guest Network Setup
- Stripe Documentation (external link)
- Stripe Documentation: Test Card Numbers and Tokens (external link)