UniFi - Integrate Stripe with Hotspot


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

  1. Go to Stripe website, https://stripe.com/
  2. "Sign Up" > Fill in the required field > "Create your Stripe account"
  3. You will be redirected to Stripe dashboard and a welcome frame is shown.
  4. "Go straight to your dashboard" > "Your Account" > "Account Settings" > "API Keys"
  5. Make a copy of "Test Secret Key""Live Secret Key", that's all you need to get Stripe going.
  6. 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

  1. "Settings" > "Guest Control" > "Enable Guest Portal"
  2. "Authentication" > "Hotspot"
  3. In hotspot panel, check "Enable payment-based authorization" and choose "Stripe (US, Canada)" as gateway.
  4. 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".
  5. "Apply"
  6. Create a WLAN with guest policy enabled.

Part III. Test if Everything Works

  1. After associating to a guest WLAN, see if you can be redirected to portal page and 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. See if you can see the transaction in Stripe dashboard.
  4. In the controller, "Settings" > "Guest Control". In the Hotspot panel, "Go to Hotspot Manager"
  5. See if you can see the corresponding payment in Payments/Transactions page.
  6. Check if the package is what you chose and time allocated for this guest is correct.
  7. If you get an error, or the test payment will not go through, Please allow Less Secure Payments in Stripe.


Part IV. Going Live

  1. Switch Test to Live in the upper left of Stripe dashboard.
  2. Replace Test Secret Key with Live Secret Key.
  3. Make sure you have activated account in the confirmation email.