2016 API Tiger-En For Magento Documentation
2016 API Tiger-En For Magento Documentation
Your Website
Benets
Tiger-one.eu
Tired of customers ordering products that are not in stock? TigerOne.eu allows you to accurately mirror our stock on your system.
Automate Ordering
Save time by automatically sending orders to our system via our API.
No manual processing is required, thus eliminating user errors.
Minor Expenditure/Setup
Due to not needing to place orders, use your resources to better develop your business & customer relationships.
Fast Delivery
Save Money
Order
Destination
Consolidate Orders
Dropship Orders
API Documentation
Before you begin implementing the API, please contact us for these details:
API URL (We have separate URLs for live and test sites)
API username
API key
Store id
Website id
Your Tiger-One.eu customer account email (if you don't have it already)
Your Tiger-One.eu customer account password (if you don't have it already)
We use the standard Magento SOAP API v2. http://www.magentocommerce.com/api/soap/
introduction.html.
Important: We have also implemented a two-step authentication process. After logging into
our SOAP API you will need to log-in using your Tiger-one.eu customer account details.
Sample PHP script to create order. Please read the inline comments for a detailed explanation.
Example Code
<?php
/**
* Dene username, password, store id (tiger one english, seedsman english, etc.),
* API url, customer_id. All these details are to be provided by Seedsman
*/
$user = 'test';
$password = 'testapikey';
$store_id = 5;
$website_id = 2;
$proxy = new SoapClient('http://tiger-one.eu/en/api/v2_soap/?wsdl');
try {
$sessionId = $proxy->login($user, $password);
} catch (Exception $e) {
var_dump($e);
}
// Create a new cart to use for an order
// @see http://www.magentocommerce.com/api/soap/checkout/cart/cart.create.html
$cartId = $proxy->shoppingCartCreate($sessionId, $store_id);
// Set customer for the cart
// @see http://www.magentocommerce.com/api/soap/checkout/cartCustomer/cart_customer.set.html
// NOTE: We have implemented an email / password authentication method.
// It is not part of the documentation in the above link.
// You need to provide your customer account email, password and our website id (to be given to you).
// If you do not login successfully you have to stop processing the order
$customerInfo = new stdClass();
$customerInfo->website_id = $website_id;
$customerInfo->mode = "customer";
$customerInfo->email = "[email protected]";
$customerInfo->password = "testPassword";
try {
$proxy->shoppingCartCustomerSet($sessionId, $cartId, $customerInfo);
} catch (Exception $e) {
echo '<h1>Customer set exception</h1>';
var_dump($e);
exit();
}
// Add product(s) to the cart
// @see http://www.magentocommerce.com/api/soap/checkout/cartProduct/cartProduct.html
$productItems = array(
array('sku' => 'HDS-DDHZ-Fem-5', 'qty' => 1),
array('sku' => 'BFTRPLC-Fem-10', 'qty' => 1),
);
$proxy->shoppingCartProductAdd($sessionId, $cartId, $productItems);
// Set billing and shipping address
// @see http://www.magentocommerce.com/api/soap/checkout/cartCustomer/cart_customer.addresses.html
$address = array(
array(
'mode' => 'shipping',
'rstname' => 'First Name',
'lastname' => 'Last Name',
'street' => 'street address',
'city' => 'city',
'region' => 'region',
'telephone' => 'phone number',
'postcode' => 'postcode',
'country_id' => 'GB',
'is_default_shipping' => 0,
'is_default_billing' => 0
),
array(
'mode' => 'billing',
'rstname' => 'First Name',
'lastname' => 'Last Name',
'street' => 'street address',
'city' => 'city',
'region' => 'region',
'telephone' => 'phone number',
'postcode' => 'postcode',
'country_id' => 'GB',
'is_default_shipping' => 0,
'is_default_billing' => 0
),
);
$proxy->shoppingCartCustomerAddresses($sessionId, $cartId, $address);
try {
// Get shipping method lists for your order, select one and apply it to your cart
// @see http://www.magentocommerce.com/api/soap/checkout/cartShipping/cartShipping.html
$shippingMethods = $proxy->shoppingCartShippingList($sessionId, $cartId);
// Go through the shipping method list and select the appropriate one. For demo purpose we have selected
royalmail_rstclass
// NOTE: The shipping method list varies on delivery country and products total
foreach ($shippingMethods as $shippingMethod) {
if ($shippingMethod->carrier == "royalmail" && $shippingMethod->method == "rstclass") {
$proxy->shoppingCartShippingMethod($sessionId, $cartId, $shippingMethod->code);
break;
}
}
} catch (Exception $e) {
echo '<h1>Dumping shipping exception</h1>';
var_dump($e);
exit();
}
try {
// Get payment method lists for your order, select one and apply it to your cart
// @see http://www.magentocommerce.com/api/soap/checkout/cartPayment/cartPayment.html
$paymentMethods = $proxy->shoppingCartPaymentList($sessionId, $cartId);
// Go through the payment method list and select the appropriate one. For demo purpose we have selected bankpayment
// NOTE: The billing method list varies on delivery country and products total
foreach ($paymentMethods as $paymentMethod) {
if ($paymentMethod->code == "bankpayment") {
$proxy->shoppingCartPaymentMethod($sessionId, $cartId, array(
'po_number' => null,
'method' => $paymentMethod->code,
'cc_cid' => null,
'cc_owner' => null,
'cc_number' => null,
'cc_type' => null,
'cc_exp_year' => null,
'cc_exp_month' => null
));
break;
}
}
} catch (Exception $e) {
echo '<h1>Dumping payment exception</h1>';
var_dump($e);
exit();
}
try {
// Final place the order
// @see http://www.magentocommerce.com/api/soap/checkout/cart/cart.order.html
$orderId = $proxy->shoppingCartOrder($sessionId, $cartId, null, null);
echo $orderId;
} catch (Exception $e) {
echo '<h1>Dumping nal order exception</h1>';
var_dump($e);
exit();
}