When to ask for login?

I currently own an online store for video games and I use the Stripe API. This is the current order of events: Add to cart > Checkout > Enter Card Info > Charge > Download Item, although to battle piracy I recently installed a login page into the games to detect whether the user has bought them. Because of this I need to get users buying the game to login, but due to limitations in my installation Stripe, I can't put the login between the checkout and enter card info or before checkout. I was wondering, in terms of UX, which other place would be the best.