Hello everyone,


In this article we are going to cover how to use Ray's Captive portal and a payment gateway to monetize your Ray Access point through a Hotspot service..


In this use case we are going to be using Flutter wave as our Payment Gateway for demo purposes.



There are 3 main pre-requisites for Ray payment intergration with a payment gateway.

  1. Secret key  (Payment Gateway Api Secret key is a type of key that authorizes actions from your flutter wave/Payment Gateway account) . you need to input this key in the token field of the Ray Captive portal Payment integration Authentication type when creating your Captive portal in the Ray controller. 
  2. Webhook URL  (You need to add the Ray Webhook URL to your flutter wave /Payment Gateway account ) 
  3. Secret Hash   The Security Hash is a security feature used to verify Webhook signatures. 

    When enabling webhooks, you have the option to set a secret hash. Since Webhook URLs are publicly accessible, the secret hash allows you to verify that incoming requests are from your Payment Gateway/ Flutter wave. You can specify any value as your secret hash, but we recommend something random. You should also store it as an environment variable on your server. (Secret hash for Ray webhook URL is Secret Hash: 32178910-fae9-4a9e-b0ed-399dc648d9e0 )




First Step:


Create your captive portal for your Guests.

  • From the Ray Dashboard click on captive portal
  • Portals
  • create portal 

see image below.




  • On clicking create portal, Popup will come up.  leave  Pre authentication as none and save.
  • Select authentication type as payment intergration by selecting checkbox
  • Click on the templates button and select business category
  • In the token_______  space kindly provide your flutter wave secret key.  How to Obtain Flutter wave secret key

Refer to images below:









The flutter wave token (secret key can be obtained in.

To get your keys:

  • Log in to your Flutterwave dashboard.
  • Navigate to Settings
  • Select the API Keys open in the Developers section of the menu to view and copy your keys.





Please note: Ray requires the flutter wave secret key (Token)


API keys

When you create a Flutterwave account, you're given three kinds of API keys:

  1. Secret key: The most powerful type of key. It can authorize any action on your account, so it should never be exposed to the public.
  2. Public key: The key you'll use in "public" scenarios, such as in front-end JavaScript code (e.g. Flutterwave Inline).
  3. Encryption key: Only used with the direct card charge endpoint. See the encryption guide for details.


Webhooks

Webhooks are an important part of your payment integration. They allow flutter wave notify you about events that happen on your account, such as a successful payment or a failed transaction.

A webhook URL is an endpoint on your server where you can receive notifications about such events. When an event occurs, we'll make a POST request to that endpoint, with a JSON body containing the details about the event, including the type of event and the data associated with it.

When to use webhooks

Webhooks are supported for all kinds of payment methods, but they're especially useful for methods and events that happen outside your application's control, such as:

  • getting paid via mobile money or USSD
  • a customer being charged for their subscription (recurring payments)
  • a pending payment transitions to successful

These are all asynchronous actions—they are not controlled by your application, so you won't know when they are completed, unless we notify you or you check later.

Setting up a webhook allows us to notify you when these payments are completed. Within your webhook endpoint, you can then:

  • Update a customer's membership records in your database when a subscription payment succeeds.
  • Email a customer when a subscription payment fails.
  • Update your order records when the status of a pending payment is updated to successful.

 

 

 

Enabling Webhooks:

Here's how to set up a webhook on your flutter wave account:

  • Log in to your dashboard and click on Settings
  • Navigate to Webhooks to add your webhook URL
  • Check all the boxes and save your settings

 

 

 

WebhookScript is an easy to use scripting language designed for executing Web-related actions on incoming requests.

 

Webhooks are an important part of the payment integration as they are responsible for letting the Payment Gateway /Flutter wave notify you about events that happen on your account, such a successful Payment or a Failed transaction. 

 The Ray webhook URL can be copied from the actions button of the Payment integration Captive portal.  (See image below.)  

OR 

Copy and paste below URL to the webhooks section in your flutterwave account.


(This is the Ray Flutter wave Web hook script: https://captivecloud.ray.life/ripple/flutter/payment/webhook )



Image describes steps of obtaining Ray webhook URL from the  RAY Payment integration  captive portal


 




Second step is creating quotas and policies to be used with your WLAN SSID


POLICY 


The Policy tab is a submenu in the RAY ONE controller founder under the Profiles tab menu. 

There are several policy type options to choose from but the most common for Payment integrations is the Quota policy.

Quota policies can be either time based quota policies (Hrs,Days,Months) or Volume Based quota policies (Mbs or Gbs).


Policies on there own have no effect to users traffic untill they are bound to a Security Group.


Image below shows where to locate the policy tab in the controller



In the image above underlined in purple is an example of time based quota policy. in example above we have created 24hrs/ 1day quota policy to grant internet access to clients. we intend to charge 1000 Ugx for 24hrs internet access hence we decided to name it Daily 1000 Ugx Quota.


Kindly refer to Understanding Policy



SECURITY GROUP


The Security Group menu is where we associate and bind our policies and also where we set the Price plans for and currency to be used and displayed in our Captive portal when a user connects to our Wi-Fi Hotspot.




after creating our policy, we shall create a security group (Plan) and attach our policy and change plan from free to paid 

and select the currency type and amount as shown in image below

see image of security group below


In the security group under the Extra information tab, we change the plan type from free to paid and specify the Currency and amount (plan price) as shown in image below..





In Security Group under the quota policy is where we can enable the the policy and select the Quota policy we created in previous step to bind it to the price plan we have indicated and above.

see image below 




Create WLAN profile for our Wi-Fi Hotspot.. Refer to our  Introduction to Profile