There's a section in /includes/classes/order.php that allows you to insert data such as a product registration key in the customer's order confirmation email:
PHP Code:
$this->notify('NOTIFY_ORDER_DURING_CREATE_ADD_PRODUCTS', $custom_insertable_text);
/* START: ADD MY CUSTOM DETAILS
* 1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc:
* Possible parameters to pass to custom functions at this point:
* Product ID ordered (for this line item): $this->products[$i]['id']
* Quantity ordered (of this line-item): $this->products[$i]['qty']
* Order number: $zf_insert_id
* Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id']
* Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id']
* Attribute Filename: $attributes_values->fields['products_attributes_filename']
*
* 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format:
* $this->products_ordered_attributes .= {INSERT CUSTOM INFORMATION HERE};
*/
$this->products_ordered_attributes .= ''; // $custom_insertable_text;
/* END: ADD MY CUSTOM DETAILS */
If you were to simply make a call to your custom script that returns the serial number, and add that serial number as described, the process is quite simple.
You could pass the customer's email address to the custom script, and allow that script to either generate the serial number or pick an available one from a database of pre-generated-but-unassigned numbers and assign it to that customer all at the same time. Zen Cart would handle passing the info to the customer if you simply supply the key as described in the code comments quoted above.
You could even go so far as to use the notifier/observer infrastructure and not have to touch the existing class file hardly at all.