The sale is awarded to the affiliate link that was last clicked before the sale occurred. ie: the affiliate who "closed the deal". So if affiliate A sends a customer to buy an ebook, but they don't actually buy, then affiliate B sends the customer there again and they finally purchase the eBook, affiliate B will make the commission.