Difference between revisions of "Resellers"

From Ace Stream Wiki
Jump to: navigation, search
Line 1: Line 1:
==Термины==
+
==Terms==
* '''Реселлер''' – пользователь Ace Stream, который получил права на продажу платных опций Ace Stream  
+
* '''Reseller''' – Ace Stream user who has got rights to sell paid Ace Stream options
* '''Ключ пользователя''' - идентификатор пользователя Ace Stream
+
* '''User key''' - Ace Stream user's ID
* '''Опция''' - дополнительная сервисная/программная услуга Ace Stream, которая может быть активирована для конкретного ключа пользователя
+
* '''Option''' - additional service / software service of Ace Stream, which can be activated for a specific user key
* '''Приложение''' - продукт реселлера (сайт, мобильное, либо десктопное приложение), через который осуществляется продажа опций
+
* '''App''' - reseller's product (site, mobile or desktop application), which is used to sell options
  
==Как стать реселлером==
+
==How to become a reseller==
* войти на сайт https://accounts.acestream.net под своим логином (если у вас нет логина, необходимо [https://accounts.acestream.net/register зарегистрироваться])
+
* log in to site https://accounts.acestream.net using your login (if you do not have the login, you have to [https://accounts.acestream.net/register register])
* выбрать раздел [https://accounts.acestream.net/partnership "Сотрудничество"] в верхнем меню
+
* choose section [https://accounts.acestream.net/partnership "Partnership"] in a top menu
* нажать кнопку "Стать реселлером"
+
* click button "Become a reseller"
  
==API для реселлеров==
+
==API for Resellers==
API для реселлеров позволяет вам активировать различные дополнительные опции пользователям своих приложений.
+
API for resellers allows you to activate different additional options for users of your apps.
  
Общая схема работы API для реселлеров выглядит так:
+
A common scheme of work of API for resellers looks like this:
* для активации необходимой опции пользователю ваше приложение (сайт, мобильное либо десктопное приложение) отправляет на сервер Ace Stream запрос, в котором указывает идентификатор пользователя, опцию и период активации
+
* to activate a required option for a user your app (site, mobile or desktop app) sends a request to Ace Stream server, in which specifies user's id, option and activation period
* с вашего баланса в системе Ace Stream списывается стоимость указанной опции на указанный период
+
* the cost of specified option for the specified period is charged from your balance in Ace Stream system
* указанная опция активируется для пользователя, идентификатор которого вы передали в запросе
+
* specified option is activated for the user whose id you specified in the request
  
Полное описание API для реселлеров можно найти [[Reseller_API|здесь]].
+
Full description of API for resellers you can find [[Reseller_API/en|here]].
  
Для работы с API вам понадобятся следующие два идентификатора:
+
To work with API you will need the following two identifiers:
* '''API key''' - строка, которая используется для идентификации реселлера в запросах API
+
* '''API key''' - string, used for reseller's ID in API requests
* '''API secret''' - секретный ключ, который используется для цифровой подписи запросов API
+
* '''API secret''' - secret key, used for a digital signature of API requests
  
Данные идентификаторы можно увидеть в разделе Реселлер -> Настройки API в меню слева. Секретный ключ реселлер может поменять самостоятельно (кнопка "Редактировать настройки API" ).
+
You can find these identifiers in section Reseller -> API settings in a left menu. The reseller can change a secret key by themselves (button "Edit API settings").
  
==Создание приложений==
+
==Creating apps==
Для начала работы с API для реселлеров вам необходимо создать как минимум одно приложение. Для этого в разделе Реселлер -> Приложения в меню слева нажимаем кнопку "Создать новое приложение". После это вам будет предложено заполнить поля "Название" (обязательное) и "Сайт приложения" (необязательное).
+
To start working with API for resellers you have to create at least one app. To do this click button "Create a new application" in section Reseller -> Applications in the left menu. After this you will be proposed to fill fields "Name" (mandatory) and "Application's site"(optional).
  
Все ваши приложения отображаются в разделе Реселлер -> Приложения в виде таблицы с такими полями:
+
All your apps can be seen in section Reseller -> Applications in a table with the following fields:
* Название - название приложения, которое вы указали при создании
+
* Name - app's name that you specified when created the app
* APP_ID - идентификатор приложения (используется в запросах API)
+
* APP_ID - app's identifier (it is used in API requests)
* Редактировать - редактировать приложение (можно изменить название и сайт приложения)
+
* Edit - edit the app (you can change app's name and site)
* OAuth - редактировать настройки OAuth данного приложения
+
* OAuth - edit settings OAuth of this app
* API - открыть API-консоль для данного приложения
+
* API - open API-console of this app
  
Настройки OAuth вам понадобятся только в том случае, если вы планируете идентифицировать пользователей с помощью технологии OAuth2 (как правило, это необходимо для владельцев сайтов).
+
You will need OAuth settings only if you plan to identify users using OAuth2 technology (usually, it is necessary for sites' owners).
  
API-консоль позволяет отсылать запросы от имени вашего приложения прямо со страницы сайта. Консоль предназначена в первую очередь для того, чтобы наглядно показать формирование запросов к API (каждый запрос и ответ появляются в текстовых полях внизу страницы).
+
API-console allows you to send requests on behalf of your application directly from site. The console is intended primarily to demonstrate the formation of requests to API (each request and response appear in text fields at the bottom of the page).
  
<span style="color: #a00;">Внимание!</span> API-консоль не является эмулятором запросов - все запросы настоящие и отсылаются на продакшн-сервера. Это значит, что при активации какой-либо платной опции через консоль с вашего баланса будут сняты средства. Если вы хотите поработать с API для реселлеров в тестовой среде, воспользуйтесь [[Reseller_API_Sandbox|песочницей]].
+
<span style="color: #a00;">Attention!</span> API-console is not an emulator of requests - all requests are real and are sent to production-servers. It means that when some paid option is activated from console money will be withdrawn from your balance. If you would like to work with API for resellers in a test mode, use [[Reseller_API_Sandbox|sandbox]].
  
==Когда необходимо активировать опции==
+
==Options activation reminder==
Движок может сообщать о необходимости активировать ту или иную опцию при старте либо во время воспроизведения. Метод оповещения зависит от того, какое API вы используете для управления движком:
+
App engine can notice user about missing options. Notification method depends on API you choose:
* для пользователей Engine API описание [[Engine_API#example-missing-option-on-start|здесь]]
+
* more about Engine API [[Engine_API#example-missing-option-on-start|here]]
* для пользователей HTTP API описание [[Engine_HTTP_API#stop-notifications|здесь]]
+
* more about HTTP API [[Engine_HTTP_API#stop-notifications|here]]
  
==Активация опций пользователям==
+
==Activation of options for users==
Для того, чтобы активировать опцию пользователю, реселлер должен вызвать метод API [[Reseller_API#activateService|activateService]] с такими данными:
+
To activate the option for user reseller has to call API method [[Reseller_API#activateService|activateService]] with the following data:
 
* API key
 
* API key
* APP_ID (идентификатор приложения)
+
* APP_ID (application identifier)
* ключ пользователя
+
* user key
* идентификатор опции
+
* option ID
* идентификатор периода, на который необходимо активировать опцию
+
* ID of period for which an option has to be activated
  
При успешном выполнении запроса с баланса реселлера будет списана определенная сумма, а у пользователя активируется опция на указанный период.
+
If the request was successful a certain amount of money will be charged from reseller's balance, and the option for the requested period will be activated.
  
Если у пользователя в данный момент уже активирована указанная опция, то срок действия опции продлится на указанный срок.
+
If a specified option is already activated at this moment, then validation period of the option will continue for a stated period.
  
API Key и APP_ID вы можете узнать на сайте в разделе [https://accounts.acestream.net/reseller Реселлер].
+
API Key and APP_ID you can find out on the site in section [https://accounts.acestream.net/reseller Reseller].
  
Идентификаторы опций и периодов описаны [[Reseller_API|здесь]]
+
Identifiers of options and periods are described [[Reseller_API|here]]
  
Как видно из описания, для активации опции реселлер должен знать ключ пользователя. Этот ключ можно получить двумя способами: либо по протоколу OAuth2, либо создать новый ключ с помощью API для реселлеров. Первый метод больше подходит для владельцев сайтов. Второй - для разработчиков приложений. Оба метода описаны ниже.
+
As it is seen from the description, to activate options reseller has to know user key. This key can be obtained in two ways: either via OAuth2 protocol, or to create a new key using API for resellers. The first method is more suitable for sites' owners. The second - for apps' developers. Both methods are described below.
  
==Схема работы для владельцев сайтов==
+
==Work scheme for sites' owners==
Владельцы сайтов могут получить ключ пользователя с помощью протокола OAuth2. Для этого необходимо выполнить следующие шаги:
+
Sites' owners can get user key using OAuth2 protocol. To do this they have to do the following steps:
* реселлер на своем сайте размещает кнопку "Войти через Ace Stream"
+
* reseller places on his site a button "Log in with Ace Stream"
* после нажатия на эту кнопку проходит авторизация пользователя согласно OAuth2:
+
* after pressing this button everything goes according to OAuth2:
** пользователя перенаправляет на сайт Ace Stream
+
** user is redirected to Ace Stream site
** если он не зарегистрирован, то регистрируется
+
** if he's not registered, he registers
** если зарегистрирован, но не залогинен, то выполняет процедуру входа
+
** if he's registered, but not logged in, he logs in
** если пользователь первый раз входит на сайт реселлера через Ace Stream OAuth2, то он дает свое согласие на предоставление некоторых персональных данных сайту реселлера (email и ключ пользователя)
+
** if user logs in to reseller's site via Ace Stream OAuth2 at the first time, he agrees to provide some of his personal data to reseller's site (email and user key)
** пользователь возвращается на сайт реселлера
+
** user goes back to reseller's site
** сайт реселлера получает email и ключ пользователя согласно OAuth2
+
** reseller's site receives email and user key according to OAuth2
* теперь пользователь авторизован на сайте реселлера и у реселлера есть ключ пользователя, по которому он может активировать ему опцию
+
* now user is authorized at reseller's site, and the reseller has user key, by which he can activate the option for user
  
Подробнее ознакомиться с OAuth2 вы можете [[OAuth2|здесь]].
+
More detailed information about OAuth2 is [[OAuth2/en|here]].
  
==Схема работы для разработчиков приложений==
+
==Work scheme for apps' developers==
Разработчики приложений, как правило, имеют доступ к [[Engine_Service_API|сервисному API движка]]. Это дает им возможность загружать ключи пользователя напрямую в Ace Stream Engine и активировать опции без прямого участия пользователя.
+
Apps' developers usually have access to [[Engine_Service_API/en|Engine service API]]. It gives them ability to upload user keys directly to Ace Stream Engine and activate options without direct user intervention.
  
Мы предлагаем такую схему работы:
+
We propose the following work scheme:
* приложение проверяет, активирована ли необходимая опция у пользователя ([[Engine_Service_API#check_user_service|check_user_service]])
+
* app checks  whether the required option is activated ([[Engine_Service_API#check_user_service|check_user_service]])
* если опция не активирована, приложение создает новый ключ пользователя ([[Reseller_API#createUserKey|createUserKey]]) и загружает его в Ace Stream Engine ([[Engine_Service_API#load_extension|load_extension]])
+
* if the option is not activated, app creates a new user key ([[Reseller_API#createUserKey|createUserKey]]) and uploads it to Ace Stream Engine ([[Engine_Service_API#load_extension|load_extension]])
* приложение активирует нужную опцию для нового ключа пользователя ([[Reseller_API#activateService|activateService]])
+
* app activates a required option for a new user key ([[Reseller_API#activateService|activateService]])
  
Описанная схема предполагает, что приложение реселлера и Ace Stream Engine запущены на одной и той же машине.
+
Described scheme assumes that reseller's app and Ace Stream Engine are run on the same device.

Revision as of 12:42, 6 September 2017

Terms

  • Reseller – Ace Stream user who has got rights to sell paid Ace Stream options
  • User key - Ace Stream user's ID
  • Option - additional service / software service of Ace Stream, which can be activated for a specific user key
  • App - reseller's product (site, mobile or desktop application), which is used to sell options

How to become a reseller

API for Resellers

API for resellers allows you to activate different additional options for users of your apps.

A common scheme of work of API for resellers looks like this:

  • to activate a required option for a user your app (site, mobile or desktop app) sends a request to Ace Stream server, in which specifies user's id, option and activation period
  • the cost of specified option for the specified period is charged from your balance in Ace Stream system
  • specified option is activated for the user whose id you specified in the request

Full description of API for resellers you can find here.

To work with API you will need the following two identifiers:

  • API key - string, used for reseller's ID in API requests
  • API secret - secret key, used for a digital signature of API requests

You can find these identifiers in section Reseller -> API settings in a left menu. The reseller can change a secret key by themselves (button "Edit API settings").

Creating apps

To start working with API for resellers you have to create at least one app. To do this click button "Create a new application" in section Reseller -> Applications in the left menu. After this you will be proposed to fill fields "Name" (mandatory) and "Application's site"(optional).

All your apps can be seen in section Reseller -> Applications in a table with the following fields:

  • Name - app's name that you specified when created the app
  • APP_ID - app's identifier (it is used in API requests)
  • Edit - edit the app (you can change app's name and site)
  • OAuth - edit settings OAuth of this app
  • API - open API-console of this app

You will need OAuth settings only if you plan to identify users using OAuth2 technology (usually, it is necessary for sites' owners).

API-console allows you to send requests on behalf of your application directly from site. The console is intended primarily to demonstrate the formation of requests to API (each request and response appear in text fields at the bottom of the page).

Attention! API-console is not an emulator of requests - all requests are real and are sent to production-servers. It means that when some paid option is activated from console money will be withdrawn from your balance. If you would like to work with API for resellers in a test mode, use sandbox.

Options activation reminder

App engine can notice user about missing options. Notification method depends on API you choose:

  • more about Engine API here
  • more about HTTP API here

Activation of options for users

To activate the option for user reseller has to call API method activateService with the following data:

  • API key
  • APP_ID (application identifier)
  • user key
  • option ID
  • ID of period for which an option has to be activated

If the request was successful a certain amount of money will be charged from reseller's balance, and the option for the requested period will be activated.

If a specified option is already activated at this moment, then validation period of the option will continue for a stated period.

API Key and APP_ID you can find out on the site in section Reseller.

Identifiers of options and periods are described here

As it is seen from the description, to activate options reseller has to know user key. This key can be obtained in two ways: either via OAuth2 protocol, or to create a new key using API for resellers. The first method is more suitable for sites' owners. The second - for apps' developers. Both methods are described below.

Work scheme for sites' owners

Sites' owners can get user key using OAuth2 protocol. To do this they have to do the following steps:

  • reseller places on his site a button "Log in with Ace Stream"
  • after pressing this button everything goes according to OAuth2:
    • user is redirected to Ace Stream site
    • if he's not registered, he registers
    • if he's registered, but not logged in, he logs in
    • if user logs in to reseller's site via Ace Stream OAuth2 at the first time, he agrees to provide some of his personal data to reseller's site (email and user key)
    • user goes back to reseller's site
    • reseller's site receives email and user key according to OAuth2
  • now user is authorized at reseller's site, and the reseller has user key, by which he can activate the option for user

More detailed information about OAuth2 is here.

Work scheme for apps' developers

Apps' developers usually have access to Engine service API. It gives them ability to upload user keys directly to Ace Stream Engine and activate options without direct user intervention.

We propose the following work scheme:

Described scheme assumes that reseller's app and Ace Stream Engine are run on the same device.