This module provides cloud persistent Shopping Cart Service. App Developers can use this service to create a shopping cart, add items and check out. This module also enables maintenance of transaction records and their corresponding payment status. The payment gateway interface is not provided by the platform. The App developer is free to choose how he wants to manage the payment integration. Shopping cart module can also be used along with Catalogue service to create an end-to-end Shopping feature for mobile and web Apps
In order to use various functions available in a specific API, a developer has to create an instance of ServiceAPI by passing the apiKey and secretKey which will be created 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.
ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI *api = [[ServiceAPI alloc]init]; api.apiKey = @"<API_KEY>"; api.secretKey = @"<SECRET_KEY>";ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");ServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");Coming SoonNot AvailableServiceAPI api = new ServiceAPI("API_KEY","SECRET_KEY");$api = new ServiceAPI("API_KEY","SECRET_KEY");Coming Soonapi = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>")Coming SoonComing Soon
After initialization, developer needs to call the buildXXXService method on ServiceAPI instance to get the instance of the particular API that you wish to build. For example, To build an instance of CartService, buildCartService() method needs to be called.
CartService cartService = api.buildCartService();CartService cartService = api.BuildCartService();CartService *cartService = [api buildCartService];CartService cartService = api.buildCartService();CartService cartService = api.buildCartService();Coming SoonNot AvailableCartService cartService = api.BuildCartService();$cartService = $api->buildCartService();Coming Sooncart_service = api.build_cart_service()Coming SoonComing Soon
import com.shephertz.app42.paas.sdk.android.ServiceAPI; 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 com.shephertz.app42.paas.sdk.jme.ServiceAPI; 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;import com.shephertz.app42.paas.sdk.java.ServiceAPI; 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;Coming SoonNot Availableusing com.shephertz.app42.paas.sdk.csharp; using com.shephertz.app42.paas.sdk.csharp.shopping;use com\shephertz\app42\paas\sdk\php\App42Response; use com\shephertz\app42\paas\sdk\php\App42Exception; use com\shephertz\app42\paas\sdk\php\App42BadParameterException; use com\shephertz\app42\paas\sdk\php\App42NotFoundException; use com\shephertz\app42\paas\sdk\php\shopping\CartService; use com\shephertz\app42\paas\sdk\php\ServiceAPI; include_once '../CartService.php'; include_once '../ServiceAPI.php'; include_once '../App42Response.php'; include_once '../App42Exception.php'; include_once '../App42BadParameterException.php'; include_once '../App42NotFoundException.php';Coming Soonrequire 'App42_Ruby_API'Coming SoonComing Soon
Creates a Cart Session for the specified User.
Required Parameters
userName - User for whom Cart Session has to be 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"; Cart cart = cartService.createCart(userName); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String userName = "Nick"; cartService.CreateCart(userName,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.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"; Cart *cart = [cartService createCart:userName]; NSLog(@"userName is = %@" cart.userName); NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String userName = "Nick"; Cart cart = cartService.createCart(userName); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String userName = "Nick"; Cart cart = cartService.createCart(userName); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString userName = "Nick"; Cart cart = cartService.CreateCart(userName); Console.WriteLine("userName is " + cart.GetUserName()); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$userName = "Nick"; $cart = $cartService->createCart($userName); print_r("userName is " . $cart->getUserName()); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Soonuser_name = "Nick"; 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();Coming SoonComing Soon
Fetch Cart details. Can be used by the App developer to display Cart Details i.e. Items in a Cart.
Required Parameters
cartId - The Cart Id that has to be fetched.
String cartId = "cartId"; Cart cart = cartService.getCartDetails(cartId); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; cartService.GetCartDetails(cartId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.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"; Cart *cart = [cartService getCartDetails:cartId]; NSLog(@"userName is = %@" cart.userName); NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; Cart cart = cartService.getCartDetails(cartId); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; Cart cart = cartService.getCartDetails(cartId); System.out.println("userName is " + cart.getUserName()); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; Cart cart = cartService.GetCartDetails(cartId); Console.WriteLine("userName is " + cart.GetUserName()); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $cart = $cartService->getCartDetails($cartId); print_r("userName is " . $cart->getUserName()); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cartId"; 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();Coming SoonComing Soon
Adds an Item in the Cart with quantity and price. This method does not take currency. Its the onus of the App developer to maintain the currency. It takes only the price.
Required Parameters
cartID - The Cart Id into which item has to be added.
itemID - The Item id which has to be added in 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; Cart cart = cartService.addItem(cartId,itemID,itemQuantity,price); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; cartService.AddItem(cartId,itemID,itemQuantity,price,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; int itemQuantity = 12; double price = 1000; Cart *cart = [cartService addItem:cartId itemID:itemID itemQuantity:itemQuantity price:price]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; Cart cart = cartService.addItem(cartId,itemID,itemQuantity,price); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; Cart cart = cartService.addItem(cartId,itemID,itemQuantity,price); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; double price = 1000; Cart cart = cartService.AddItem(cartId,itemID,itemQuantity,price); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $itemID = "itemID"; $itemQuantity = 12; $price = 1000; $cart = $cartService->addItem($cartId,$itemID,$itemQuantity,$price); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; item_id = "item_id"; item_quantity = 12; price = 1000; 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();Coming SoonComing Soon
Fetches the Items from the specified Cart.
Required Parameters
cartId - The cart id from which items have to be fetched.
String cartId = "cartId"; Cart cart = cartService.getItems(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; cartService.GetItems(cartId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; Cart *cart = [cartService getItems:cartId]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; Cart cart = cartService.getItems(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; Cart cart = cartService.getItems(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; Cart cart = cartService.GetItems(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $cart = $cartService->getItems($cartId); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; 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();Coming SoonComing Soon
Fetches 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"; Cart cart = cartService.getItem(cartId,itemId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; String itemId = "itemId"; cartService.GetItem(cartId,itemId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemId = @"itemId"; Cart *cart = [cartService getItem:cartId itemId:itemId]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; String itemId = "itemId"; Cart cart = cartService.getItem(cartId,itemId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; String itemId = "itemId"; Cart cart = cartService.getItem(cartId,itemId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; String itemId = "itemId"; Cart cart = cartService.GetItem(cartId,itemId); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; String itemId = "itemId"; $cart = $cartService->getItem($cartId,$itemId); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; item_id = "item_id"; 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();Coming SoonComing Soon
Checks whether the Cart is empty or not.
Required Parameters
cartId - The cart id to check for empty.
String cartId = "cartId"; Cart cart = cartService.isEmpty(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; cartService.IsEmpty(cartId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; Cart *cart = [cartService isEmpty:cartId]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; Cart cart = cartService.isEmpty(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; Cart cart = cartService.isEmpty(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; Cart cart = cartService.IsEmpty(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $cart = $cartService->isEmpty($cartId); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; cart = cart_service.is_empty(cart_id); /* returns the Cart object. */ puts "cartId is #{cart.cart_id}"; json_response = cart.to_s();Coming SoonComing Soon
Checks out the Cart and put it in CheckOut Stage and returns the Transaction Id The transaction id has to be used in future to update the Payment Status.
Required Parameters
cartID - The cart id that has to be checkedout.
String cartId = "cartId"; Cart cart = cartService.checkOut(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; cartService.CheckOut(cartId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; Cart *cart = [cartService checkOut:cartId]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; Cart cart = cartService.checkOut(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; Cart cart = cartService.checkOut(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; Cart cart = cartService.CheckOut(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $cart = $cartService->checkOut($cartId); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; 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();Coming SoonComing Soon
Update Payment Status of the Cart. When a Cart is checkout, It is in Checkout 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 itemId = "itemId"; Cart cart = cartService.payment(cartId,itemId,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; String itemId = "itemId"; cartService.Payment(cartId,itemId,PaymentStatus.AUTHORIZED,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemId = @"itemId"; Cart *cart = [cartService payment:cartId itemId:itemId paymentStatus:@"AUTHORIZED"]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; String itemId = "itemId"; Cart cart = cartService.payment(cartId,itemId,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; String itemId = "itemId"; Cart cart = cartService.payment(cartId,itemId,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; String itemId = "itemId"; Cart cart = cartService.Payment(cartId,itemId,PaymentStatus.AUTHORIZED); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; String itemId = "itemId"; $cart = $cartService->payment($cartId,$itemId,PaymentStatus::AUTHORIZED); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; transaction_id = "transaction_id"; payment_status = AUTHORIZED; cart = cartService.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();Coming SoonComing Soon
Fetches Payment information for a User. This can be used to display Order and Payment History.
Required Parameters
userName - Name of the for whom payment information has to be fetched
String userName = "Nick"; ArrayList<Cart> cart = cartService.getPaymentsByUser(userName); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();public class Callback : App42Callback { String userName = "Nick"; cartService.GetPaymentsByUser(userName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString(); } }NSString *userName = @"Nick"; NSArray *cart = [cartService getPaymentsByUser:userName]; NSLog(@"cartId is %@" , [[cart objectAtIndex:0] cartId]); NSString *jsonResponse =[[cart objectAtIndex:0] toString];String userName = "Nick"; Vector cart = cartService.getPaymentsByUser(userName); System.out.println("cartId is " + ((Cart)cart.elementAt(0)).getCartId()); String jsonResponse = ((Cart)cart.elementAt(0)).toString();String userName = "Nick"; ArrayList<Cart> cart = cartService.getPaymentsByUser(userName); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();Coming SoonNot AvailableString userName = "Nick"; IList<Cart> cart = cartService.GetPaymentsByUser(userName); Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString();$userName = "Nick"; $cart = $cartService->getPaymentsByUser($userName); print_r("cartId is " . $cart[0]->getCartId()); $jsonResponse = $cart[0]->toString();Coming Soonuser_id = "user_id"; cart_list = Array.new(); cartList = cart.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();Coming SoonComing Soon
Fetches Payment information for the specified Cart Id.
Required Parameters
cartId - Cart Id for which the payment information has to be fetched.
String cartId = "cartId"; Cart cart = cartService.getPaymentByCart(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; cartService.GetPaymentByCart(cartId,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; Cart *cart = [cartService getPaymentByCart:cartId]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; Cart cart = cartService.getPaymentByCart(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; Cart cart = cartService.getPaymentByCart(cartId); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; Cart cart = cartService.GetPaymentByCart(cartId); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $cart = $cartService->getPaymentByCart($cartId); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; cart_list = Array.new(); cart_list = cart.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();Coming SoonComing Soon
Fetches Payment information based on User Id and Status.
Required Parameters
userName - Name of the for whom payment information has to be fetched.
paymentStatus - Status of type which payment information has to be fetched.
String userName = "Nick"; ArrayList<Cart> cart = cartService.getPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();public class Callback : App42Callback { String userName = "Nick"; cartService.GetPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString(); } }NSString *userName = @"Nick"; NSArray *cart = [cartService getPaymentsByUserAndStatus:userName paymentStatus:@"AUTHORIZED"]; NSLog(@"cartId is %@" , [[cart objectAtIndex:0] cartId]); NSString *jsonResponse =[[cart objectAtIndex:0] toString];String userName = "Nick"; Vector cart = cartService.getPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + ((Cart)cart.elementAt(0)).getCartId()); String jsonResponse = ((Cart)cart.elementAt(0)).toString();String userName = "Nick"; ArrayList<Cart> cart = cartService.getPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();Coming SoonNot AvailableString userName = "Nick"; IList<Cart> cart = cartService.GetPaymentsByUserAndStatus(userName,PaymentStatus.AUTHORIZED); Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString();$userName = "Nick"; $cart = $cartService->getPaymentsByUserAndStatus($userName,PaymentStatus::AUTHORIZED); print_r("cartId is " . $cart[0]->getCartId()); $jsonResponse = $cart[0]->toString();Coming Soonuser_id = "user_id"; p_status = App42::Shopping::Payment_status.new(); payment_status = p_status.enum("AUTHORIZED"); cart_list = Array.new(); 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();Coming SoonComing Soon
Fetches Payment information based on Status.
Required Parameters
paymentStatus - Status of type which payment information has to be fetched.
ArrayList<Cart> cart = cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();public class Callback : App42Callback { cartService.GetPaymentsByStatus(PaymentStatus.AUTHORIZED, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString(); } }NSArray *cart = [cartService getPaymentsByStatus:@"AUTHORIZED"]; NSLog(@"cartId is %@" , [[cart objectAtIndex:0] cartId]); NSString *jsonResponse =[[cart objectAtIndex:0] toString];Vector cart = cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED); System.out.println("cartId is " + ((Cart)cart.elementAt(0)).getCartId()); String jsonResponse = ((Cart)cart.elementAt(0)).toString();ArrayList<Cart> cart = cartService.getPaymentsByStatus(PaymentStatus.AUTHORIZED); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();Coming SoonNot AvailableIList<Cart> cart = cartService.GetPaymentsByStatus(PaymentStatus.AUTHORIZED); Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString();$cart = $cartService->getPaymentsByStatus(PaymentStatus::AUTHORIZED); print_r("cartId is " . $cart[0]->getCartId()); $jsonResponse = $cart[0]->toString();Coming Soonp_status = App42::Shopping::Payment_status.new(); Payment_status = p_status.enum("AUTHORIZED"); cart_list = Array.new(); 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();Coming SoonComing Soon
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 for whom payment history has to be fetched
String userName = "Nick"; ArrayList<Cart> cart = cartService.getPaymentHistoryByUser(userName); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();public class Callback : App42Callback { String userName = "Nick"; cartService.GetPaymentHistoryByUser(userName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString(); } }NSString *userName = @"Nick"; NSArray *cart = [cartService getPaymentHistoryByUser:userName]; NSLog(@"cartId is %@" , [[cart objectAtIndex:0] cartId]); NSString *jsonResponse =[[cart objectAtIndex:0] toString];String userName = "Nick"; Vector cart = cartService.getPaymentHistoryByUser(userName); System.out.println("cartId is " + ((Cart)cart.elementAt(0)).getCartId()); String jsonResponse = ((Cart)cart.elementAt(0)).toString();String userName = "Nick"; ArrayList<Cart> cart = cartService.getPaymentHistoryByUser(userName); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();Coming SoonNot AvailableString userName = "Nick"; IList<Cart> cart = cartService.GetPaymentHistoryByUser(userName); Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString();$userName = "Nick"; $cart = $cartService->getPaymentHistoryByUser($userName); print_r("cartId is " . $cart[0]->getCartId()); $jsonResponse = $cart[0]->toString();Coming Soonuser_id = "user_id"; cart_list = Array.new(); 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();Coming SoonComing Soon
History of all carts. It gives all the carts which are in AUTHORIZED, DECLINED, PENDING state.
ArrayList<Cart> cart = cartService.getPaymentHistoryAll(); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();public class Callback : App42Callback { cartService.GetPaymentHistoryAll(userName, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { IList<Cart> cart = (IList<Cart>) response; Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString(); } }NSArray *cart = [cartService getPaymentHistoryAll]; NSLog(@"cartId is %@" , [[cart objectAtIndex:0] cartId]); NSString *jsonResponse =[[cart objectAtIndex:0] toString];Vector cart = cartService.getPaymentHistoryAll(); System.out.println("cartId is " + ((Cart)cart.elementAt(0)).getCartId()); String jsonResponse = ((Cart)cart.elementAt(0)).toString();ArrayList<Cart> cart = cartService.getPaymentHistoryAll(); System.out.println("cartId is " + cart.get(0).getCartId()); String jsonResponse = cart.get(0).toString();Coming SoonNot AvailableIList<Cart> cart = cartService.GetPaymentHistoryAll(); Console.WriteLine("cartId is " + cart[0].GetCartId()); String jsonResponse = cart[0].ToString();$cart = $cartService->getPaymentHistoryAll(); print_r("cartId is " . $cart[0]->getCartId()); $jsonResponse = $cart[0]->toString();Coming Sooncart_list = Array.new(); 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();Coming SoonComing Soon
To increase quantity of existing item in the cart.
Required Parameters
cartID - The cart id for which 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; Cart cart = cartService.increaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; cartService.IncreaseQuantity(cartId,itemID,itemQuantity,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; int itemQuantity = 12; Cart *cart = [cartService increaseQuantity:cartId itemID:itemID itemQuantity:itemQuantity]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.increaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.increaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.IncreaseQuantity(cartId,itemID,itemQuantity); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $itemID = "itemID"; $itemQuantity = 12; $cart = $cartService->increaseQuantity($cartId,$itemID,$itemQuantity); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_iD"; item_id = "item_id"; item_quantity = 5; 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();Coming SoonComing Soon
To decrease 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; Cart cart = cartService.decreaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();public class Callback : App42Callback { String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; cartService.DecreaseQuantity(cartId,itemID,itemQuantity,this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { Cart cart = (Cart) response; Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; int itemQuantity = 12; Cart *cart = [cartService decreaseQuantity:cartId itemID:itemID itemQuantity:itemQuantity]; NSLog(@"cartId is = %@",cart.cartId); NSString *jsonResponse = [cart toString];String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.decreaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();String cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.decreaseQuantity(cartId,itemID,itemQuantity); System.out.println("cartId is " + cart.getCartId()); String jsonResponse = cart.toString();Coming SoonNot AvailableString cartId = "cartId"; String itemID = "itemID"; int itemQuantity = 12; Cart cart = cartService.DecreaseQuantity(cartId,itemID,itemQuantity); Console.WriteLine("cartId is " + cart.GetCartId()); String jsonResponse = cart.ToString();$cartId = "cartId"; $itemID = "itemID"; $itemQuantity = 12; $cart = $cartService->decreaseQuantity($cartId,$itemID,$itemQuantity); print_r("cartId is " . $cart->getCartId()); $jsonResponse = $cart->toString();Coming Sooncart_id = "cart_id"; item_id = "item_id"; item_quantity = 3; 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();Coming SoonComing Soon
Removes 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"; App42Response response = cartService.removeItem(cartId, itemId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String cartId = "cartId"; String itemId = "itemId"; cartService.RemoveItem(cartId,itemId, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response response = (App42Response) response; String jsonResponse = response.ToString(); } }NSString *cartId = @"cartId"; NSString *itemID = @"itemID"; App42Response *response = [cartService removeItem:cartId itemId:itemId]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String cartId = "cartId"; String itemId = "itemId"; App42Response response = cartService.removeItem(cartId, itemId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String cartId = "cartId"; String itemId = "itemId"; App42Response response = cartService.removeItem(cartId, itemId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming SoonNot AvailableString cartId = "cartId"; String itemId = "itemId"; App42Response response = cartService.RemoveItem(cartId, itemId); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$cartId = "cartId"; $itemId = "itemId"; $response = $cartService->removeItem($cartId, $itemId); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing SoonComing SoonComing Soon
Removes all Items from the specified Cart.
Required Parameters
cartId - The cart id from which the item has to be removed.
String cartId = "cartId"; App42Response response = cartService.removeAllItems(cartId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();public class Callback : App42Callback { String cartId = "cartId"; cartService.RemoveAllItems(cartId, this); void App42Callback.OnException(App42Exception exception) { Console.WriteLine("Exception Message"); } void App42Callback.OnSuccess(Object response) { App42Response response = (App42Response) response; String jsonResponse = response.ToString(); } }NSString *cartId = @"cartId"; App42Response *response = [cartService removeAllItems:cartId]; NSString *success = response.isResponseSuccess; NSString *jsonResponse = [response toString];String cartId = "cartId"; App42Response response = cartService.removeAllItems(cartId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();String cartId = "cartId"; App42Response response = cartService.removeAllItems(cartId); boolean success = response.isResponseSuccess(); String jsonResponse = response.toString();Coming SoonNot AvailableString cartId = "cartId"; App42Response response = cartService.RemoveAllItems(cartId); Boolean success = response.IsResponseSuccess(); String jsonResponse = response.ToString();$cartId = "cartId"; $response = $cartService->removeAllItems($cartId); $success = $respons->isResponseSuccess(); $jsonResponse = $respons->toString();Coming SoonComing SoonComing SoonComing Soon
The functions available under Shopping Cart API can throw some exceptions in abnormal conditions. Example of the same has been given below. E.g. If App 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"; 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(); }public class Callback : App42Callback { String cartId = "cartId"; cartService.GetCartDetails(cartId, this); void App42Callback.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(); } void App42Callback.OnSuccess(Object object) { Cart cart = (Cart) object; String jsonResponse = cart.ToString(); } }String cartId = "cartId"; @try { Cart *cart= [cartService getCartDetails:cartId]; } @catch(App42Exception *ex) { 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; }String cartId = "cartId"; 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"; 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(); }Coming SoonNot AvailableString cartId = "cartId"; 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"; 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 SoonComing SoonComing SoonComing Soon
Functions in Cart API might throw exceptions with following HTTP and Application Error Codes (along with their descriptions):
1400 - BAD REQUEST - The Request 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 '@cartRow.state' 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 '@userIdgt;' 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.