Here is a documentation for Hoplix API beta, all you need for use Hoplix service outside the the user interface.
Retrive all product, create campaign, manage campaign, place order, retrive order status and more...
Important: all data must be post in JSON format!
Let's get started!
Go to your account and click Settings Menu voice, go to Api Key tab.
Click on button Generate API Key
Here we go! You are ready for first API call!
Retrive all information about all products on Hoplix or require information for single product
Retrive information about all out products on Hoplix
For this call POST your API Key and Secret Key provided in your account
<?php
$data = json_encode(array("api" => "YOUR API KEY", "secret" => "YOUR SECRET KEY"));
$endpoint = "http://api.hoplix.com/v1/product-list";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200,
"product-list": [
{
"product-code": "maglietta-unisex",
"name": "T-Shirt Unisex",
"colors": "white,graymarble,heathergrey,darkgrey,black,lightblue,blueroyal,navy,kiwigreen,kellygreen,bottlegreen,yellow,orange,neonorange,red,bordeaux,deepberry",
"description": "Soft t-shirt with no side seams, in sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Washable at 30 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "7.50",
"base-cost-back": "10.50",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},....]
}
Retrive information about product on Hoplix. This request will return all product information plus additional product can be related for campaign creation
For this call POST your API Key and Secret Key provided in your account and via get insert the product code for get the information about it
<?php
$data = json_encode(array("api" => "YOUR API KEY", "secret" => "YOUR SECRET KEY"));
$endpoint = "http://api.hoplix.com/v1/product-info/maglietta-unisex";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{
"status": 200,
"product-info": {
"product-code": "maglietta-unisex",
"name": "T-Shirt Unisex",
"colors": "white,graymarble,heathergrey,darkgrey,black,lightblue,blueroyal,navy,kiwigreen,kellygreen,bottlegreen,yellow,orange,neonorange,red,bordeaux,deepberry",
"description": "Soft t-shirt with no side seams, in sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Washable at 30 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "7.50",
"base-cost-back": "10.50",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
"additional-product": [
{
"product-code": "zaino",
"name": "Zaino",
"colors": "nd",
"description": "Sports backpack in polyester, size 35x45 cm, with black shoulder strap.",
"sizes": "T.U.",
"base-cost": "5.90",
"base-cost-back": "7.90",
"production days": "5",
"printable-area": "288x360 mm",
"orientation": "2",
"weight": "60.00"
},
{
"product-code": "maglietta-bambino",
"name": "Maglietta Bambino",
"colors": "white,graymarble,heathergrey,black,lightblue,blueroyal,navy,bottlegreen,kiwigreen,kellygreen,yellow,orange,red,pink,fuchsia,deepberry,army",
"description": "Soft children's t-shirt with no side seams, made of sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Washable at 30 degrees.",
"sizes": "2 Anni,4 Anni,6 Anni,8 Anni,10 Anni,12 Anni",
"base-cost": "9.00",
"base-cost-back": "12.50",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "160.00"
},
{
"product-code": "body-neonato",
"name": "Body Bambino",
"colors": "white,pink,lightblue",
"description": "A newborn baby body in high-quality ring-spun cotton of 220 g/m. Ribbed edges 1x1.",
"sizes": "3 6 Mesi,6 12 Mesi,12 18 Mesi,18 24 Mesi",
"base-cost": "9.00",
"base-cost-back": "11.00",
"production days": "5",
"printable-area": "178x203 mm",
"orientation": "2",
"weight": "120.00"
},
{
"product-code": "borsa",
"name": "Borsa",
"colors": "white,red,black,yellow,blueroyal,navy,bottlegreen",
"description": "Cotton bag with long handles size 38x42 cm approx.",
"sizes": "T.U.",
"base-cost": "7.00",
"base-cost-back": "9.00",
"production days": "5",
"printable-area": "288x360 mm",
"orientation": "2",
"weight": "60.00"
},
{
"product-code": "boccale-birra",
"name": "Boccale Birra",
"colors": "nd",
"description": "Ceramic mug with 0.5L capacity, microwave safe and food-safe.",
"sizes": "T.U.",
"base-cost": "9.50",
"base-cost-back": "11.50",
"production days": "5",
"printable-area": "72x90 mm",
"orientation": "2",
"weight": "790.00"
},
{
"product-code": "tazza-magica",
"name": "Tazza Magica",
"colors": "nd",
"description": "Black ceramic mug, microwave-safe and food certified. Packaged in a box with side window. Upon contact with heat the cup becomes white.",
"sizes": "T.U.",
"base-cost": "7.50",
"base-cost-back": "9.00",
"production days": "5",
"printable-area": "71x90 mm",
"orientation": "2",
"weight": "330.00"
},
{
"product-code": "t-shirt-scollo-v",
"name": "T-Shirt Scollo V",
"colors": "white,black,bottlegreen,blueroyal,deepberry,kiwigreen,orange,navy,heathergrey,yellow,red",
"description": "Soft t-shirt with no side seams, in sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Washable at 40 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "7.90",
"base-cost-back": "10.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "tazza-bianca",
"name": "Tazza",
"colors": "nd",
"description": "White ceramic mug, microwave-safe and food certified. Packaged in a box with side window.",
"sizes": "T.U.",
"base-cost": "5.50",
"base-cost-back": "7.00",
"production days": "5",
"printable-area": "71x90 mm",
"orientation": "2",
"weight": "330.00"
},
{
"product-code": "t-shirt-donna",
"name": "T-Shirt Donna",
"colors": "white,heathergrey,darkgrey,black,kiwigreen,kellygreen,bottlegreen,lightblue,blueroyal,navy,yellow,apricot,orange,red,bordeaux,orchid,fuchsia,deepberry",
"description": "Soft t-shirt with side seams, in sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Side seams and reinforcing tape. Washable at 40 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "7.50",
"base-cost-back": "10.50",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "felpa-unisex",
"name": "Felpa Unisex",
"colors": "white,black,blueroyal,heathergrey,navy,red,bottlegreen",
"description": "Durable combination of ring-spun cotton and polyester. Unisex sweatshirt of medium weight with fleece lining and ribbed hem elasticated at the waist and at the ends of the sleeves. Fabric 80% Ringspun cotton and 20% polyester. Washable at 30 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "12.90",
"base-cost-back": "16.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "400.00"
},
{
"product-code": "tazza-fluo",
"name": "Tazza Fluo",
"colors": "nd",
"description": "Fluorescent ceramic mug, microwave-safe and food certified. Packaged in a box with side window.",
"sizes": "T.U.",
"base-cost": "7.00",
"base-cost-back": "9.00",
"production days": "5",
"printable-area": "71x90 mm",
"orientation": "2",
"weight": "300.00"
},
{
"product-code": "borraccia",
"name": "Borraccia",
"colors": "nd",
"description": "Aluminium bottle with airtight cap and side carabiner. 500 ml capacity.",
"sizes": "T.U.",
"base-cost": "9.00",
"base-cost-back": "11.00",
"production days": "5",
"printable-area": "88x110 mm",
"orientation": "2",
"weight": "120.00"
},
{
"product-code": "t-shirt-unisex-manica-lunga",
"name": "T-shirt Unisex Manica Lunga",
"colors": "white,black,blueroyal,red,heathergrey",
"description": "Soft long-sleeved t-shirt with simple cut, in sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Sleeveless cuffs. Washable at 40 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "10.50",
"base-cost-back": "12.50",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "200.00"
},
{
"product-code": "felpa-unisex-con-capuccio",
"name": "Felpa Unisex con Cappuccio ",
"colors": "white,black,blueroyal,heathergrey,navy,red,fuchsia",
"description": "Durable combination of ring-spun cotton and polyester. Unisex medium weight hoodie with fleece lining and kangaroo pocket. Elasticated ribbed hem at the waist and at the ends of the sleeves. Fabric 80% Ringspun cotton and 20% polyester. Washable at 30 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "16.90",
"base-cost-back": "20.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "440.00"
},
{
"product-code": "canotta-unisex",
"name": "Canotta Unisex",
"colors": "white,black,red,blueroyal,yellow,navy,orange",
"description": "Soft unisex tank top without side seams and with hem on the neck and at the ends of the sleeves. Made from 100% ring-spun cotton jersey. Simple jersey. Tubular fabric and crew neck with ribbed hems. Washable at 30 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "9.50",
"base-cost-back": "12.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "canotta-donna",
"name": "Canotta Donna",
"colors": "white,black,yellow,red,fuchsia",
"description": "Soft women's tank top without side seams and with hem on the neck and at the ends of the sleeves. Made from 100% ring-spun cotton jersey. Simple jersey. Tubular fabric and crew neck with ribbed hems. Washable at 40 degrees.",
"sizes": "S,M,L,XL",
"base-cost": "9.50",
"base-cost-back": "12.90",
"production days": "5",
"printable-area": "224x280 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "t-shirt-donna-scollo-v",
"name": "T-shirt Donna Scollo v",
"colors": "white,black,blueroyal,deepberry,kiwigreen,lightblue,navy,fuchsia,red",
"description": "Soft women's t-shirt without side seams, in sturdy cotton jersey. 100% ring-spun cotton, plain jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Washable at 40 degrees.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "7.90",
"base-cost-back": "10.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "tazza-nera",
"name": "Tazza Nera",
"colors": "nd",
"description": "Black ceramic mug, microwave-safe and food certified. Packaged in a box with side window.",
"sizes": "T.U.",
"base-cost": "6.00",
"base-cost-back": "6.50",
"production days": "5",
"printable-area": "110x75 mm",
"orientation": "2",
"weight": "330.00"
},
{
"product-code": "t-shirt-unisex-dry-sport",
"name": "T-Shirt Unisex Dry Sport",
"colors": "white,pinkfluo,yellowfluo",
"description": "Breathable fabric, raglan sleeve cut and flat seams make this item ideal for all your sport activities. Available in a wide range of sizes. 100% polyester breathable effect.",
"sizes": "S,M,L,XL,XXL",
"base-cost": "9.90",
"base-cost-back": "12.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "felpa-bambino-con-cappuccio",
"name": "Felpa Bambino con Cappuccio",
"colors": "white,heathergrey,sky blue,navy,orange,red,black,kellygreen",
"description": "Durable combination of ring-spun cotton and polyester. Unisex boy sweatshirt of medium weight with hood with fleece lining and kangaroo pocket. Elasticated ribbed hem at the waist and at the ends of the sleeves. Double fabric hood without drawstrings. Fabric 50% Ringspun cotton and 50% polyester. Washable at 30 degrees.",
"sizes": "4 Anni,6 Anni,8 Anni,10 Anni,12 Anni",
"base-cost": "15.90",
"base-cost-back": "17.90",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "400.00"
},
{
"product-code": "t-shirt-unisex-large",
"name": "T-Shirt Unisex Large",
"colors": "white,darkgrey,black,blueroyal,navy,red",
"description": "Soft t-shirt with no side seams, in sturdy cotton jersey. 100% ring-spun cotton, simple jersey. Tubular fabric with shoulder to shoulder reinforcement tape. Washable at 30 degrees.",
"sizes": "3XL",
"base-cost": "8.50",
"base-cost-back": "11.50",
"production days": "5",
"printable-area": "320x400 mm",
"orientation": "2",
"weight": "180.00"
},
{
"product-code": "t-shirt-unisex-premium",
"name": "T-Shirt Unisex Premium",
"colors": "white,black,ultramarine,darkgrey,bordeaux,lightgrey",
"description": null,
"sizes": "S,M,L,XL,XXL",
"base-cost": "9.99",
"base-cost-back": "13.90",
"production days": "5",
"printable-area": "32x400 mm",
"orientation": "2",
"weight": "180.00"
}
],
"requested": "maglietta-unisex"
}
With Campaign End Point you can create and get information about Campaign
With this End Point you can create a campaign
For this call POST your API Key and Secret Key provided in your account and insert campaign details see example
<?php
//first build and array that contais our additional product
$additional_product = array();
$additional_product[] = array("product-code" => "choose the additional product code (example: maglietta-bambino)",
"product-color" => "choose the color of the additional product (example: white,graymarble,heathergrey)",
"product-price" => "choose price of the additional product (example: 20)"
);
$additional_product[] = array("product-code" => "choose the additional product code (example: t-shirt-unisex-dry-sport)",
"product-color" => "choose the color of the additional product (example: pinkfluo,yellowfluo)",
"product-price" => "choose price of the additional product (example: 20)"
);
//then build an array with all information
$data = json_encode(array("api" => "YOUR API KEY", "secret" => "YOUR SECRET KEY",
"campaign" => array(
"name" => "choose a name",
"description" => "choose a description",
"url" => "choose url for public view",
"private" => "n(not private)/y(private) choose if the campign is only private or not",
"oneshot" => "on", //optional (after 90 days from creation date the campaign will be deleted)
"campaign-duration" => "choose the duration of the campaign (example: end date in format yyyy-mm-dd hh:ii:ss or 0 for life time duration)",
"front" => "url of front deign (example: https://upload.wikimedia.org/wikipedia/it/9/9a/Los_Angeles_Lakers_logo.png)",
"back" => "url of back design (example: https://upload.wikimedia.org/wikipedia/it/9/9a/Los_Angeles_Lakers_logo.png)",
"insidelabel" => "url of insidelabel design (example: https://upload.wikimedia.org/wikipedia/it/9/9a/Los_Angeles_Lakers_logo.png)",
"currency" => "EUR",
"product-code" => "choose the main product of the campaign (example: maglietta-unisex)",
"product-color" => "choose the color of the main product (example: white,black)",
"product-price" => "choose price of the main product (example: 29.9)",
"additional-product" => $additional_product,
)));
$endpoint = "http://api.hoplix.com/v1/create-campaign";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
//if campaign is not private
{"status": 200, "campaign_id": "campaign id", "link": "public link on hoplix with choosed url"}
//if campaign is private
{"status": 200, "campaign_id": "campaign id"}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if front and back are empty or not recognised
{"status": 201, "message": "You mast fill the Front or Back orientation"}
//if extension file are not allowed
{"status": 201, "message": "The file extension for (invalid extension) image is not allowed"}
//if url are is already in use
{"status": 201, "message": "Url is already in use. Try another url"}
//if url contain special characters
{"status": 201, "message": "Url mast not contain special characters"}
//if the additional product is not listed as additional product of the main product
{"status": 201, "message": "The product with code (additional-product-code) is not an additional product of the main product with code (main-product-code)"}
//if product has only one orientation and front and back are not empty
{"status": 201, "message": "The product with code (product-code) allow only front image"}
//if the price you set for product is not grater of base cost
{"status": 201, "message": "(product-code) doesn't allow insidelabel image"}
//if the product doesn't have the insidelabel personalizable
{"status": 201, "message": "The price of the product with code (procut-code) for sell must be greater than (product-base-cost)"}
//if in product there is a invalid color select
{"status": 201, "message": "The colors you picked for product with code (product-code) is not valid. Invalid colors: (invalid color selected)"}
//Campaign not created
{"status"; 201, "message": "Someting went wrong!"}
With this End Point you can retrive information about campaign
For this call POST your API Key and Secret Key provided in your account and insert via get the campaign id
<?php
//then build an array with all information
$data = json_encode(array("api" => "YOUR API KEY", "secret" => "YOUR SECRET KEY"));
$endpoint = "http://api.hoplix.com/v1/info-campaign/{campaign-id}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{
"status": 200,
"campaign": {
"name": "{Name of campagin}",
"description": "{Campaign description}",
"url": "{Campaign url}",
"private": "{Private status}",
"campaign-duration": "{Campaign duration}",
"status": "{Status}",
"currency": "{Currency}",
"products": [
{
"product-id": "{product-id}",
"product-name": "{product-name}",
"product-code": "{product-code}",
"product-price": "{selleing price}",
"product-color": "{colors}",
"product-size": "{sizes aviable}",
"preview": [
{
"front-{color}": "{link for product preview}",
"back-{color}": "{link for product preview}"
}
]
}
]
}
}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if the campaign was not found
{"status": 201, "message": "Campaign not found"}
With this End Point you can retrive information about all your campaigns
For this call POST your API Key and Secret Key provided in your account
<?php
//then build an array with all information
$data = json_encode(array("api" => "YOUR API KEY", "secret" => "YOUR SECRET KEY"));
$endpoint = "http://api.hoplix.com/v1/list-campaign";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{
"id_campaign": "{Id of campagin}",
"name": "{Name of campagin}",
"url": "{Campaign url}",
"Creation Date": "{Creation Date of the campaign}",
"Initial Date": "{Initial Date of the campaign}",
"End Date": "{End Date of the campaign}",
"status": "{Status}",
"view": "{View}",
"campaign products": [
{
"name": "{product-name}",
"price": "{selling price}",
"colors": "{colors}",
}
]
}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
With Order End Point you can create and get information about order
With this End Point you can create a order
For this call POST your API Key and Secret Key provided in your account and insert campaign details see example
Note well : the field payment-method is not required, the order created without the payment-method field will have the credit card payment method. Don't worry in your account order you can pay it with all supported payment method
<?php
//first build and array that contais our all product of the order
$myOrderId = "123456789"
$products = array();
$products[] = array("campaign-id" => "campaign-id", "product-id" => "product-id", "product-color" => "product color", "product-size" => "product-size", "quantity" => 1);
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY",
"order" => array("products" => $products,
"shipping-mode" => "economy,tracked,express,fob", //choose one between of shipping mode (fob: collection by your courier)
"order_reference" => $myOrderId, //your order reference
"payment-method" => "credit-card,wallet", //choose one between of payment method
"shipping-info" => array("name" => "name",
"surname" => "surname",
"address" => "address",
"address-more" => "address-more",
"zip-code" => "zip-code",
"city" => "city",
"province" => "province",
"country-code" => "country" //country code in ISO 3166-1 alpha-2
))));
$endpoint = "http://api.hoplix.com/v1/create-order";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "order-id": order-id, "total": total of the order, "shipping-cost": shipping cost for this order}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if campaign not found
{"status": 201, "message": "Campaign not found"}
//if don't found product
{"status": 201, "message": "No product found in your order"}
//if the product not found in campaign products
{"status": 201, "message": "Product id product-id not found in campaign campaign-id"}
//if size is not vaild for product
{"status": 201, "message": "Size not valid for product id product-id"}
//if missing some information about shipping-info
{"status": 201, "message": "Missing value (value missing) in shipping info"}
//if country code is not in ISO 3166-1 alpha-2
{"status": 201, "message": "Country Code must respect the ISO 3166-1 alpha-2 format"}
//if country code is not recognised
{"status": 201, "message": "Country code not recognised"}
//if not recognised shipping mode
{"status": 201, "message": "Shipping mode not allowed, choose one between economy, tracked or express"}
{"status": 201, "message": "Shipping mode is required for create order"}
With this End Point you can create a campaign then create order
For this call POST your API Key and Secret Key provided in your account and insert campaign details see example
Note well : the field payment-method is not required, the order created without the payment-method field will have the credit card payment method. Don't worry in your account order you can pay it with all supported payment method
This endpoint will create the campaign by given data in products array and then create the order
<?php
//first build and array that contais our all product of the order
$myOrderId = "123456789"
$products = array();
$products[] = array("product-code" => "product-code", "front" => "front image url", "back" => "back image url", "insidelabel" => "insidelabel image url" "product-color" => "product color", "product-size" => "product-size", "quantity" => 1, "oneshot" => "on(optional: after 90 days from creation date the campaign will be deleted)");
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY",
"order" => array("products" => $products,
"shipping-mode" => "economy,tracked,express,fob", //choose one between of shipping mode (fob: collection by your courier)
"order_reference" => $myOrderId, //your order reference
"payment-method" => "credit-card,wallet", //choose one between of payment method
"shipping-info" => array("name" => "name",
"surname" => "surname",
"address" => "address",
"address-more" => "address-more",
"zip-code" => "zip-code",
"city" => "city",
"province" => "province",
"country-code" => "country" //country code in ISO 3166-1 alpha-2
))));
$endpoint = "http://api.hoplix.com/v1/create-campaign-order";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "order-id": order-id, "total": total of the order, "shipping-cost": shipping cost for this order}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if campaign not found
{"status": 201, "message": "Campaign not found"}
//if don't found product
{"status": 201, "message": "No product found in your order"}
//if the product not found in campaign products
{"status": 201, "message": "Product id product-id not found in campaign campaign-id"}
//if size is not vaild for product
{"status": 201, "message": "Size not valid for product id product-id"}
//if missing some information about shipping-info
{"status": 201, "message": "Missing value (value missing) in shipping info"}
//if country code is not in ISO 3166-1 alpha-2
{"status": 201, "message": "Country Code must respect the ISO 3166-1 alpha-2 format"}
//if country code is not recognised
{"status": 201, "message": "(product-code) doesn't allow insidelabel image"}
//if the product doesn't have the insidelabel personalizable
{"status": 201, "message": "Country code not recognised"}
//if not recognised shipping mode
{"status": 201, "message": "Shipping mode not allowed, choose one between economy, tracked or express"}
{"status": 201, "message": "Shipping mode is required for create order"}
//if your order reference is already in hoplix system
{"status": 201, "message": "This order is already present in our systems", "order-id": order-id}
With this End Point you can retrive status of order
For this call POST your API Key and Secret Key provided in your account and insert via get order id see example
<?php
//first build and array that contais our all product of the order
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY"
));
$endpoint = "http://api.hoplix.com/v1/status-order/{order-id}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "order-status": "status of the order", "shipping-code": "tracking code", "tracking-url": "url for tracking the shipment"}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if order was not found
{"status": 201, "message": "Order not found"}
With this End Point you can retrive status of order by sending your order reference
For this call POST your API Key and Secret Key provided in your account and insert via get order id see example
<?php
//first build and array that contais our all product of the order
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY",
"order-ref" => "YOUR ORDER REF ID"
));
$endpoint = "http://api.hoplix.com/v1/status-order-reference";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "order-status": "status of the order", "shipping-code": "tracking code", "tracking-url": "url for tracking the shipment"}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if order was not found
{"status": 201, "message": "Order not found"}
With this End Point you can retrive a list of order from your account
For this call POST your API Key and Secret Key provided in your account see example
<?php
//first build and array that contais our all product of the order
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY"
));
$endpoint = "http://api.hoplix.com/v1/list-orders";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "order-list": [
{
"order-id": "order-id",
"order-status": "status of the order",
"shipping-code": "tracking code",
"tracking-url": "url for track the shipment"
},... ],
}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if order was not found
{"status": 201, "message": "Orders not found"}
With this End Point you can retrive all information of order
For this call POST your API Key and Secret Key provided in your account and insert via get order id see example
<?php
//first build and array that contais our all product of the order
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY"
));
$endpoint = "http://api.hoplix.com/v1/order-info/{order-id}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "order-info": [
{
"order-id": "order-id",
"order-status": "status of the order",
"shipping-code": "tracking code",
"tracking-url": "url for track the shipment"
"product-order": [
{
"campaign-id": "campaign-id",
"product-code": "product-code",
"product-name": "product-name",
"size": "selected size",
"color": "selected color",
"quantity": "quantity",
"unit-price": "unit price",
"total-price": "total price" //unit-price * quantity
},..
]
},... ],
}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if order was not found
{"status": 201, "message": "Order not found"}
With this End Point you can retrive information about all possible status of an order
For this call POST your API Key and Secret Key provided in your account
<?php
//then build an array with all information
$data = json_encode(array("api" => "YOUR API KEY", "secret" => "YOUR SECRET KEY"));
$endpoint = "http://api.hoplix.com/v1/status-order-list";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
[
{
"status": "an",
"meaning": "annulled"
},
{
"status": "ri",
"meaning": "returned"
},
{
"status": "pe",
"meaning": "pending"
},
{
"status": "pro",
"meaning": "processed"
},
{
"status": "ok",
"meaning": "shipped"
},
{
"status": "co",
"meaning": "delivered"
},
{
"status": "sm",
"meaning": "missing"
}
]
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
With this End Point you can cancel an order that hasn't been paid yet, or paid with wallet and it hasn't been 2 hours yet
For this call POST your API Key and Secret Key provided in your account and insert via get order id see example
<?php
//first build and array that contais our all product of the order
$data = json_encode(array("api" => "YOUR API KEY",
"secret" => "YOUR SECRET KEY"
));
$endpoint = "http://api.hoplix.com/v1/cancel-order/{order-id}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',
'Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
?>
{"status": 200, "message" => "Order Successfully Canceled"
}
//if the authentication is not valid
{"status": 201, "message": "Authentication required"}
//if order was not found
{"status": 201, "message": "Order not existent"}
//if order was not yours
{"status": 201, "message": "Not your Order"}
//if order was not numeric
{"status": 201, "message": "Order ID not valid"}
//if order was not found in call
{"status": 201, "message": "Order not recognised"}
//if order was already processed
{"status": 201, "message": "Order already processed, impossible to cancel"}
//if order can not be refounded
{"status": 201, "message": "Refound error"}
//if order was already processed and paid
{"status": 201, "message": "Order already paid and processed"}
//if order was already canceled
{"status": 201, "message": "Order already canceled"}