UniFi Controller includes Stripe as one of payment gateways and communicates with Stripe directly via Stripe API over HTTPS. Stripe has benefits such as easy setup, easy sign-up and configuration. So far, Stripe accepts payments from customers in Canada, United Kingdom, and United States. It also accepts payments from customer in Belgium, France, Ireland and Netherlands in beta version which may be feature incomplete.
The example guide shows how to integrate UniFi hotspot with Stripe. In this way, users can pay for wifi usage via UniFi hotspot portal page through Stripe. Every account in Stripe is divided into two universe: one for testing and one for running in live or production environment. This example is developed under test environment provided by Stripe. Related UI / API interface in the test environment shall be the same as in the live environment. If not, then you will need to check with Stripe.
Part I. Preparing Stripe Account
- Go to Stripe website, https://stripe.com/
- "Sign Up" > Fill in the required field > "Create your Stripe account"
- You will be redirected to Stripe dashboard and a welcome frame is shown.
- "Go straight to your dashboard" > "Your Account" > "Account Settings" > "API Keys"
- Make a copy of "Test Secret Key", "Live Secret Key", that's all you need to get Stripe going.
- Make sure the UI switch in the upper left of Stripe dashboard is adjusted to Test.
|Example Stripe API Keys|
Part II. Preparing UniFi Controller
- "Settings" > "Guest Control" > "Enable Guest Portal"
- "Authentication" > "Hotspot"
- In hotspot panel, check "Enable payment-based authorization" and choose "Stripe (US, Canada)" as gateway.
- This example is developed under test environment and therefore in the Stripe API Key, copy and paste "Test Secret Key" you obtained from Stripe dashboard. If you are ready for live environment, you should copy and paste "Live Secret Key".
- Create a WLAN with guest policy enabled.
Part III. Test if Everything Works
- After associating to a guest WLAN, see if you can be redirected to portal page and 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
- See if you can see the transaction in Stripe dashboard.
- In the controller, "Settings" > "Guest Control". In the Hotspot panel, "Go to Hotspot Manager"
- See if you can see the corresponding payment in Payments/Transactions page.
- Check if the package is what you chose and time allocated for this guest is correct.
- If you get an error, or the test payment will not go through, Please allow Less Secure Payments in Stripe.
Part IV. Going Live
- Switch Test to Live in the upper left of Stripe dashboard.
- Replace Test Secret Key with Live Secret Key.
- Make sure you have activated account in the confirmation email.