$countriesApi=newKinow\Client\Api\CountriesApi();try{$result=$countriesApi->getCountries();print_r($result);}catch(Exception$e){echo'Exception when calling CountriesApi->getCountries: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
countriesApi =newKinowSDK.CountriesApi()
countriesApi.getCountries().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
countries_api = kinow_client.CountriesApi()try:
api_response = countries_api.get_countries()
pprint(api_response)except ApiException as e:print("Exception when calling CountriesApi->get_countries: %s\n"% e)
1 2 3 4 5 6 7
Once we have retrieved countries list, we can pick the correct ID following user address invoicing.
$customersApi=newKinow\Client\Api\CustomersApi();$body=new\Kinow\Client\Model\Customer();$body->setEmail('user@your-company.com')->setFirstname('Firstname')->setLastname('Lastname')->setPassword('password')->setIdCountry(8);try{$result=$customersApi->createCustomer($body);print_r($result);}catch(\Kinow\Client\ApiException$e){echo'Exception when calling CustomersApi->createCustomer: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8 9 10 11 12 13 14
customersApi =newKinowSDK.CustomersApi()
body ={firstname:'firstname',lastname:'lastname',email:'user@your-company.com',password:'password',id_country:8}
customersApi.createCustomer(body).then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
customers_api = kinow_client.CustomersApi()
body = kinow_client.Customer()
body.email ='user@your-company.com'
body.firstname ='Firstname'
body.lastname ='Lastname'
body.password ='password'
body.id_country =8try:
api_response = customers_api.create_customer(body)
pprint(api_response)except ApiException as e:print("Exception when calling CustomersApi->create_customer: %s\n"% e)
API will return you a CredentialsValidation object, which contains following properties:
Name
Details
valid
Boolean - Status of credentials validation
customer_id
Integer - Customer ID linked to email address
$customersApi=newKinow\Client\Api\CustomersApi();try{$result=$customersApi->validateCustomerCredentials('user@your-company.com','password');print_r($result);}catch(Exception$e){echo'Exception when calling CustomersApi->validateCustomerCredentials: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
customersApi =newKinowSDK.CustomersApi()
customersApi.validateCustomerCredentials('user@your-company.com','password').then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
customers_api = kinow_client.CustomersApi(api_client)try:
api_response = customers_api.validate_customer_credentials('user@your-company.com','password')
pprint(api_response)except ApiException as e:print("Exception when calling CustomersApi->validate_customer_credentials: %s\n"% e)
API will return you an array of Product objects with various properties, such as:
Name
Details
id
Integer - Product ID
active
Integer - Determines if Product is enabled
name
Array[I18Field] - Product names for each languages
date_add
String - Date of creation
And many more...
$productsApi=newKinow\Client\Api\ProductsApi();try{$result=$productsApi->getProducts();print_r($result);}catch(Exception$e){echo'Exception when calling ProductsApi->getProducts: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
productsApi =newKinowSDK.ProductsApi()
productsApi.getProducts().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
products_api = kinow_client.ProductsApi()try:
api_response = products_api.get_products()
pprint(api_response)except ApiException as e:print("Exception when calling ProductsApi->get_products: %s\n"% e)
$currenciesApi=newKinow\Client\Api\CurrenciesApi();try{$result=$currenciesApi->getCurrencies();print_r($result);}catch(Exception$e){echo'Exception when calling CurrenciesApi->getCurrencies: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
currenciesApi =newKinowSDK.CurrenciesApi()
currenciesApi.getCountries().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
currencies_api = kinow_client.CurrenciesApi()try:
api_response = currencies_api.get_currencies()
pprint(api_response)except ApiException as e:print("Exception when calling CurrenciesApi->get_currencies: %s\n"% e)
1 2 3 4 5 6 7
Once we have retrieved currencies list, we can pick the correct ID following user settings.
$languagesApi=newKinow\Client\Api\LanguagesApi();try{$result=$languagesApi->getLanguages();print_r($result);}catch(Exception$e){echo'Exception when calling LanguagesApi->getLanguages: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
languagesApi =newKinowSDK.LanguagesApi()
languagesApi.getLanguages().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
languages_api = kinow_client.LanguagesApi()try:
api_response = languages_api.get_languages()
pprint(api_response)except ApiException as e:print("Exception when calling LanguagesApi->get_languages: %s\n"% e)
1 2 3 4 5 6 7
Now we can select the appropriate ID following user preferences.
$body=new\Kinow\Client\Model\Cart();$body->setIdCustomer(42)->setIdCurrency(1)->setIdLang(1);try{$result=$cartsApi->createCart($body);print_r($result);}catch(\Kinow\Client\ApiException$e){echo'Exception when calling CartsApi->createCart: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8 9 10 11
cartsApi =newKinowSDK.CartsApi()
body ={id_currency:1,id_lang:1,id_customer:42}
cartsApi.createCart(body).then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7 8 9 10 11 12 13
carts_api = kinow_client.CartsApi()
body = kinow_client.Cart()
body.id_currency =1
body.id_lang =1
body.id_customer =42try:
api_response = carts_api.create_cart(body)
pprint(api_response)except ApiException as e:print("Exception when calling CartsApi->create_cart: %s\n"% e)
$cartsApi=newKinow\Client\Api\CartsApi();try{$result=$cartsApi->addProductToCart(21,5,3);print_r($result);}catch(\Kinow\Client\ApiException$e){echo'Exception when calling CartsApi->addProductToCart: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7
cartsApi =newKinowSDK.CartsApi()
cartsApi.addProductToCart(21,5,3).then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
carts_api = kinow_client.CartsApi()try:
api_response = carts_api.add_product_to_cart(21,5,3)
pprint(api_response)except ApiException as e:print("Exception when calling CartsApi->create_cart: %s\n"% e)
$paymentModulesApi=newKinow\Client\Api\PaymentModulesApi();try{$result=$paymentModulesApi->getPaymentModules();print_r($result);}catch(Exception$e){echo'Exception when calling PaymentModulesApi->getPaymentModules: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
paymentModulesApi =newKinowSDK.PaymentModulesApi()
paymentModulesApi.getPaymentModules().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
payment_modules_api = kinow_client.PaymentModulesApi()try:
api_response = payment_modules_api.get_payment_modules()
pprint(api_response)except ApiException as e:print("Exception when calling PaymentModulesApi->get_payment_modules: %s\n"% e)
$cartsApi=newKinow\Client\Api\CartsApi();try{$result=$cartsApi->getPaymentUrl();print_r($result);}catch(Exception$e){echo'Exception when calling CartsApi->getPaymentUrl: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
cartsApi =newKinowSDK.CartsApi()
cartsApi.getPaymentUrl().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
carts_api = kinow_client.CartsApi()try:
api_response = carts_api.get_payment_url()
pprint(api_response)except ApiException as e:print("Exception when calling CartsApi->get_payment_url: %s\n"% e)
1 2 3 4 5 6 7
Once user has choose his payment gateway, you can redirect him to the payment URL page (external).
When a user reach a product page (eg. a movie page), we'd like to display him a button to watch the video content linked to the product.
First of all, we have to check if user as access to this product, this means he has bought the product (TVOD) or subscribed to an offer (SVOD) granting him access to the product.
$customersApi=newKinow\Client\Api\CustomersApi();try{$result=$customersApi->getCustomerHasAccessToProduct();print_r($result);}catch(Exception$e){echo'Exception when calling CustomersApi->getCustomerHasAccessToProduct: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
customersApi =newKinowSDK.CustomersApi()
customersApi.getCustomerHasAccessToProduct().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
customers_api = kinow_client.CustomersApi()try:
api_response = customers_api.get_customer_has_access_to_product()
pprint(api_response)except ApiException as e:print("Exception when calling CustomersApi->get_customer_has_access_to_product: %s\n"% e)
Once we know that user has access to the current product, we can display him the list of videos inside this product, in order to let him pick the right one to watch.
$productsApi=newKinow\Client\Api\ProductsApi();try{$result=$productsApi->getVideosFromProduct();print_r($result);}catch(Exception$e){echo'Exception when calling ProductsApi->getVideosFromProduct: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
productsApi =newKinowSDK.ProductsApi()
productsApi.getVideosFromProduct().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
products_api = kinow_client.ProductsApi()try:
api_response = products_api.get_videos_from_product()
pprint(api_response)except ApiException as e:print("Exception when calling ProductsApi->get_videos_from_product: %s\n"% e)
$customersApi=newKinow\Client\Api\CustomersApi();try{$result=$customersApi->getCustomerHasAccessToVideo();print_r($result);}catch(Exception$e){echo'Exception when calling CustomersApi->getCustomerHasAccessToVideo: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
customersApi =newKinowSDK.CustomersApi()
customersApi.getCustomerHasAccessToVideo().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
customers_api = kinow_client.CustomersApi()try:
api_response = customers_api.get_customer_has_access_to_video()
pprint(api_response)except ApiException as e:print("Exception when calling CustomersApi->get_customer_has_access_to_video: %s\n"% e)
$videosApi=newKinow\Client\Api\VideosApi();try{$result=$videosApi->getVideoPlayer();print_r($result);}catch(Exception$e){echo'Exception when calling VideosApi->getVideoPlayer: ',$e->getMessage(),PHP_EOL;}
1 2 3 4 5 6 7 8
videosApi =newKinowSDK.VideosApi()
videosApi.getVideoPlayer().then(function(data){
console.log('API called successfully. Returned data: '+ data);},function(error){
console.error(error);});
1 2 3 4 5 6 7
videos_api = kinow_client.VideosApi()try:
api_response = videos_api.get_video_player()
pprint(api_response)except ApiException as e:print("Exception when calling VideosApi->get_video_player: %s\n"% e)