title: Magento: get order id to use in outside application
body: <p>I want to set up an affiliate program for an online store that uses Magento for e-commerce.
  How could I save the order id of a sale to be used to update my affiliate table?</p>
  
  <p>Please do not recommend 'Affiliates for all'. It is about as inflexible as Magento, and the reason that I am going with a custom made solution.
  Any help is appreciated.</p>