In Business Central, search for "Cash Receipt Journal" and select the cash receipts journal that is required.

Select the Actions/Functions/Suggest Pmt. Gateway Payment action. This allows filtering to be the entries for what day/week or a customer order.

You can also filter by entries within the "Payment Gateway Refund Log" here if you're wanting to locate a refund and relate it to an invoice against any payments. 

This action will bring out any known Payment from the Payment Gateway log (or Refund) and create the entry for you, automatically applying the entries to the relevant "Posted Sales Invoice" in Business Central. The tick in Applied Yes/No means the payment successfully matched to one or more invoices. To see what has been applied against, go to the Actions/Functions/Apply Entries action.

 When the system inserts the Journal line it will attempt to find one or more invoices that have been posted from the Order against which the payment was originally taken. This could be multiple invoices. It will match them up and set the Applies to ID for them, ready for posting.

If the system does not find invoices to match against, these can be set manually using the Set Applies to ID action, on the Apply Customer Entries page. This action can be found under the Process action.

 Journal lines for Payments (entries from the "Payment Gateway Log" will show on the journal as Document Type 'Payment', whilst refunds (pulled from the "Payment Gateway Refund Log") will show as a 'Refund' line. 

In order to provide more visibility for the entries, additional fields are displayed on the "Cash Receipt Journal". Each entry line now displays the Payment Method Code as well as the Payment Gateway Amount (the amount that was paid to the Payment Provider inclusive of VAT) and the related Payment Gateway Entry No this relates to. 

For Document Type lines 'refund', the Payment Gateway Refund Entry No is shown as well as the Payment Gateway Refund Amount from the "Payment Gateway Refund Log" (the amount refunded back to the Payment Provider). 

Once the journal is posted, the "Payment Gateway Log" will now display the Cust Ledg Entry No which is the entry for the payment that was just posted in Business Central via the "Cash Receipt Journal". 

Adhoc payments in the Cash Receipt Journal

In the instance of wanting to make an ad-hoc card payment using Payment Gateway to the Payment Provider that does NOT relate to a specific Order/Invoice, you can do this directly from the "Cash Receipt Journal".  

Firstly, create an entry in the journal with Document Type as 'Payment' and specify that this is for Account Type 'Customer'. Select the customer No this relates to. In Amount, add in the value of the payment as a minus value, i..e '-300'. Ensure the Payment Method Code on the line is your Payment Provider. 

In the ribbon within the Home tab, select the Payment Gateway action. 

This will display the "Payment Gateway Payment" screen, exactly as you'd use it from a "Sales Order/Invoice". You would confirm the Cardholder and whether this is a New card or existing within this screen and press Ok once the information is correct. 

Enter the card information or proceed with the payment until it has been a success. This will create a brand new entry in the "Payment Gateway Log" with no Source Subtype or Source No because it has not been done via an existing Sales document. 

Because the "Payment Gateway Log" entry has been created, the journal entry now has the Payment Gateway Entry No linked to the line. 

From the "Cash Receipt Journal" ribbon, you can now use the Apply Entries action in the ribbon to select which Invoices you want the payment to be made against. When the Cash receipt is then posted, the "Customer Ledger Entries" screen is updated with the new payment line and is applied to the invoices you specified. The Customer Ledger Entry no is also available from the "Payment Gateway Log" entry.