Send a course receipt when payment settles; don't make its dispatch wait for the learner to receive another login code. TL;DR: SMS OTP delays and failures can come from carrier filtering, sender approval, message formatting, and geographic routing. Diagnose those separately, keep resends bounded, and provide another verification factor. A successful send request alone isn't enough evidence to promise that a learner can sign in.
For an edtech app, the awkward moment is specific: payment has settled, the receipt needs to go out, and the learner wants to open the course. Those are related events with different completion conditions. The receipt belongs to the payment workflow. The login code belongs to authentication.…