Q:

Expresso Store Hook store_order_complete_end

I am very new to EE2 and using Expresso Store in one of my websites in EE2 and need to use this hook when the order has completed and payment has been made successfully.  The code I need to call is this: ee()->extensions->call('store_order_complete_end', $order);
What I would like to ask is what do I parse to the $data parameter? 
When this hook runs, I need to call a function that generates a coupon code and add this code to the database, but what is the $order parameter in this piece of code and where exactly in the project would I call this piece of code? 

A:

You might find the EE Extension Development guide useful. 
Basically, you need to create an extension which handles the store_order_complete_end hook.  I'm not sure what you mean by the $data parameter, but the $order parameter is a Store Order model.  You can access attributes on it like this:
$order->id;
$order->billing_address;
$order->order_total;

The attribute names match those found in the checkout tag.