Cart cancellation

Steps and examples to send cancellations

PHP cancellation

Files location and description

php/luckycart.php : the php library
php/lc_cancel_sample.php : a cancellation sample

Integration steps

1. Library installation

Copy the luckycart.php library on the server to a place that is accessible from the order cancellation page.

2. Library inclusion

Modify the order cancellation page to include the library:

// Include LC library

3. Initialisation of the library and sending cancellation

Always on the order cancellation page, use the cancel() method from LuckyCart Class : 

// Use exception to catch error
try {
  // Create a Lucky Cart object with your key and secret
  $lucky = new LuckyCart('key','secret');

  // Cancels the specified cart
  $cancel_info = $lucky->cancel($cart->id);
catch (LuckyException $e)
  // Do something with the error... retry or log
  // the error message for example... ($e->getMessage())

4. Use response

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

- $cancel_info->id : specified unique cart Id
- $cancel_info->tickets : number of cancelled tickets