Content Monetization - Straas/Straas-web-document GitHub Wiki
Before starting a payment, you must:
- Contact StraaS to enable your StraaS monetization module.
- Register a payment gateway account such as Spgateway. StraaS currently support ζΊε―ι, θζ.
- Enter the StraaS CMS (Content Management System) and setup the payment gateway information (i.e. hash_key and hash_iv).
After all the prerequisites are fulfilled, you can now start setup monetization rules through control panel of StraaS CMS.
Monetization rule is the unit of selling content. Each monetization rule includes video
or playlist
, price
, and valid duration
that can be configured.
We are planning create monetization rule through api in near future.
After your server get the app token (How to get an app token?), your server can get monetization rules for specific video_ids
or playlist_ids
by RESTful API.
Let's say I want to list all the related monetization rules of the video1 and video2.
curl -X GET --header 'Accept: application/json'
--header 'Authorization: Bearer <app token>'
'https://app.straas.net/api/v1/monetization_rules?video_ids=<video1>,<video2>'
The detail api reference please see link.
To sell a ticket, or sell a monetization rule, your server needs to create an order for your customers, which are created members, in StraaS paywall system.
curl -X POST --header 'Accept: application/json'
--header 'Authorization: Bearer <app token>'
-d '{ "member_id":<your member's id>,
"monetization_rule_id"=<monetization rule id>,
"redirect_url": <the url you want to redirect to after transaction is accomplished}'
'https://app.straas.net/api/v1/app/orders'
The detail reference please see link
Please note that there are extra flow need to be implemented in your server, see the detail in payment process.
Through StraaS.io you can easily create the passcode in StraaS CMS and let StraaS takes care the rest of the service. Your audiences can easily type in the redeem code in StraaS's player and authorized to the streaming.
The payment procedure is divided into 2 parts. The first part is the communication between a client device (denoted as CILENT in the following section), which is your customer from browser or mobile App, and your server (denoted as SERVER in the following section). The second part is between SERVER and your StraaS CMS (denoted as CMS in following section).
-
[CLIENT <-> SERVER] CLIENT invokes payment procedure through UI
- e.g. An User clicks the purchase button in the web page and then send a request to SERVER to create an order.
-
[SERVER <-> CMS] Create an order
- After SERVER received CLIENT's request, SERVER creates an order by the
API POST /api/v1/app/orders
with the monetization rule. - Note that:
- The
return_url
should be provided in the API request by SERVER. - The
redirect_url
is provided in the API response by CMS .
- The
- After SERVER received CLIENT's request, SERVER creates an order by the
-
[CLIENT <-> SERVER] redirect user to the payment page
- After SERVER received the response from CMS, SERVER MUST redirect CLIENT to
redirect_url
provided by CMS (Http status 302). - All the transaction and data model will be handled in the page of
redirect_url
.
- After SERVER received the response from CMS, SERVER MUST redirect CLIENT to
-
After the transaction is accomplished, CLIENT will be redirected to the
return_url
provided by SERVER, and the whole procedure is accomplished.