I want to send to each customer 10$ discount for 35$+ purchase and 20$ discount for purchase 70$+. This way they will be able to put discount code on their second purchase. If i'll create a discount in advance then I can email to a customer that discount code. That brings two issues:
Best way would be if I could generate discount code for each customer and send it with order confirmation email. How can I create discount codes unique to each customer programmatically (hopefully in template Settings -> Notifications -> Order confirmation ). Your documentation states that it's possible to make 20,000,000 discounts per store (https://help.shopify.com/en/manual/promoting-marketing/discount-codes/create-discount-codes). I'm sure 20,000,000 can't be done manually and there is a way to do it automatically.