- Tech Services
Concept Development
- Industry
- Emerging Tech
- Contact Us
17
Nov. 154.07 K
VIEWSAs an app development workforce we found multiple times need for a platform which can be used for ordering photo prints online. During our course of action we managed to develop integration for famous Kite.Ly platform (which is commonly used in apps now a days due to their variety of support & options).
It is simple and easy to integrate in apps as they already provide their SDK for both native iOS & Droid apps. For web they are yet to release their SDK, but they have very transparent architecture to get integrated into any backend as their API is organized around REST.
Create your API Key – Join in kite.ly and create your API keys by following https://www.kite.ly/login/?next=/accounts/credentials
Authenticate – To authenticate with Kite API we need to provide API keys via HTTP authorization header request.
Payment flow decision – Kite provides two ways to get payments, one is kite takes payment on behalf of you and second is you take payment and forward it to kite as per your agreement with kite on timeline (weekly / monthly etc).
Assets – The assets which will be used for print must be specified to Kite via remote (hosted within your own environment) or managed (hosted via amazonaws).
Place orders – just provide all the related details like shipment address, payment proof as per payment flow, email, phone, recipient address etc to process the order and it will be posted to Kite and you are done.
a basic CURL based pseudocode can be handy here which we used in our PHP backend web service –
$service_url = ‘https://api.kite.ly/v1.4/template/?limit=56’;
$curl = curl_init($service_url);
// set the HTTP headers as per Kite API
curl_setopt($curl, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’,’Connection: Keep-Alive’));
curl_setopt($curl, CURLOPT_HTTPHEADER, array(‘Authorization: ApiKey 049980cd582c05f20a274f696117aac2330ce264:ce0ab10ed59232b428808be5bb97a68edfe2c52f3’,));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
//IMP if the url has https and you don’t want to verify source certificate
$curl_response = curl_exec($curl);
$response = json_decode($curl_response);
curl_close($curl);
// bundle the assets and send to Kite
$templateArr = array();
if ($response){
$productDetailArr = $response->objects;
for($i=0; $i<count($productDetailArr); $i++){ $templateId = $productDetailArr[$i]->template_id;
$templateName = $productDetailArr[$i]->name;
$templateCover = $productDetailArr[$i]->product->ios_sdk_cover_photo;
$templateArr[$i][‘template_id’] = $templateId;
$templateArr[$i][‘template_name’] = $templateName;
$templateArr[$i][‘template_cover’] = $templateCover;
}
}
// we have encapsulated our own methods for further development
$this->render(‘orderprint’,array(‘albumDetails’=>$albumDetails,’photoGallalbumModel’=>$galleryArr, ‘prints’=>$printsData, ‘posters’=>$postersData, ‘album_categories’=>$albumCategories, ‘templateArr’=>$templateArr));
}
……..