UniFi - Integrate Stripe with Hotspot


Overview


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


  1. Introduction
  2. Steps: Preparing the Stripe Account
  3. Steps: Preparing the UniFi Controller
  4. Testing & Going Live
  5. Related Material

Introduction


Back to Top

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


Back to Top

  1. Go to https://stripe.com/ and create an account if you don't already have one.
  2. You will be redirected to the Stripe dashboard and a welcome frame is shown.
  3. Navigate to Go straight to your dashboard > Your Account > Account Settings > API Keys.
  4. Make a copy of Test Secret Key and Live Secret Key, that's all you will need to set up Stripe on UniFi.
  5. Make sure the UI switch in the upper left of Stripe dashboard is adjusted to Test.

Steps: Preparing the UniFi Controller


Back to Top

  1. In the UniFi Controller navigate to Settings > Guest Control > Enable Guest Portal.
  2. For Authentication, select Hotspot.
  3. Scroll down to the Hotspot section, and check the box for Enable payment-based authorization. 
  4. This will expose a new Payments section. From the dropdown, choose "Stripe (US, Canada, UK)" as Payment Gateway.
  5. 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.
  6. Click Apply Changes.
  7. Create a WLAN and check the option to Apply guest policies. See this article for more: UniFi - Wireless Guest Network Setup.

Testing & Going Live


Back to Top

  1. After associating to a guest WLAN, test that you are redirected to the portal page and you are able to select different packages.
  2. 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
  3. Verify that you can see the transaction in the Stripe dashboard.
  4. In the UniFi Controller, navigate to Settings > Guest Control > Hotspot Section > Click Go to Hotspot Manager link.hotspot.png
  5. Verify that you can see the corresponding payment in the Payments/Transactions page.
  6. Check that package chosen and time allocated for this guest is correct.
  7. 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.

Going Live

  1. Switch Test to Live in the upper left of your Stripe dashboard.
  2. Replace Test Secret Key with Live Secret Key in the UniFi Controller (see section above)
  3. You will receive a confirmation email, make sure to activate it via said email.

Related Material


Back to Top


We're sorry to hear that!