If you would like to post an automatic payment within Business Central when the Sales Order is posted, so that the payment is automatically applied to the Invoice without a User required, then you will need to set the Post Payment Appln. On Invoice field on the related "Payment Method".
Highlight the appropriate Payment Method Code for your Payment Provider and click into the Payment Gateway Setting action in the ribbon.
Within the "Payment Gateway Setting" page, mark the Post Payment Appln On Invoice option as 'True'. This is confirming that you want to post the payment and apply it to the invoice automatically.
You'll also need to define what Template and Journal Batch you want Business Central to use to make this posting so populate the Payment Jnl Template Name and Payment Jnl Batch Name fields with the relevant journal details.
Taking the Payment
Create a "Sales Order" and select the Payment Method from above. Complete the Payment Gateway Payment as described previously. Nothing different is required for automatic payment postings.
After the sales order has been posted, the "Payment Gateway Log" will be available from the "Posted Sales Invoice" (or via the Search bar).
If you check the "Customer Ledger Entries", a 'Payment' entry will have been created automatically as well as the 'Invoice' entry.
This therefore eliminates the need for a User to create the entries within the "Cash Receipt Journal" and apply them before posting as this is now automatically processed.