If syspref AutomaticEmailReceipts is on, email receipt is getting sent only if the payment is made in staff interface. The receipt should get sent also if the payment is made via API.