To initiate a scheduled invoice generation, an Autolaunched Flow invoking the Invoice API invocable class should be created where the flow will be called in a Batch Job.
Here are the necessary steps to follow:
Create a new Autolaunched Flow (No Trigger)
sad
Note: This is a test setup on how to set up Invoice API in Schedule Flow
Note: The required batch size would be 60 only to prevent hitting a governor limit.
Set up Flow
Create a Schedule Trigger Flow
Set Schedule
Select Object (ex. Opportunity)
Drag Get Records to the screen and select Gateway Account as Object and map the ID to the Opportunity Gateway Account
· Drag Action to the Screen. Filter by Type and select Apex Action and select Invoice API as Action
· Configure the apex action to pass the following Opportunity’s details to the invocable variables:
· Gateway Account = Opportunity’s Gateway Account (custom field)
· Amount = Opportunity’s Amount
· Currency = Opportunity’s Currency
· Token = Opportunity’s Payment Source (custom field) → Token
· Relate Record To = Opportunity record ID
· Relate Record To - Field = custom lookup field under the Gateway Invoice object that looks up to the Opportunity object
· And Click Done
· And after that, your flow should look like these