Cart cancellation

Steps and examples to send cancellations

Java cancellation

Files location and description

java/luckycart.jar: the Java library
java/lc_cancel_sample.jsp: an example of use
java/ the library dependencies
java/ library documentation

Integration steps

1. Library installation

Copy the library luckycart.jar and its its dependencies (contained in, into the lib directory of your web or server application.

Be careful not to duplicate libraries. It is possible that a log4, commons-logging or commons-codec version is already installed on your application server.

2. Library inclusion

Modify the order confirmation page code in order to include the library

// Include LC library
import com.luckycart.client.LuckyCart;
import com.luckycart.client.domain.*;

3. Library initialisation and sending cancellation

Always in the cancellation confirmation page code, use cancel(String cartId) method from LuckyCart class :

// Create a LuckyCart object with your key and secret
LuckyCart luckyCart = LuckyCart.builder().setKey("key").setSecret("secret").createLuckyCart();

// Cancels the specified cart, assuming data from the site are store in a cart object. 
LuckyCartCancelResponse cancelResponse = luckyCart.cancel(cart.getId());

4. Use response

The cancelResponse object can be used as needed and contains the following information :

- cancelResponse.getId() : specified unique cart Id
- cancelResponse.getTickets() : number of cancelled tickets