Operations for creating shopping cart, add items and check out. This module also enables maintenance of order transaction records and their corresponding payment status. The payment gateway interface is not provided by the platform, the developer is free to choose how they want to manage the payment integration. Shopping cart module can also be used along with Catalogue service to create an end to end shopping experience for end users on mobile and web Apps. App42 Cloud APIs also offers a recommendation engine that can used to recommendations for E-Commerce Users.
import com.shephertz.app42.paas.sdk.android.App42API; import com.shephertz.app42.paas.sdk.android.App42Response; import com.shephertz.app42.paas.sdk.android.App42Exception; import com.shephertz.app42.paas.sdk.android.App42BadParameterException; import com.shephertz.app42.paas.sdk.android.App42NotFoundException; import com.shephertz.app42.paas.sdk.android.shopping.Cart; import com.shephertz.app42.paas.sdk.android.shopping.Cart.Payment; import com.shephertz.app42.paas.sdk.android.shopping.CartService; import com.shephertz.app42.paas.sdk.android.shopping.PaymentStatus;using com.shephertz.app42.paas.sdk.windows; using com.shephertz.app42.paas.sdk.windows.shopping;#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"#import<Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h>import com.shephertz.app42.paas.sdk.java.App42API; import com.shephertz.app42.paas.sdk.java.App42Response; import com.shephertz.app42.paas.sdk.java.App42Exception; import com.shephertz.app42.paas.sdk.java.App42BadParameterException; import com.shephertz.app42.paas.sdk.java.App42NotFoundException; import com.shephertz.app42.paas.sdk.java.shopping.Cart; import com.shephertz.app42.paas.sdk.java.shopping.Cart.Payment; import com.shephertz.app42.paas.sdk.java.shopping.CartService; import com.shephertz.app42.paas.sdk.java.shopping.PaymentStatus;using com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.shopping;Not AvailableComing SoonComing Soonusing com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.shopping;include_once '../CartService.php'; include_once '../App42Log.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';Coming Soonrequire 'App42_Ruby_API'import com.shephertz.app42.paas.sdk.as3.App42API; import com.shephertz.app42.paas.sdk.as3.App42Response; import com.shephertz.app42.paas.sdk.as3.App42Exception; import com.shephertz.app42.paas.sdk.as3.App42BadParameterException; import com.shephertz.app42.paas.sdk.as3.App42NotFoundException; import com.shephertz.app42.paas.sdk.as3.shopping.Cart; import com.shephertz.app42.paas.sdk.as3.shopping.CartService; import com.shephertz.app42.paas.sdk.as3.shopping.Item; import com.shephertz.app42.paas.sdk.as3.shopping.Payment;Coming Soonimport com.shephertz.app42.paas.sdk.jme.App42API; import com.shephertz.app42.paas.sdk.jme.App42Response; import com.shephertz.app42.paas.sdk.jme.App42Exception; import com.shephertz.app42.paas.sdk.jme.App42BadParameterException; import com.shephertz.app42.paas.sdk.jme.App42NotFoundException; import com.shephertz.app42.paas.sdk.jme.shopping.Cart; import com.shephertz.app42.paas.sdk.jme.shopping.Cart.Payment; import com.shephertz.app42.paas.sdk.jme.shopping.CartService; import com.shephertz.app42.paas.sdk.jme.shopping.PaymentStatus;
In order to use the various functions available in a specific API, the developer has to initialize with App42API by passing the apiKey and the secretKey which will become available after the app creation from AppHQ dashboard.
Required Parameters
apiKey - The Application key given when the application was created.
secretKey - The secret key corresponding to the application key given when the application was created.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");Not AvailableApp42API:initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");App42API.Initialize("API_KEY","SECRET_KEY");App42API::initialize("API_KEY","SECRET_KEY");App42API::Initialize("API_KEY", "SECRET_KEY");api = App42::ServiceAPI.new("API_KEY","SECRET_KEY")App42API.initialize("API_KEY","SECRET_KEY");Coming SoonApp42API.initialize("API_KEY","SECRET_KEY");
After initialization, the developer will have to call the buildXXXService method on App42API to get the instance of the particular API that they wish to build. For example, to build an instance of Cart Service, buildCartService() method needs to be called.
CartService cartService = App42API.buildCartService();CartService cartService = App42API.BuildCartService();CartService *cartService = [App42API buildCartService];let cartService = App42API.buildCartService() as? CartServiceCartService cartService = App42API.buildCartService();CartService cartService = App42API.BuildCartService();Not AvailableComing SoonComing SoonCartService cartService = App42API.BuildCartService();$cartService = App42API::buildCartService();Coming Sooncart_service = api.build_cart_service()var cartService:CartService = App42API.buildCartService();Coming SoonCartService cartService = App42API.buildCartService();
Create a cart session for the specified user.
Required Parameters
userName - User for whom cart session is being created, returns The Cart ID with creation time. The ID has to be used in subsequent calls for adding and checking out.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.createCart(userName, new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); System.out.println("Cart Session is"+cart.getCartSession()); System.out.println("CreationTime is"+cart.getCreationTime()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.CreateCart(userName,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("userName is " + cart.GetUserName()); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService createCart:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let userName = "Nick" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.createCart(userName, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) NSLog("Cart Session is : %@",cart.cartSession) NSLog("CreationTime is : %@",cart.creationTime) NSLog("UserName is : %@",cart.userName) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.createCart(userName); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); System.out.println("Cart Session is"+cart.getCartSession()); System.out.println("CreationTime is"+cart.getCreationTime()); String jsonResponse = cart.toString();String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.CreateCart(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("userName is :" + cart.GetUserName()); App42Log.Console("cartId is :" + cart.GetCartId()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.CreateCart(userName); Console.WriteLine("userName is " + cart.GetUserName()); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->createCart($userName); print_r("userName is " . $cart->getUserName()); print_r("cartId is " . $cart->getCartId()); print_r("Cart Session is".$cart->getCartSession()); print_r("CreationTime is".$cart->getCreationTime()); $jsonResponse = $cart->toString();Coming Soonuser_name = "Nick"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.create_cart(user_name); /* returns the Cart object. */ puts "userName is #{cart.user_name}"; puts "cartId is #{cart.cart_id}"; json_response = cart.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.createCart(userName, new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); trace("Cart Session is"+cart1.getCartSession()); trace("CreationTime is"+cart1.getCreationTime()); trace("UserName is:"+cart1.getUserName()); } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.createCart(userName); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();
Fetch cart details. Can be used by the developer to display cart details such as Items in a Cart.
Required Parameters
cartId - The Cart ID that has to be fetched.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getCartDetails(cartId, new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("userName is :" + cart.getUserName()); System.out.println("cartId is :" + cart.getCartId()); System.out.println("State is :"+cart.getState()); System.out.println("CreationTime is :"+cart.getCreationTime()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetCartDetails(cartId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("userName is " + cart.GetUserName()); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getCartDetails:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];String cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getCartDetails(cartId); System.out.println("userName is :" + cart.getUserName()); System.out.println("cartId is :" + cart.getCartId()); System.out.println("State is :"+cart.getState()); System.out.println("CreationTime is :"+cart.getCreationTime()); String jsonResponse = cart.toString();String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetCartDetails(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("userName is :" + cart.GetUserName()); App42Log.Console("cartId is :" + cart.GetCartId()); App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.GetCartDetails(cartId); Console.WriteLine("userName is " + cart.GetUserName()); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->getCartDetails($cartId); print_r("userName is " . $cart->getUserName()); print_r("cartId is " . $cart->getCartId()); print_r("State is :".$cart->getState()); print_r("CreationTime is".$cart->getCreationTime()); print_r("CheckOutTime is".$cart->getCheckOutTime()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cartId"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.get_cart_details(cart_id); /* returns the Cart object. */ puts "userName is #{cart.user_name}"; puts "cartId is #{cart.cart_id}"; puts "state is #{cart.state}"; json_response = cart.to_s();var cartId:String = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getCartDetails(cartId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); trace("State is:"+cart1.getState()); trace("CreationTime is"+cart1.getCreationTime()); trace("UserName is:"+cart1.getUserName()); } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getCartDetails(cartId); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();
Adds an item in the cart with quantity and price. This method does not take currency, it only takes the price and the onus is on the developer to maintain the currency.
Required Parameters
cartID - The cart ID into which item has to be added.
itemID - The item ID which has to be added to the cart. If the catalogue service is used along with the cart service then the item IDs should be same.
itemQuantity - Quantity of the item to be purchased.
price - Price of the item.
String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.addItem(cartId, itemID, itemQuantity, price, new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is : " + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is "+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity "+itemList.get(i).getQuantity()); System.out.println("Total Amount "+itemList.get(i).getTotalAmount()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.AddItem(cartId,itemID,itemQuantity,price,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i<itemList.Count;i++) { Console.WriteLine("ItemId is " + itemList[i].GetItemId()); Console.WriteLine("Price " + itemList[i].GetPrice()); Console.WriteLine("Quantity " + itemList[i].GetQuantity()); Console.WriteLine("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; int itemQuantity = 12; double price = 1000; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService addItem:cartId itemID:itemID itemQuantity:itemQuantity price:price completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); for (Item *item in cart.itemListArray) { NSLog(@"ItemName=%@",item.name); NSLog(@"ItemID=%@",item.itemId); NSLog(@"ItemPrice = %d", [item.price intValue]); NSLog(@"Item Image = %@",item.image); NSLog(@"Item Quantity = %d",item.quantity); NSLog(@"Total Amount = %lf",item.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" let itemID = "itemID" let itemQuantity:Int32 = 12 let price = 1000.00 App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.addItem(cartId, itemID:itemID, itemQuantity:itemQuantity, price:price, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let itemList = cart.itemListArray for item in itemList { NSLog("ItemId is : %@", item.itemId) NSLog("Price is : %d", item.price) NSLog("Quantity is : %d", item.quantity) NSLog("Total Amount is : %d", item.totalAmount) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.addItem(cartId,itemID,itemQuantity,price); System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } String jsonResponse = cart.toString();String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.AddItem(cartId, itemID, itemQuantity, price, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); App42Log.Console("jsonResponse is :" + cart.ToString()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i<itemList.Count;i++) { App42Log.Console("ItemId is " + itemList[i].GetItemId()); App42Log.Console("Price " + itemList[i].GetPrice()); App42Log.Console("Quantity " + itemList[i].GetQuantity()); App42Log.Console("Total Amount " + itemList[i].GetTotalAmount()); } } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.AddItem(cartId,itemID,itemQuantity,price); Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i<itemList.Count;i++) { App42Log.Console("ItemId is " + itemList[i].GetItemId()); App42Log.Console("Price " + itemList[i].GetPrice()); App42Log.Console("Quantity " + itemList[i].GetQuantity()); App42Log.Console("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString();$cartId = "cartId"; $itemID = "itemID"; $itemQuantity = 12; $price = 1000; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->addItem($cartId,$itemID,$itemQuantity,$price); print_r("cartId is : " .$cart->getCartId()); $list = $cart->getItemList(); foreach($list as $itemList) { print_r("ItemId is ".$itemList->getItemId()); print_r("Price ".$itemList->getPrice()); print_r("Quantity ".$itemList->getQuantity()); print_r("Total Amount ".$itemList->getTotalAmount()); } $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; item_id = "item_id"; item_quantity = 12; price = 1000; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.add_item(cart_id, item_id, item_quantity, price); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; itemList = Array.new(); item_list = cart.get_item_list(); for item in itemList do puts "itemid is #{item.itemId}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.totalAmount}"; end json-response = cart.to_s();var cartId:String = "cartId"; var itemID:String = "itemID"; var itemQuantity:int = 12; var price:int = 1000; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.addItem(cartId,itemID, itemQuantity, price,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); var itemList:Array = cart1.getItemList(); if(itemList != null) { for(var p:int=0;p<itemList.length;p++) { var item:Item = Item(itemList[p]); trace("ItemId is"+item.getItemId()); trace("Price "+item.getPrice()); trace("Quantity"+item.getQuantity()); trace("Total Amount"+item.getTotalAmount()); } } } }Coming SoonString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.addItem(cartId,itemID,itemQuantity,price); System.out.println("cartId is " + cart.getCartId()); for(int i=0; i<cart.getItemList().size(); i++) { Cart.Item itemList = cart.getItemList().elementAt(i); System.out.println("ItemId is"+itemList.getItemId()); System.out.println("Price "+itemList.getPrice()); System.out.println("Quantity"+itemList.getQuantity()); System.out.println("Total Amount"+itemList.getTotalAmount()); } String jsonResponse = cart.toString();
Fetches the items from the specified cart.
Required Parameters
cartId - The cart ID from which items have to be fetched.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getItems(cartId, new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetItems(cartId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i<itemList.Count;i++) { Console.WriteLine("ItemId is " + itemList[i].GetItemId()); Console.WriteLine("Price " + itemList[i].GetPrice()); Console.WriteLine("Quantity " + itemList[i].GetQuantity()); Console.WriteLine("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getItems:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); for (Item *item in cart.itemListArray) { NSLog(@"ItemName=%@",item.name); NSLog(@"ItemID=%@",item.itemId); NSLog(@"ItemPrice = %d", [item.price intValue]); NSLog(@"Item Image = %@",item.image); NSLog(@"Item Quantity = %d",item.quantity); NSLog(@"Total Amount = %lf",item.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getItems(cartId, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let itemList = cart.itemListArray for item in itemList { NSLog("ItemId is : %@", item.itemId) let price = item.price as NSDecimalNumber NSLog("Price is : %d", price.intValue) NSLog("Quantity is : %d", item.quantity) NSLog("Total Amount is : %lf", item.totalAmount) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getItems(cartId); System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } String jsonResponse = cart.toString();String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetItems(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i<itemList.Count;i++) { App42Log.Console("ItemId is " + itemList[i].GetItemId()); App42Log.Console("Price " + itemList[i].GetPrice()); App42Log.Console("Quantity " + itemList[i].GetQuantity()); App42Log.Console("Total Amount " + itemList[i].GetTotalAmount()); } App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.GetItems(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i<itemList.Count;i++) { App42Log.Console("ItemId is " + itemList[i].GetItemId()); App42Log.Console("Price " + itemList[i].GetPrice()); App42Log.Console("Quantity " + itemList[i].GetQuantity()); App42Log.Console("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString();$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->getItems($cartId); print_r("cartId is : " .$cart->getCartId()); $list = $cart->getItemList(); foreach($list as $itemList) { print_r("ItemId is ".$itemList->getItemId()); print_r("Price ".$itemList->getPrice()); print_r("Quantity ".$itemList->getQuantity()); print_r("Total Amount ".$itemList->getTotalAmount()); } $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.get_items(cart_id); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; item_list = Array.new(); item_list = cart.get_item_list(); for item in item_list do puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; end json_response = cart.to_s();var cartId:String = "cartId"; cApp42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); artService.getItems(cartId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); var itemList:Array = cart1.getItemList(); if(itemList != null) { for(var p:int=0;p<itemList.length;p++) { var item:Item = Item(itemList[p]); trace("ItemId is"+item.getItemId()); trace("Price "+item.getPrice()); trace("Quantity"+item.getQuantity()); trace("Total Amount"+item.getTotalAmount()); } } } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getItems(cartId); System.out.println("cartId is " + cart.getCartId()); for(int i=0; i<cart.getItemList().size(); i++) { Cart.Item itemList = cart.getItemList().elementAt(i); System.out.println("ItemId is"+itemList.getItemId()); System.out.println("Price "+itemList.getPrice()); System.out.println("Quantity"+itemList.getQuantity()); System.out.println("Total Amount"+itemList.getTotalAmount()); } String jsonResponse = cart.toString();
Fetch the specified item from the specified cart.
Required Parameters
cartId - The cart ID from which items have to be fetched.
itemId - The item for which the information has to be fetched.
String cartId = "cartId"; String itemId = "itemId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getItem(cartId, itemId,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; String itemId = "itemId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetItem(cartId,itemId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); Console.WriteLine("ItemId is " + itemList[0].GetItemId()); Console.WriteLine("Price " + itemList[0].GetPrice()); Console.WriteLine("Quantity " + itemList[0].GetQuantity()); Console.WriteLine("Total Amount " + itemList[0].GetTotalAmount()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemId = @"itemId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getItem:cartId itemId:itemId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); for (Item *item in cart.itemListArray) { NSLog(@"ItemName=%@",item.name); NSLog(@"ItemID=%@",item.itemId); NSLog(@"ItemPrice = %d", [item.price intValue]); NSLog(@"Item Image = %@",item.image); NSLog(@"Item Quantity = %d",item.quantity); NSLog(@"Total Amount = %lf",item.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" let itemId = "itemId" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getItem(cartId, itemId:itemId, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let itemList = cart.itemListArray for item in itemList { NSLog("ItemId is : %@", item.itemId) let price = item.price as NSDecimalNumber NSLog("Price is : %d", price.intValue) NSLog("Quantity is : %d", item.quantity) NSLog("Total Amount is : %lf", item.totalAmount) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; String itemId = "itemId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getItem(cartId,itemId); System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } String jsonResponse = cart.toString();String cartId = "cartId"; String itemId = "itemId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetItem(cartId,itemId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); App42Log.Console("ItemId is " + itemList[0].GetItemId()); App42Log.Console("Price " + itemList[0].GetPrice()); App42Log.Console("Quantity " + itemList[0].GetQuantity()); App42Log.Console("Total Amount " + itemList[0].GetTotalAmount()); App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; String itemId = "itemId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.GetItem(cartId,itemId); Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); Console.WriteLine("ItemId is " + itemList[0].GetItemId()); Console.WriteLine("Price " + itemList[0].GetPrice()); Console.WriteLine("Quantity " + itemList[0].GetQuantity()); Console.WriteLine("Total Amount " + itemList[0].GetTotalAmount()); String jsonResponse = cart.ToString();$cartId = "cartId"; String itemId = "itemId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->getItem($cartId,$itemId); print_r("cartId is : " .$cart->getCartId()); $list = $cart->getItemList(); foreach($list as $itemList) { print_r("ItemId is ".$itemList->getItemId()); print_r("Price ".$itemList->getPrice()); print_r("Quantity ".$itemList->getQuantity()); print_r("Total Amount ".$itemList->getTotalAmount()); } $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; item_id = "item_id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.get_item(cart_id,item_id); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; item_list = Array.new(); item_list = cart.get_item_list(); for item in item_list do puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; end json_response = cart.to_s();var cartId:String = "cartId"; var itemID:String = "itemID"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getItem(cartId,itemID,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); var itemList:Array = cart1.getItemList(); if(itemList != null) { for(var p:int=0;p<itemList.length;p++) { var item:Item = Item(itemList[p]); trace("ItemId is"+item.getItemId()); trace("Price "+item.getPrice()); trace("Quantity"+item.getQuantity()); trace("Total Amount"+item.getTotalAmount()); } } } }Coming SoonString cartId = "cartId"; String itemId = "itemId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getItem(cartId,itemId); System.out.println("cartId is " + cart.getCartId()); Cart.Item itemList = cart.getItemList().elementAt(0); System.out.println("ItemId is"+itemList.getItemId()); System.out.println("Price "+itemList.getPrice()); System.out.println("Quantity"+itemList.getQuantity()); System.out.println("Total Amount"+itemList.getTotalAmount()); String jsonResponse = cart.toString();
Check whether the cart is empty or not.
Required Parameters
cartId - The cart ID to check for empty.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.isEmpty(cartId,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println(cart); System.out.println("cartId is :" + cart.getCartId()); System.out.println("Is Empty :"+cart.isEmpty()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.IsEmpty(cartId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); Console.WriteLine("Is Empty :"+cart.IsEmpty()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService isEmpty:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"isEmpty is = %d", cart.isEmpty); NSLog(@"cartId is = %@",cart.cartId); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") var cartService = App42API.buildCartService() as? CartService cartService?.isEmpty(cartId, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) NSLog("Is Empty : %@",cart.isEmpty) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.isEmpty(cartId); System.out.println(cart); System.out.println("cartId is :" + cart.getCartId()); System.out.println("Is Empty :"+cart.isEmpty()); String jsonResponse = cart.toString();String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.IsEmpty(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); App42Log.Console("Is Empty :"+cart.IsEmpty()); App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.IsEmpty(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); Console.WriteLine("Is Empty :"+cart.IsEmpty()); String jsonResponse = cart.ToString();$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->isEmpty($cartId); print_r("cartId is :" . $cart->getCartId()); print_r("Is Empty :".$cart->isEmpty()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.is_empty(cart_id); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; json_response = cart.to_s();var cartId:String = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.isEmpty(cartId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.isEmpty(cartId); System.out.println("cartId is " + cart.getCartId()); System.out.println("Is Empty :"+cart.isEmpty()); String jsonResponse = cart.toString();
Check out the cart and put it on checkout stage and return the transaction ID. That ID has to be used in future to update the Payment Status.
Required Parameters
cartID - The cart ID that has to be checked out.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.checkOut(cartId,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is :" + cart.getCartId()); System.out.println("State is : "+cart.getState()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.CheckOut(cartId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); Console.WriteLine("State is : "+cart.GetState()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService checkOut:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"State is = %@", cart.state); NSLog(@"cartId is = %@",cart.cartId); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.checkOut(cartId, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) NSLog("Is Empty : %@",cart.isEmpty) NSLog("State : %@",cart.state) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.checkOut(cartId); System.out.println("cartId is :" + cart.getCartId()); System.out.println("State is:"+cart.getState()); String jsonResponse = cart.toString();String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.CheckOut(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); App42Log.Console("State is : "+cart.GetState()); App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.CheckOut(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); Console.WriteLine("State is : "+cart.GetState()); String jsonResponse = cart.ToString();$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->checkOut($cartId); print("cartId is :" . $cart->getCartId()); print("State is : ".$cart->getState()); print("Total Amount is : ".$cart->getTotalAmount()); print("CheckoutTime is : ".$cart->getCheckOutDate()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.check_out(cart_id); /* returns the Cart object. */ puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; json_Response = cart.to_s();var cartId:String = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.checkOut(cartId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); trace("CheckOut Time"+cart1.getCheckOutDate()); trace("State is:"+cart1.getState()); } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.checkOut(cartId); System.out.println("cartId is : " + cart.getCartId()); System.out.println("State is : "+cart.getState()); String jsonResponse = cart.toString();
When a cart is checked out, it remains in the same state. The payment status has to be updated based on the Payment Gateway interaction.
Required Parameters
cartId - The cart ID for which the payment status has to be updated.
transactionId - Transaction ID for which the payment status has to be updated.
paymentStatus - Payment Status to be updated. The probable values are PaymentStatus.DECLINED, PaymentStatus.AUTHORIZED, PaymentStatus.PENDING.
String cartId = "cartId"; String transactionId = "transactionId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.payment(cartId, transactionId, PaymentStatus.AUTHORIZED,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is :" + cart.getCartId()); Cart.Payment payment=cart.getPayment(); System.out.println("Transaction Id"+payment.getTransactionId()); System.out.println("Total Amonut from payment node"+payment.getTotalAmount()); System.out.println("Status"+payment.getStatus()); System.out.println("Date"+payment.getDate()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; String transactionId = "transactionId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.Payment(cartId, transactionId, PaymentStatus.AUTHORIZED,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); Cart.Payment payment = cart.GetPayment(); Console.WriteLine("Transaction Id"+payment.GetTransactionId()); Console.WriteLine("Total Amount from payment node " + payment.GetTotalAmount()); Console.WriteLine("Status " + payment.GetStatus()); Console.WriteLine("Date " + payment.GetDate()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *transactionId = @"transactionId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService payment:cartId transactionID:transactionId paymentStatus:AUTHORIZED completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" let transactionID = "transactionID" let paymentStatus = "AUTHORIZED" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.payment(cartId, transactionID:transactionID, paymentStatus:paymentStatus, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let payment = cart.payemntObj as! Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %d",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; String transactionId = "transactionId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.payment(cartId,transactionId,PaymentStatus.AUTHORIZED); System.out.println("cartId is :" + cart.getCartId()); Cart.Payment payment=cart.getPayment(); System.out.println("Transaction Id"+payment.getTransactionId()); System.out.println("Total Amount from payment node"+payment.getTotalAmount()); System.out.println("Status"+payment.getStatus()); System.out.println("Date"+payment.getDate()); String jsonResponse = cart.toString();String cartId = "cartId"; String transactionId = "transactionId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.Payment(cartId, transactionId, PaymentStatus.AUTHORIZED, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); Cart.Payment payment = cart.GetPayment(); App42Log.Console("Transaction Id"+payment.GetTransactionId()); App42Log.Console("Total Amount from payment node " + payment.GetTotalAmount()); App42Log.Console("Status " + payment.GetStatus()); App42Log.Console("Date " + payment.GetDate()); App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; String transactionId = "transactionId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.Payment(cartId,transactionId,PaymentStatus.AUTHORIZED); Console.WriteLine("cartId is " + cart.GetCartId()); Cart.Payment payment = cart.GetPayment(); Console.WriteLine("Transaction Id " + payment.GetTransactionId()); Console.WriteLine("Total Amount from payment node " + payment.GetTotalAmount()); Console.WriteLine("Status " + payment.GetStatus()); Console.WriteLine("Date " + payment.GetDate()); String jsonResponse = cart.ToString();$cartId = "cartId"; String transactionId = "transactionId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->payment($cartId,$transactionId,PaymentStatus::AUTHORIZED); print_r("cartId is :" . $cart->getCartId()); $payment=$cart->getPayment(); print_r("Transaction Id".$payment->getTransactionId()); print_r("Total Amonut from payment node".$payment->getTotalAmount()); print_r("Status".$payment->getStatus()); print_r("Date".$payment->getDate()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; transaction_id = "transaction_id"; payment_status = AUTHORIZED; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.payment(cart_id, transaction_id, payment_status); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; json_response = cart.to_s();var cartId:String = "cartId"; var transactionId:String = "transactionId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.payment(cartId,transactionId,PaymentStatus.AUTHORIZED,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); if(cart1.getPayment()!=null) { var payments1:Payment = cart1.getPayment(); trace("Transaction Id"+payments1.getTransactionId()); trace("Total Amount from payment node"+payments1.getTotalAmount()); trace("Status"+payments1.getStatus()); trace("Date"+payments1.getDate()); } } }Coming SoonString cartId = "cartId"; String transactionId = "transactionId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.payment(cartId,transactionId,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.getCartId()); Cart.Payment payment=cart.getPayment(); System.out.println("Transaction Id"+payment.getTransactionId()); System.out.println("Total Amount from payment node"+payment.getTotalAmount()); System.out.println("Status"+payment.getStatus()); System.out.println("Date"+payment.getDate()); String jsonResponse = cart.toString();
Fetch payment information for a user. This can be used to display order and payment history.
Required Parameters
userName - Name of the user whose payment information has to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getPaymentsByUser(userName,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Cart> cart = (ArrayList<Cart>)response; for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentsByUser(userName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Cart> cart = (List<Cart>) response; for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString(); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getPaymentsByUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *cartList = (NSArray*)responseObj; for(Cart *cart in cartList){ NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let username = "username" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getPaymentsByUser(username, completionBlock: { (success, response, exception) -> Void in if(success) { let cartList = response as! NSArray for cart in cartList { NSLog("CartId is : %@",cart.cartId) let payment = cart.paymentObj as! Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %lf",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); ArrayList<Cart> cart = cartService.getPaymentsByUser(userName); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } String jsonResponse = cart.get(0).toString();String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentsByUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { App42Log.Console("cartId is :" + cart[i].GetCartId()); App42Log.Console("Transaction Id"+cart[i].GetPayment().GetTransactionId()); App42Log.Console("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); App42Log.Console("Status"+cart[i].GetPayment().GetStatus()); App42Log.Console("Date"+cart[i].GetPayment().GetDate()); } App42Log.Console("jsonResponse is :" + cart[0].ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); IList<Cart> cart = cartService.GetPaymentsByUser(userName); for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString();$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cartResponse = $cartService->getPaymentsByUser($userName); foreach($cartResponse as $cart) { print_r("cartId is :" . $cart->getCartId()); $payment=$cart->getPayment(); print_r("Transaction Id".$payment->getTransactionId()); print_r("Total Amonut from payment node".$payment->getTotalAmount()); print_r("Status".$payment->getStatus()); print_r("Date".$payment->getDate()); } $jsonResponse = $cartResponse[0]->toString();Coming Soonuser_id = "user_id"; cart_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cartList = cart_service.get_payments_by_user(user_id);/* returns the list of Cart object. */ for cart in cart_list do puts "cartId is #{cart.cart_id}"; puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; end json_response = cart_list.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getPaymentsByUser(userName,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { trace("response is Array" + response); for(var i:int = 0;i < response.length;i++) { var cart:Cart = Cart(response[i]) var payments:Payment = cart.getPayment(); trace("CartId is:"+cart.getCartId()); if(cart.getPayment()!=null) { trace("Transaction Id"+payments.getTransactionId()); trace("Total Amount from payment node"+payments.getTotalAmount()); trace("Status"+payments.getStatus()); trace("Date"+payments.getDate()); } } } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector cart = cartService.getPaymentsByUser(userName); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + ((Cart)cart.elementAt(i)).getCartId()); System.out.println("Transaction Id "+((Cart)cart.elementAt(i)).getPayment().getTransactionId()); System.out.println("Total Amount from payment node "+((Cart)cart.elementAt(i)).getPayment().getTotalAmount()); System.out.println("Status "+((Cart)cart.elementAt(i)).getPayment().getStatus()); System.out.println("Date "+((Cart)cart.elementAt(i)).getPayment().getDate()); } String jsonResponse = ((Cart)cart.elementAt(0)).toString();
Fetch payment information for the specified Cart ID.
Required Parameters
cartId - Cart ID for which the payment information has to be fetched.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getPaymentByCart(cartId,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is :" + cart.getCartId()); Cart.Payment payment=cart.getPayment(); System.out.println("Transaction Id"+payment.getTransactionId()); System.out.println("Total Amount from payment node"+payment.getTotalAmount()); System.out.println("Status"+payment.getStatus()); System.out.println("Date"+payment.getDate()); } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentByCart(cartId,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); Cart.Payment payment=cart.GetPayment(); Console.WriteLine("Transaction Id "+payment.GetTransactionId()); Console.WriteLine("Total Amount from payment node "+payment.GetTotalAmount()); Console.WriteLine("Status "+payment.GetStatus()); Console.WriteLine("Date "+payment.GetDate()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getPaymentByCart:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartID = "cartID" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getPaymentByCart(cartID, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let payment = cart.paymentObj as! Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %lf",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getPaymentByCart(cartId); System.out.println("cartId is :" + cart.getCartId()); Cart.Payment payment = cart.getPayment(); System.out.println("Transaction Id"+payment.getTransactionId()); System.out.println("Total Amount from payment node"+payment.getTotalAmount()); System.out.println("Status"+payment.getStatus()); System.out.println("Date"+payment.getDate()); String jsonResponse = cart.toString();String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentByCart(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; App42Log.Console("cartId is :" + cart.GetCartId()); Cart.Payment payment=cart.GetPayment(); App42Log.Console("Transaction Id "+payment.GetTransactionId()); App42Log.Console("Total Amount from payment node "+payment.GetTotalAmount()); App42Log.Console("Status "+payment.GetStatus()); App42Log.Console("Date "+payment.GetDate()); App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.GetPaymentByCart(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); Cart.Payment payment=cart.GetPayment(); Console.WriteLine("Transaction Id "+payment.GetTransactionId()); Console.WriteLine("Total Amount from payment node "+payment.GetTotalAmount()); Console.WriteLine("Status "+payment.GetStatus()); Console.WriteLine("Date "+payment.GetDate()); String jsonResponse = cart.ToString();$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->getPaymentByCart($cartId); print_r("cartId is :" . $cart->getCartId()); $payment=$cart->getPayment(); print_r("Transaction Id".$payment->getTransactionId()); print_r("Total Amonut from payment node".$payment->getTotalAmount()); print_r("Status".$payment->getStatus()); print_r("Date".$payment->getDate()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.get_payment_by_cart(cart_id);/* returns the list of Cart object. */ for cart in cart_list do puts "cartId is #{cart.cart_id}"; puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; end json_response = cart_list.to_s();var cartId:String = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getPaymentByCart(cartId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); if(cart1.getPayment()!=null) { var payments1:Payment = cart1.getPayment(); trace("Transaction Id"+payments1.getTransactionId()); trace("Total Amount from payment node"+payments1.getTotalAmount()); trace("Status"+payments1.getStatus()); trace("Date"+payments1.getDate()); } } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.getPaymentByCart(cartId); System.out.println("cartId is " + cart.getCartId()); Cart.Payment payment=cart.getPayment(); System.out.println("Transaction Id"+payment.getTransactionId()); System.out.println("Total Amount from payment node"+payment.getTotalAmount()); System.out.println("Status"+payment.getStatus()); System.out.println("Date"+payment.getDate()); String jsonResponse = cart.toString();
Fetch payment information based on user ID and status.
Required Parameters
userName - Name of the user whose payment information has to be fetched.
paymentStatus - Status for which type of payment information has to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getPaymentsByUserAndStatus(userName, PaymentStatus.AUTHORIZED,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Cart> cart = (ArrayList<Cart>)response; for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Cart> cart = (List<Cart>) response; for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString(); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getPaymentsByUserAndStatus:userName paymentStatus:AUTHORIZED completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *cartList = (NSArray*)responseObj; for(Cart *cart in cartList){ NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let username = "username" let paymentStatus = "AUTHORIZED" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getPaymentsByUserAndStatus(username, status:paymentStatus, completionBlock: { (success, response, exception) -> Void in if(success) { let cartList = response as! NSArray for cart in cartList { NSLog("CartId is : %@",cart.cartId) let payment = cart.paymentObj as! Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %lf",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); ArrayList<Cart> cart = cartService.getPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } String jsonResponse = cart.get(0).toString();String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { App42Log.Console("cartId is :" + cart[i].GetCartId()); App42Log.Console("Transaction Id"+cart[i].GetPayment().GetTransactionId()); App42Log.Console("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); App42Log.Console("Status"+cart[i].GetPayment().GetStatus()); App42Log.Console("Date"+cart[i].GetPayment().GetDate()); } App42Log.Console("jsonResponse is :" + cart[0].ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); IList<Cart> cart = cartService.GetPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString();$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cartResponse = $cartService->getPaymentsByUserAndStatus($userName,PaymentStatus::AUTHORIZED); foreach ($cartResponse as $cart) { print_r("cartId is :" . $cart->getCartId()); print_r("Transaction Id :" . $cart->getPayment()->getTransactionId()); print_r("Total Amount from payment node :" . $cart->getPayment()->getTotalAmount()); print_r("Status : " . $cart->getPayment()->getStatus()); print_r("Date : " . $cart->getPayment()->getDate()); } $jsonResponse = $cartResponse[0]->toString();Coming Soonuser_id = "user_id"; p_status = App42::Shopping::Payment_status.new(); payment_status = p_status.enum("AUTHORIZED"); cart_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart_list = cart_service.get_payments_by_user_and_status(user_id, payment_status); /* returns the list of Cart object. */ for cart in cart_list do puts "cartId is #{cart.cart_id}"; puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; end json_response = cart_list.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { trace("response is Array" + response); for(var i:int = 0;i < response.length;i++) { var cart:Cart = Cart(response[i]) var payments:Payment = cart.getPayment(); trace("CartId is:"+cart.getCartId()); if(cart.getPayment()!=null) { trace("Transaction Id"+payments.getTransactionId()); trace("Total Amount from payment node"+payments.getTotalAmount()); trace("Status"+payments.getStatus()); trace("Date"+payments.getDate()); } } } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector cart = cartService.getPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + ((Cart)cart.elementAt(i)).getCartId()); System.out.println("Transaction Id "+((Cart)cart.elementAt(i)).getPayment().getTransactionId()); System.out.println("Total Amount from payment node "+((Cart)cart.elementAt(i)).getPayment().getTotalAmount()); System.out.println("Status "+((Cart)cart.elementAt(i)).getPayment().getStatus()); System.out.println("Date "+((Cart)cart.elementAt(i)).getPayment().getDate()); } String jsonResponse = ((Cart)cart.elementAt(0)).toString();
Fetch payment information based on status.
Required Parameters
paymentStatus - Status for which type of payment information has to be fetched.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Cart> cart = (ArrayList<Cart>)response; for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentsByStatus(PaymentStatus.AUTHORIZED, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getPaymentsByStatus:AUTHORIZED completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *cartList = (NSArray*)responseObj; for(Cart *cart in cartList){ NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let paymentStatus = "AUTHORIZED" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getPaymentsByStatus(paymentStatus, completionBlock: { (success, response, exception) -> Void in if(success) { let cartList = response as! NSArray for cart in cartList { NSLog("CartId is : %@",cart.cartId) let payment = cart.paymentObj as Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %d",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); ArrayList<Cart> cart = cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } String jsonResponse = cart.get(0).toString();App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentsByStatus(PaymentStatus.AUTHORIZED, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { App42Log.Console("cartId is :" + cart[i].GetCartId()); App42Log.Console("Transaction Id"+cart[i].GetPayment().GetTransactionId()); App42Log.Console("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); App42Log.Console("Status"+cart[i].GetPayment().GetStatus()); App42Log.Console("Date"+cart[i].GetPayment().GetDate()); } App42Log.Console("jsonResponse is :" + cart[0].ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonApp42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); IList<Cart> cart = cartService.GetPaymentsByStatus(PaymentStatus.AUTHORIZED); for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString();App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cartResponse = $cartService->getPaymentsByStatus(PaymentStatus::AUTHORIZED); foreach ($cartResponse as $cart) { print_r("cartId is :" . $cart->getCartId()); print_r("Transaction Id :" . $cart->getPayment()->getTransactionId()); print_r("Total Amount from payment node :" . $cart->getPayment()->getTotalAmount()); print_r("Status : " . $cart->getPayment()->getStatus()); print_r("Date : " . $cart->getPayment()->getDate()); } $jsonResponse = $cartResponse[0]->toString();Coming Soonp_status = App42::Shopping::Payment_status.new(); Payment_status = p_status.enum("AUTHORIZED"); cart_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart_list = cart_list = cart_service.get_payments_by_status(Payment_status); /* returns the list of Cart object. */ for cart in cart_list do puts "cartId is #{cart.cart_id}"; puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; end json_response = cart_list.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { trace("response is Array" + response); for(var i:int = 0;i < response.length;i++) { var cart:Cart = Cart(response[i]) var payments:Payment = cart.getPayment(); trace("CartId is:"+cart.getCartId()); if(cart.getPayment()!=null) { trace("Transaction Id"+payments.getTransactionId()); trace("Total Amount from payment node"+payments.getTotalAmount()); trace("Status"+payments.getStatus()); trace("Date"+payments.getDate()); } } } } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector cart = cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + ((Cart)cart.elementAt(i)).getCartId()); System.out.println("Transaction Id "+((Cart)cart.elementAt(i)).getPayment().getTransactionId()); System.out.println("Total Amount from payment node "+((Cart)cart.elementAt(i)).getPayment().getTotalAmount()); System.out.println("Status "+((Cart)cart.elementAt(i)).getPayment().getStatus()); System.out.println("Date "+((Cart)cart.elementAt(i)).getPayment().getDate()); } String jsonResponse = ((Cart)cart.elementAt(0)).toString();
History of carts and payments for a user. It gives all the carts which are in AUTHORIZED, DECLINED, PENDING state.
Required Parameters
userName - Name of the user whose payment history has to be fetched.
String userName = "Nick"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getPaymentHistoryByUser(userName,new App42CallBack() { public void onSuccess(Object response) { ArrayList<Cart> cart = (ArrayList<Cart>)response; for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("userName is :" + cart.get(i).getUserName()); System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("State is :"+cart.get(i).getState()); System.out.println("CreationTime is :"+cart.get(i).getCreationTime()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentHistoryByUser(userName, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString(); } }NSString *userName = @"Nick"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getPaymentHistoryByUser:userName completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *cartList = (NSArray*)responseObj; for(Cart *cart in cartList){ NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let username = "username" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getPaymentHistoryByUser(username, completionBlock: { (success, response, exception) -> Void in if(success) { let cartList = response as! NSArray for cart in cartList { NSLog("CartId is : %@",cart.cartId) let payment = cart.paymentObj as Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %lf",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); ArrayList<Cart> cart = cartService.getPaymentHistoryByUser(userName); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("userName is :" + cart.get(i).getUserName()); System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("State is :"+cart.get(i).getState()); System.out.println("CreationTime is :"+cart.get(i).getCreationTime()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } String jsonResponse = cart.get(0).toString();String userName = "Nick"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentHistoryByUser(userName, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { App42Log.Console("cartId is :" + cart[i].GetCartId()); App42Log.Console("Transaction Id"+cart[i].GetPayment().GetTransactionId()); App42Log.Console("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); App42Log.Console("Status"+cart[i].GetPayment().GetStatus()); App42Log.Console("Date"+cart[i].GetPayment().GetDate()); } App42Log.Console("jsonResponse is :" + cart[0].ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString userName = "Nick"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); IList<Cart> cart = cartService.GetPaymentHistoryByUser(userName); for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString();$userName = "Nick"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cartResponse = $cartService->getPaymentHistoryByUser($userName); foreach ($cartResponse as $cart) { print_r("cartId is :" . $cart->getCartId()); print_r("Transaction Id :" . $cart->getPayment()->getTransactionId()); print_r("Total Amount from payment node :" . $cart->getPayment()->getTotalAmount()); print_r("Status : " . $cart->getPayment()->getStatus()); print_r("Date : " . $cart->getPayment()->getDate()); } $jsonResponse = $cartResponse[0]->toString();Coming Soonuser_id = "user_id"; cart_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart_list = cart_service.get_payment_history_by_user(user_id); /* returns the list of Cart object. */ for cart in cart_list do puts "userName is #{cart.user_name}"; puts "cartId is #{cart.cart_id}"; puts "state is #{cart.state}"; item_list =Array.new(); item_list = cart.get_item_list(); for item in item_list do puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; end puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; end json_response = cart_list.to_s();var userName:String = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getPaymentHistoryByUser(userName,new payment()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { trace("response is Array" + response); for(var i:int = 0;i < response.length;i++) { var cart:Cart = Cart(response[i]) var payments:Payment = cart.getPayment(); var itemList1:Array = cart.getItemList(); trace("CartId is:"+cart.getCartId()); trace("Cart Session is"+cart.getCartSession()); trace("CheckOut Time : "+cart.getCheckOutTime()); trace("CreationTime is"+cart.getCreationTime()); trace("State is:"+cart.getState()); trace("UserName is:"+cart.getUserName()); if(itemList1!= null) { for(var t:int=0;t<itemList1.length;t++) { var item1:Item = Item(itemList1[t]); trace("ItemId is"+item1.getItemId()); trace("Quantity"+item1.getQuantity()); trace("Total Amount"+item1.getTotalAmount()); } } if(cart.getPayment()!=null) { trace("Transaction Id"+payments.getTransactionId()); trace("Total AMount from payment node"+payments.getTotalAmount()); trace("Status"+payments.getStatus()); trace("Date"+payments.getDate()); } } } } }Coming SoonString userName = "Nick"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector cart = cartService.getPaymentHistoryByUser(userName); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + ((Cart)cart.elementAt(i)).getCartId()); System.out.println("Transaction Id "+((Cart)cart.elementAt(i)).getPayment().getTransactionId()); System.out.println("Total Amount from payment node "+((Cart)cart.elementAt(i)).getPayment().getTotalAmount()); System.out.println("Status "+((Cart)cart.elementAt(i)).getPayment().getStatus()); System.out.println("Date "+((Cart)cart.elementAt(i)).getPayment().getDate()); } String jsonResponse = ((Cart)cart.elementAt(0)).toString();
It gives all the carts which are in AUTHORIZED, DECLINED, PENDING state.
App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.getPaymentHistoryAll(new App42CallBack() { public void onSuccess(Object response) { ArrayList<Cart> cart = (ArrayList<Cart>)response; for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("userName is :" + cart.get(i).getUserName()); System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("State is :"+cart.get(i).getState()); System.out.println("CreationTime is :"+cart.get(i).getCreationTime()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentHistoryAll(new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString(); } }[App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getPaymentHistoryAll:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { NSArray *cartList = (NSArray*)responseObj; for(Cart *cart in cartList){ NSLog(@"cartId is = %@",cart.cartId); NSLog(@"TransactionID = %@",cart.paymentObj.transactionId); NSLog(@"Status = %@",cart.paymentObj.status); NSLog(@"Payment Date = %@",cart.paymentObj.date); NSLog(@"Total amount = %lf",cart.paymentObj.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.getPaymentHistoryAll({ (success, response, exception) -> Void in if(success) { let cartList = response as! NSArray for cart in cartList { NSLog("CartId is : %@",cart.cartId) let payment = cart.paymentObj as Payment NSLog("Transaction Id : %@",payment.transactionId) NSLog("Total Amount from payment node : %d",payment.totalAmount) NSLog("Status : %@",payment.status) NSLog("Date : %@",payment.date) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); ArrayList<Cart> cart = cartService.getPaymentHistoryAll(); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + cart.get(i).getCartId()); System.out.println("userName is :" + cart.get(i).getUserName()); System.out.println("State is :"+cart.get(i).getState()); System.out.println("CreationTime is :"+cart.get(i).getCreationTime()); System.out.println("Transaction Id"+cart.get(i).getPayment().getTransactionId()); System.out.println("Total Amount from payment node"+cart.get(i).getPayment().getTotalAmount()); System.out.println("Status"+cart.get(i).getPayment().getStatus()); System.out.println("Date"+cart.get(i).getPayment().getDate()); } String jsonResponse = cart.get(0).toString();App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetPaymentHistoryAll(new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { IList<Cart> cart = (IList<Cart>) response; for(int i=0; i<cart.Count; i++) { App42Log.Console("cartId is :" + cart[i].GetCartId()); App42Log.Console("Transaction Id"+cart[i].GetPayment().GetTransactionId()); App42Log.Console("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); App42Log.Console("Status"+cart[i].GetPayment().GetStatus()); App42Log.Console("Date"+cart[i].GetPayment().GetDate()); } App42Log.Console("jsonResponse is :" + cart[0].ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonApp42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); IList<Cart> cart = cartService.GetPaymentHistoryAll(); for(int i=0; i<cart.Count; i++) { Console.WriteLine("cartId is :" + cart[i].GetCartId()); Console.WriteLine("Transaction Id"+cart[i].GetPayment().GetTransactionId()); Console.WriteLine("Total Amount from payment node"+cart[i].GetPayment().GetTotalAmount()); Console.WriteLine("Status"+cart[i].GetPayment().GetStatus()); Console.WriteLine("Date"+cart[i].GetPayment().GetDate()); } String jsonResponse = cart[0].ToString();App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cartResponse = $cartService->getPaymentHistoryAll(); foreach ($cartResponse as $cart) { print_r("cartId is :" . $cart->getCartId()); print_r("Transaction Id :" . $cart->getPayment()->getTransactionId()); print_r("Total Amount from payment node :" . $cart->getPayment()->getTotalAmount()); print_r("Status : " . $cart->getPayment()->getStatus()); print_r("Date : " . $cart->getPayment()->getDate()); } $jsonResponse = $cartResponse[0]->toString();Coming Sooncart_list = Array.new(); api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart_list = cart_service.get_payment_history_all(); /* returns the list of Cart object. */ for cart in cart_list do puts "userName is #{cart.user_name}"; puts "cartId is #{cart.cart_id}"; puts "state is #{cart.state}"; item_list =Array.new(); item_list = cart.get_item_list(); for item in item_list do puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; end puts "cartId is #{cart.cart_id}"; puts "payment is #{cart.payment}"; puts "transactionId is #{cart.transaction_id}"; puts "totalAmount is #{cart.total_amount}"; end json_response = cart_list.to_s();App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getPaymentHistoryAll(new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { if(response is Array) { trace("response is Array" + response); for(var i:int = 0;i < response.length;i++) { var cart:Cart = Cart(response[i]) var payments:Payment = cart.getPayment(); var itemList1:Array = cart.getItemList(); trace("CartId is:"+cart.getCartId()); trace("CheckOut Time : "+cart.getCheckOutTime()); trace("CreationTime is"+cart.getCreationTime()); trace("State is:"+cart.getState()); trace("UserName is:"+cart.getUserName()); if(itemList1!= null) { for(var t:int=0;t<itemList1.length;t++) { var item1:Item = Item(itemList1[t]); trace("ItemId is"+item1.getItemId()); trace("Quantity"+item1.getQuantity()); trace("Total Amount"+item1.getTotalAmount()); } } if(cart.getPayment()!=null) { trace("Transaction Id"+payments.getTransactionId()); trace("Total Amount from payment node"+payments.getTotalAmount()); trace("Status"+payments.getStatus()); trace("Date"+payments.getDate()); } } } } }Coming SoonApp42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector cart = cartService.getPaymentHistoryAll(); for(int i=0;i<cart.size();i++) { System.out.println("cartId is :" + ((Cart)cart.elementAt(i)).getCartId()); System.out.println("userName is :" + ((Cart)cart.elementAt(i)).getUserName()); System.out.println("State is :"+((Cart)cart.elementAt(i)).getState()); System.out.println("CreationTime is :"+((Cart)cart.elementAt(i)).getCreationTime()); System.out.println("Transaction Id "+((Cart)cart.elementAt(i)).getPayment().getTransactionId()); System.out.println("Total Amount from payment node "+((Cart)cart.elementAt(i)).getPayment().getTotalAmount()); System.out.println("Status "+((Cart)cart.elementAt(i)).getPayment().getStatus()); System.out.println("Date "+((Cart)cart.elementAt(i)).getPayment().getDate()); } String jsonResponse = ((Cart)cart.elementAt(0)).toString();
To increase the quantity of existing item in the cart.
Required Parameters
cartID - The cart ID for which quantity of item has to be increased.
itemID - The item ID that has to be increased.
itemQuantity - The quantity of the item that has to be increased.
String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.increaseQuantity(cartId , itemID, itemQuantity,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.IncreaseQuantity(cartId,itemID,itemQuantity,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i < itemList.Count; i++) { Console.WriteLine("ItemId is " + itemList[i].GetItemId()); Console.WriteLine("Price " + itemList[i].GetPrice()); Console.WriteLine("Quantity " + itemList[i].GetQuantity()); Console.WriteLine("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; int itemQuantity = 12; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService increaseQuantity:cartId itemID:itemID itemQuantity:itemQuantity completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); for (Item *item in cart.itemListArray) { NSLog(@"ItemName=%@",item.name); NSLog(@"ItemID=%@",item.itemId); NSLog(@"ItemPrice = %d", [item.price intValue]); NSLog(@"Item Image = %@",item.image); NSLog(@"Item Quantity = %d",item.quantity); NSLog(@"Total Amount = %lf",item.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" let itemID = "itemID" let itemQuantity:Int32 = 12 App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.increaseQuantity(cartId, itemID:itemID, itemQuantity:itemQuantity, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let itemList = cart.itemListArray for item in itemList { NSLog("ItemId is : %@", item.itemId) let price = item.price as NSDecimalNumber NSLog("Price is : %d", price.intValue) NSLog("Quantity is : %d", item.quantity) NSLog("Total Amount is : %d", item.totalAmount) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.increaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } String jsonResponse = cart.toString();String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.IncreaseQuantity(cartId,itemID,itemQuantity, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i < itemList.Count; i++) { App42Log.Console("ItemId is " + itemList[i].GetItemId()); App42Log.Console("Price " + itemList[i].GetPrice()); App42Log.Console("Quantity " + itemList[i].GetQuantity()); App42Log.Console("Total Amount " + itemList[i].GetTotalAmount()); } App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.IncreaseQuantity(cartId,itemID,itemQuantity); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i < itemList.Count; i++) { Console.WriteLine("ItemId is " + itemList[i].GetItemId()); Console.WriteLine("Price " + itemList[i].GetPrice()); Console.WriteLine("Quantity " + itemList[i].GetQuantity()); Console.WriteLine("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString();$cartId = "cartId"; $itemID = "itemID"; $itemQuantity = 12; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->increaseQuantity($cartId,$itemID,$itemQuantity); print_r("cartId is " . $cart->getCartId()); $item = $cart->GetItemList(); foreach($item as $itemList ) { print_r("ItemId is".$itemList->getItemId()); print_r("Price ".$itemList->getPrice()); print_r("Quantity".$itemList->getQuantity()); print_r("Total Amount".$itemList->getTotalAmount()); } $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_iD"; item_id = "item_id"; item_quantity = 5; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.increase_quantity(cart_id, item_id, item_quantity); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; item_list = Array.new(); item_list = cart.getItemList(); for item in item_list do puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; end json_response = cart.to_s();var cartId:String = "cartId"; var itemId:String = "itemId"; var itemQuantity:int = 12; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.increaseQuantity(cartId,itemId, itemQuantity,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); var itemList:Array = cart1.getItemList(); if(itemList != null) { for(var p:int=0;p<itemList.length;p++) { var item:Item = Item(itemList[p]); trace("ItemId is"+item.getItemId()); trace("Price "+item.getPrice()); trace("Quantity"+item.getQuantity()); trace("Total Amount"+item.getTotalAmount()); } } } }Coming SoonString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.increaseQuantity(cartId,itemID,itemQuantity); App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is " + ((Cart.Item)itemList.elementAt(i)).getItemId()); System.out.println("Price " + ((Cart.Item)itemList.elementAt(i)).getPrice()); System.out.println("Quantity " + ((Cart.Item)itemList.elementAt(i)).getQuantity()); System.out.println("Total Amount " + ((Cart.Item)itemList.elementAt(i)).getTotalAmount()); } String jsonResponse = cart.toString();
To decrease the quantity of existing item in the cart.
Required Parameters
cartID - The cart ID for which item has to be decreased.
itemID - The item ID that has to be decreased.
itemQuantity - The quantity of the item that has to be decreased.
String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.decreaseQuantity(cartId, itemID, itemQuantity,new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart)response; System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.DecreaseQuantity(cartId,itemID,itemQuantity,new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { Cart cart = (Cart) response; IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i < itemList.Count; i++) { Console.WriteLine("ItemId is " + itemList[i].GetItemId()); Console.WriteLine("Price " + itemList[i].GetPrice()); Console.WriteLine("Quantity " + itemList[i].GetQuantity()); Console.WriteLine("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; int itemQuantity = 12; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService decreaseQuantity:cartId itemID:itemID itemQuantity:itemQuantity completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); for (Item *item in cart.itemListArray) { NSLog(@"ItemName=%@",item.name); NSLog(@"ItemID=%@",item.itemId); NSLog(@"ItemPrice = %d", [item.price intValue]); NSLog(@"Item Image = %@",item.image); NSLog(@"Item Quantity = %d",item.quantity); NSLog(@"Total Amount = %lf",item.totalAmount); } } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" let itemID = "itemID" let itemQuantity:Int32 = 10 App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.decreaseQuantity(cartId, itemID:itemID, itemQuantity:itemQuantity, completionBlock: { (success, response, exception) -> Void in if(success) { let cart = response as! Cart NSLog("CartId is : %@",cart.cartId) let itemList = cart.itemListArray for item in itemList { NSLog("ItemId is : %@", item.itemId) let price = item.price as NSDecimalNumber NSLog("Price is : %d", price.intValue) NSLog("Quantity is : %d", item.quantity) NSLog("Total Amount is : %d", item.totalAmount) } } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Cart cart = cartService.decreaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is :" + cart.getCartId()); ArrayList<Cart.Item> itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is"+itemList.get(i).getItemId()); System.out.println("Price "+itemList.get(i).getPrice()); System.out.println("Quantity"+itemList.get(i).getQuantity()); System.out.println("Total Amount"+itemList.get(i).getTotalAmount()); } String jsonResponse = cart.toString();String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 8; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.DecreaseQuantity(cartId,itemID,itemQuantity, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { Cart cart = (Cart) response; IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i < itemList.Count; i++) { App42Log.Console("ItemId is " + itemList[i].GetItemId()); App42Log.Console("Price " + itemList[i].GetPrice()); App42Log.Console("Quantity " + itemList[i].GetQuantity()); App42Log.Console("Total Amount " + itemList[i].GetTotalAmount()); } App42Log.Console("jsonResponse is :" + cart.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); Cart cart = cartService.DecreaseQuantity(cartId,itemID,itemQuantity); Console.WriteLine("cartId is " + cart.GetCartId()); IList<Cart.Item> itemList = cart.GetItemList(); for(int i=0;i < itemList.Count; i++) { Console.WriteLine("ItemId is " + itemList[i].GetItemId()); Console.WriteLine("Price " + itemList[i].GetPrice()); Console.WriteLine("Quantity " + itemList[i].GetQuantity()); Console.WriteLine("Total Amount " + itemList[i].GetTotalAmount()); } String jsonResponse = cart.ToString();$cartId = "cartId"; $itemID = "itemID"; $itemQuantity = 12; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $cart = $cartService->decreaseQuantity($cartId,$itemID,$itemQuantity); print_r("cartId is " . $cart->getCartId()); $item = $cart->GetItemList(); foreach($item as $itemList ) { print_r("ItemId is".$itemList->getItemId()); print_r("Price ".$itemList->getPrice()); print_r("Quantity".$itemList->getQuantity()); print_r("Total Amount".$itemList->getTotalAmount()); } $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; item_id = "item_id"; item_quantity = 3; api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.decrease_quantity(cart_id, item_id, item_quantity); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; item_list = Array.new(); item_list = cart.get_item_list(); for item in item_list do puts "itemid is #{item.item_id}"; puts "quantity is #{item.quantity}"; puts "price is #{item.price}"; puts "totalAmount is #{item.total_amount}"; end json_response = cart.to_s();var cartId:String = "cartId"; var itemId:String = "itemId"; var itemQuantity:int = 12; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.decreaseQuantity(cartId,itemId, itemQuantity,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { trace("response is" + response); var cart1:Cart = Cart(response); trace("CartId is:"+cart1.getCartId()); var itemList:Array = cart1.getItemList(); if(itemList != null) { for(var p:int=0;p<itemList.length;p++) { var item:Item = Item(itemList[p]); trace("ItemId is"+item.getItemId()); trace("Price "+item.getPrice()); trace("Quantity"+item.getQuantity()); trace("Total Amount"+item.getTotalAmount()); } } } }Coming SoonString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.decreaseQuantity(cartId,itemID,itemQuantity); App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); Vector itemList = cart.getItemList(); for(int i=0;i<itemList.size();i++) { System.out.println("ItemId is " + ((Cart.Item)itemList.elementAt(i)).getItemId()); System.out.println("Price " + ((Cart.Item)itemList.elementAt(i)).getPrice()); System.out.println("Quantity " + ((Cart.Item)itemList.elementAt(i)).getQuantity()); System.out.println("Total Amount " + ((Cart.Item)itemList.elementAt(i)).getTotalAmount()); } String jsonResponse = cart.toString();
Remove the specified item from the specified cart.
Required Parameters
cartId - The cart ID from which the item has to be removed.
itemId - ID of the item which has to be removed.
String cartId = "cartId"; String itemId = "itemId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.removeItem(cartId, itemId,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; String itemId = "itemId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.RemoveItem(cartId,itemId, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response Is : " + app42Response); String jsonResponse = app42Response.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService removeItem:cartId itemId:itemId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" let itemID = "itemID" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.removeItem(cartId,itemID: itemID, completionBlock: { (success, response, exception) -> Void in if(success) { let app42Response = response as! App42Response NSLog("App42Response is : %@", app42Response.strResponse) NSLog("IsResponseSuccess : %@", app42Response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; String itemId = "itemId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); App42Response app42response = cartService.removeItem(cartId, itemId); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String cartId = "cartId"; String itemID = "itemID"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.RemoveItem(cartId,itemID, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is :" + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; String itemId = "itemId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); App42Response app42Response = cartService.RemoveItem(cartId, itemId); Boolean success = app42Response.IsResponseSuccess(); Console.WriteLine("App42Response Is : " + app42Response); String jsonResponse = app42Response.ToString();$cartId = "cartId"; $itemId = "itemId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $response = $cartService->removeItem($cartId, $itemId); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonComing Soonvar cartId:String = "cartId"; var itemID:String = "itemID"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.removeItem(cartId,itemID,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString cartId = "cartId"; String itemId = "itemId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); App42Response response = cartService.removeItem(cartId, itemId); System.out.println("response is " + response) ; boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
Remove all Items from the specified cart.
Required Parameters
cartId - The cart ID from which the item has to be removed.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cartService.removeAllItems(cartId,new App42CallBack() { public void onSuccess(Object response) { App42Response app42response = (App42Response)response; System.out.println("response is " + app42response) ; } public void onException(Exception ex) { System.out.println("Exception Message"+ex.getMessage()); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.RemoveAllItems(cartId, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { Console.WriteLine("Exception Message : " + exception); } public void OnSuccess(Object response) { App42Response app42Response = (App42Response) response; Console.WriteLine("App42Response Is : " + app42Response); String jsonResponse = app42Response.ToString(); } }NSString *cartId = @"cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService removeAllItems:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { App42Response *response = (App42Response*)responseObj; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString]; } else { NSLog(@"Exception = %@",[exception reason]); NSLog(@"HTTP error Code = %d",[exception httpErrorCode]); NSLog(@"App Error Code = %d",[exception appErrorCode]); NSLog(@"User Info = %@",[exception userInfo]); } }];let cartId = "cartId" App42API.initializeWithAPIKey("API_KEY", andSecretKey:"SECRET_KEY") let cartService = App42API.buildCartService() as? CartService cartService?.removeAllItems(cartId, completionBlock: { (success, response, exception) -> Void in if(success) { let app42Response = response as! App42Response NSLog("App42Response is : %@", app42Response.strResponse) NSLog("IsResponseSuccess : %@", app42Response.isResponseSuccess) } else { NSLog("%@", exception.reason!) NSLog("%d", exception.appErrorCode) NSLog("%d", exception.httpErrorCode) NSLog("%@", exception.userInfo!) } })String cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); App42Response app42response = cartService.removeAllItems(cartId); System.out.println("response is " + app42response) ; boolean success = app42response.isResponseSuccess(); String jsonResponse = app42response.toString();String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.RemoveAllItems(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnSuccess(object response) { App42Response app42Response = (App42Response) response; App42Log.Console("app42Response is :" + app42Response.ToString()); } public void OnException(Exception e) { App42Log.Console("Exception : " + e); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); App42Response app42Response = cartService.RemoveAllItems(cartId); Boolean success = app42Response.IsResponseSuccess(); Console.WriteLine("App42Response Is : " + app42Response); String jsonResponse = app42Response.ToString();$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); $response = $cartService->removeAllItems($cartId); print_r("Response is : ".$response->toString()); $success = $response->isResponseSuccess(); $jsonResponse = $response->toString();Coming SoonComing Soonvar cartId:String = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.removeAllItems(cartId,new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { trace("Exception Message " + exception); } public function onSuccess(response:Object):void { var app42response :App42Response= App42Response(response); trace("response is " + app42response) } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); App42Response response = cartService.removeAllItems(cartId); System.out.println("response is " + response) ; boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();
The functions available under Shopping Cart API can throw some exceptions in abnormal conditions. For example, if a developer is requesting a cart with id which is not in database, the function will throw the App42Exception (as shown below) with message as “Not Found” and the appErrorCode as “3301” and the details as “Cart with the id ‘@cartId’ does not exist”.
String cartId = "cartId"; App42API.initialize("ANDROID_APPLICATION_CONTEXT","API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); cart.getCartDetails(cartId, new App42CallBack() { public void onSuccess(Object response) { Cart cart = (Cart )response; System.out.println("userName is :" + cart.getUserName()); System.out.println("cartId is :" + cart.getCartId()); System.out.println("State is :"+cart.getState()); System.out.println("CreationTime is :"+cart.getCreationTime()); } public void onException(Exception ex) { App42Exception exception = (App42Exception)ex; int appErrorCode = exception.getAppErrorCode(); int httpErrorCode = exception.getHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.getMessage(); } });String cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetCartDetails(cartId, new Callback()); public class Callback : App42Callback { public void OnException(App42Exception exception) { int appErrorCode = exception.GetAppErrorCode(); int httpErrorCode = exception.GetHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = exception.GetMessage(); } public void OnSuccess(Object object) { Cart cart = (Cart) object; String jsonResponse = cart.ToString(); } }String cartId = "cartId"; [App42API initializeWithAPIKey:@"APP_KEY" andSecretKey:@"SECRET_KEY"]; CartService *cartService = [App42API buildCartService]; [cartService getCartDetails:cartId completionBlock:^(BOOL success, id responseObj, App42Exception *exception) { if (success) { Cart *cart = (Cart*)responseObj; NSLog(@"userName is = %@" ,cart.userName); NSLog(@"cartId is = %@",cart.cartId); } else { int appErrorCode = ex.appErrorCode; int httpErrorCode = ex.httpErrorCode; if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } NSString *jsonText = ex.reason; } }];Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); try { Cart cart = cartService.getCartDetails(cartId); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); }String cartId = "cartId"; App42Log.SetDebug(true); //Prints output in your editor console App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); cartService.GetCartDetails(cartId, new UnityCallBack()); public class UnityCallBack : App42CallBack { public void OnException(Exception e) { App42Exception ex = (App42Exception)e; int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); } public void OnSuccess(object response) { App42Log.Console("response is :" + response.ToString()); } }Not AvailableComing SoonComing SoonString cartId = "cartId"; App42API.Initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.BuildCartService(); try { Cart cart = cartService.GetCartDetails(cartId); } catch(App42Exception ex) { int appErrorCode = ex.GetAppErrorCode(); int httpErrorCode = ex.GetHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.GetMessage(); }$cartId = "cartId"; App42API::initialize("API_KEY","SECRET_KEY"); $cartService = App42API::buildCartService(); try { $cart = $cartService->getCartDetails($cartId); } catch(App42Exception $ex ) { $appErrorCode = ex->getAppErrorCode(); $httpErrorCode = ex->getHttpErrorCode(); if($appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if($appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if($appErrorCode == 1401) { // handle here for Client is not authorized } else if($appErrorCode == 1500) { // handle here for Internal Server Error } String $jsonText = ex->getMessage(); }Coming Sooncart_id = "cartId"; begin api = App42::ServiceAPI.new("API_KEY","SECRET_KEY") cart_service = api.build_cart_service() cart = cart_service.get_cart_details(cart_id); /* returns the Cart object. */ rescue App42Exception => ex appErrorCode = ex.app_error_code; httpErrorCode = ex.http_error_code; if(appErrorCode == 3301) # Handle here for Not Found (Cart with the id '@cartId' does not exist.) elsif(appErrorCode == 3302) # Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) elsif(appErrorCode == 1401) # handle here for Client is not authorized. else(appErrorCode == 1500) # handle here for Internal Server Error end jsonText = ex.getMessage(); endvar cartId:String = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); var cartService:CartService = App42API.buildCartService(); cartService.getCartDetails(cartId, new callback()); class callback implements App42CallBack { public function onException(exception:App42Exception):void { var appErrorCode:int = exception.getAppErrorCode(); var httpErrorCode:int = exception.getHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } } public function onSuccess(response:Object):void { trace("response is" + response); } }Coming SoonString cartId = "cartId"; App42API.initialize("API_KEY","SECRET_KEY"); CartService cartService = App42API.buildCartService(); try { Cart cart = cartService.getCartDetails(cartId); } catch(App42Exception ex) { int appErrorCode = ex.getAppErrorCode(); int httpErrorCode = ex.getHttpErrorCode(); if(appErrorCode == 3301) { // Handle here for Not Found (Cart with the id '@cartId' does not exist.) } else if(appErrorCode == 3302) { // Handle here for Bad Request (The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartRow.state' state. Please use the paymentHistoryXXX methods.) } else if(appErrorCode == 1401) { // handle here for Client is not authorized } else if(appErrorCode == 1500) { // handle here for Internal Server Error } String jsonText = ex.getMessage(); }
Functions in Cart API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The requested parameters are invalid.
1401 - UNAUTHORIZED - Client is not authorized.
1500 - INTERNAL SERVER ERROR - Internal Server Error. Please try again.
3300 - NOT FOUND - User by the name '@userName' does not exist.
3301 - NOT FOUND - Cart with the id '@cartId' does not exist.
3302 - BAD REQUEST - The request parameters are invalid. The details of the cart with the Id '@cartId' cannot be fetched since it is in '@cartState' state. Please use the paymentHistoryXXX methods.
3303 - BAD REQUEST - The request parameters are invalid. Item to the cart with the Id '@cartId' cannot be added since it is in '@cartState' state.
3304 - NOT FOUND - Cart with the id '@cartId' does not have any items.
3305 - BAD REQUEST - The request parameters are invalid. The cart with the Id '@cartId' cannot be checked out since it is in '@cartState' state.
3306 - NOT FOUND - Cart with the id '@cartId' does not have any items to checkout.
3307 - BAD REQUEST - The request parameters are invalid. Cart with the Id '@cartId' is already in '@cartState' state.
3308 - BAD REQUEST - The request parameters are invalid. Cart with the Id '@cartId' is not in 'CHECKOUT' state. Payment cannot be initiated.
3309 - NOT FOUND - Cart with the id '@cartId' does not have the item with the Id '@itemId'.
3310 - NOT FOUND - Cart for the user with the id '@userId' does not exist.
3311 - NOT FOUND - Payment transactions for the user with the id '@userId' does not exist.
3312 - NOT FOUND - Payment transactions for the Cart with the id '@cartId' does not exist.
3313 - NOT FOUND - Cart for the user with the id '@userId' and status '@status' does not exist.
3314 - NOT FOUND - Payment transactions for the user with the id '@userId' and status '@status' does not exist.
3315 - NOT FOUND - Payment transactions for the status '@status' does not exist.
3316 - NOT FOUND - Cart for the user with the id '@userId' does not exist in payment history.
3317 - NOT FOUND - Carts with status ('DECLINED', 'PENDING', 'AUTHORIZED') does not exist in payment history.
3318 - BAD REQUEST - The request parameters are invalid. Item from the cart with the Id '@cartId' cannot be removed since it is in '@cartState' state.
3319 - BAD REQUEST - The request parameters are invalid. Payment for cart with the Id '@cartId' cannot be initiated since it is already in 'AUTHORIZED' state.
3320 - BAD REQUEST - Item with the Id '@itemId' in the cart with the id '@cartId' already exists. Please use 'increaseQuantity' method to add more quantity.
3321 - BAD REQUEST - The request parameters are invalid. Requested quantity should be less then existing quantity.
3322 - NOT FOUND - Item with the id '@itemId' in the cart with the id '@cartId' does not exist.