If we would like to post an automatic payment which is applied with the posted sales invoice, then you will need to set the Post Payment Appln. On Invoice field on the related Payment Method.
BC uses the values from the Payment Jnl. Template Name and Payment Jnl. Batch Name for the background posting.
Create a Sales Order and select the Payment Method from above. Complete the Payment Gateway Payment as described previously.
After the sales order has been posted, the Payment Gateway Log will be available from the Posted Sales Invoice.
If you check the Customer Ledger Entries, a Payment entry will have been created automatically as well as the Invoice entry.