Usually, an invoice for each order is created automatically by AfterPay and any changes, like refunds, are done using the AfterPay backoffice. This way, you only need to send (authorize) the payment requests.
Optionally, you can also use the order maintenance operations to automate the complete payment processing. For example, a cancel can be used if the the complete order is cancelled before capture/invoicing. AfterPay will not send an invoice.