Credit Auto Apply

Credit Auto Apply

How to set up auto-apply credit to the oldest invoice that is unpaid? When a customer overpaid / bank transaction categorized as a customer payment, that credit should auto apply to the customer's oldest unpaid invoice. Is there any api available to refresh(Bank Feed) manually using API like Refresh Feed available in web panel/app? What is the default refresh feed for ICICI Bank?