Skip to main content

Pay & Collect

Resource location: https://api.<cluster>.twinfield.com/webservices/payandcollect.asmx?wsdl

Read

Use the GetRuns method in order to get information of all payment and direct debit runs within a company. The GetRunInfo method can be used to get more information of a specific payment or direct debit run.

GetRuns

public GetRuns : PayOverview
{
public String Office; // The company from which payment and direct debit runs should be read.
}

GetRunInfo

public GetRunInfo : PayRun
{
String Office; // The company from which the payment and direct debit run should be read.
String PayType; // The code of the payment type.
Int32 RunId; // The unique id of the payment or direct debit run.
}

Create

The create run methods are used to create a pay run. There are three methods available.

Methods:

  • CreateRun : Separate parameters can be supplied in order to create a pay run.
  • CreateRun2 : A CreateRunRequest object is supplied containing the parameters in order to create a pay run.
  • CreateRunAsync : Similar to CreateRun2. This method can be used to create large pay runs and requires calling GetRunInfo method to check the result of the pay run creation.

CreateRun

public MessageOfCreateRunResult : CreateRun
{
String Office; // The office where the payment or direct debit run belongs to.
String payType; // The code of the payment type.
DateTime PayDate; // The pay date of the payment file.
String Period; // The period where the transactions will be booked on.
Method Method; // The summarisation method that should be used for this run.
Boolean DirectRemove; // Determines whether the excluded payments should be available after authorising this run.
String BankCode; // The code of the bank that's associated with this pay run.
String DimensionFrom; // Filter on level 2 dimension.
String DimensionTo; // Filter on level 2 dimension.
DateTime MaxDueDate; // Filter on invoices maximum due date.
String InvoiceNumber; // Filter on invoice number.
String Currency; // Filter on invoice currency.
String CustomSettings[]; // A string array of string arrays with custom pay type settings.
}

public enum Method
{
Detailed, // The invoices will not be summarised.
Summarise, // All invoices will be summarised per dimension/currency, no credit invoices will be selected.
SummariseAndDeduct // All invoices will be selected, including credit invoices, and summarised/deducted per dimension/currency.
}

CreateRun2

public MessageOfCreateRunResult : CreateRun2
{
CreateRunRequest createRunRequest; // An object that contains all data needed to perform a Create Run request.
}

public CreateRunRequest
{
String Office; // The office where the payment or direct debit run belongs to.
String PayType; // The code of the payment type.
DateTime PayDate; // The pay date of the payment file.
String Period; // The period where the transactions will be booked on.
Method Method; // The summarisation method that should be used for this run.
Boolean DirectRemove; // Determines whether the excluded payments should be available after authorising this run.
String BankCode; // The code of the bank that's associated with this pay run.
String DimensionFrom; // Filter on level 2 dimension.
String DimensionTo; // Filter on level 2 dimension.
DateTime MaxDueDate; // Filter on invoices maximum due date.
String InvoiceNumber; // Filter on invoice number.
String Currency; // Filter on invoice currency.
Integer DiscountDaysTolerance; // Number of discount days tolerated by supplier after discount is already expired.
String CustomSettings[]; // A string array of string arrays with custom pay type settings.
}

public enum Method
{
Detailed, // The invoices will not be summarised.
Summarise, // All invoices will be summarised per dimension/currency, no credit invoices will be selected.
SummariseAndDeduct // All invoices will be selected, including credit invoices, and summarised/deducted per dimension/currency.
}

CreateRunAsync

public MessageOfCreateRunResult : CreateRunAsync
{
CreateRunAsyncRequest createRunRequest; // An object that contains all data needed to initiate a Create Run Async request.
}

public CreateRunAsyncRequest
{
String Office; // The office where the payment or direct debit run belongs to.
String PayType; // The code of the payment type.
DateTime PayDate; // The pay date of the payment file.
String Period; // The period where the transactions will be booked on.
Method Method; // The summarisation method that should be used for this run.
Boolean DirectRemove; // Determines whether the excluded payments should be available after authorising this run.
String BankCode; // The code of the bank that's associated with this pay run.
String DimensionFrom; // Filter on level 2 dimension.
String DimensionTo; // Filter on level 2 dimension.
DateTime MaxDueDate; // Filter on invoices maximum due date.
String InvoiceNumber; // Filter on invoice number.
String Currency; // Filter on invoice currency.
Integer DiscountDaysTolerance; // Number of discount days tolerated by supplier after discount is already expired.
String CustomSettings[]; // A string array of string arrays with custom pay type settings.
}

public enum Method
{
Detailed, // The invoices will not be summarised.
Summarise, // All invoices will be summarised per dimension/currency, no credit invoices will be selected.
SummariseAndDeduct // All invoices will be selected, including credit invoices, and summarised/deducted per dimension/currency.
}

Custom settings

FormatSettingValue
SEPANLDDcollectionschemaOnly in case of a direct debit run. Option to collect Core or B2B.
0 = Core
1 = B2B

Modify

Modify is used to exclude dimensions or invoices from the run data, or alter amounts of invoices. We have chosen to use a 'light' summary object, stripped to identifiers and writeable values only, to reduce the data that will be sent over the net.

Conditions:

  • Phase = Select and Status = Done and selected Transactions > 0
  • Phase = Manipulate and Status <> Busy

Modify

public MessageOfModifyResult : Modify
{
String Office; // The office from which the run should be modified.
String payType; // The code of the run that should be modified.
Int32 RunId; // The run Id of the run that should be modified.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
SummarySettings NewSummaries[]; // An array of summaries.
}

public SummarySettings
{
String Relation; // Code of the relation for this summary.
String Currency; // Code of the currency of this summary.
Int32 Id; // Identifier.
Boolean Included; // Can be altered. Include or exclude a summary from this pay run.
DetailSettings Details[]; // An array of details.
}

public DetailSettings
{
Int32 Id; // Identifier.
Decimal Value; // Can be altered. (Unequal to zero, Can not be greater than OriginalValue)
Boolean Included; // Can be altered. Include or exclude a detail from this summary.
Decimal DiscountAmount; // Can be altered. Must be a positive value.
}

Authorise

Authorise is used to freeze the run, after authorisation, no adjustments can be made to the data.

Conditions:

  • Phase <= Manipulate and Status = Done

Authorize

public MessageOfAuthoriseResult : Authorize
{
String Office; // The office from which the run should be authorised.
String payType; // The code of the run that should be authorised.
Int32 RunId; // The run Id of the run that should be authorised.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
}

Post

Methods:

  • Post : Post will post the summarisations to the 'in-transfer' ledger, and match them against the original transactions. If post fails, alterations can be made in Twinfield, and the post process can be started again.
  • PostAsync : Similar to Post. This method can be used to post large pay runs and requires calling GetRunInfo method to check the result of the pay run posting.

Conditions:

  • Phase = Authorise and Status = Done
  • Phase = Post and Status = DoneWithErrors

Post

public MessageOfPostResult : Post
{
String Office; // The office from which the run should be posted.
String payType; // The code of the run that should be posted.
Int32 RunId; // The run Id of the run that should be posted.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
}

PostAsync

public MessageOfPostResult : PostAsync
{
String Office; // The office from which the run should be posted.
String payType; // The code of the run that should be posted.
Int32 RunId; // The run Id of the run that should be posted.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
// Please note that an additional call to GetRunInfo is required to get the actual status.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
// Please note that an additional call to GetRunInfo is required to get the actual status.
}

Create file(s)

This step will export the file from the office in the xml, to the office you are logged on to, which is not by default the office in the xml document. After generating, the code will expand the returned XML with the FileId of the payment file. The webservices will load the file, return the file as an array of byte, and delete the payment file from the file manager.

Conditions:

  • Phase >= Post and < Finalise and Status = Done

With the introduction of SEPA, a limitation is made on the number of transaction per payment file. Based on the bank, at the moment the maximum number of transactions in a payment file is reached a second payment file is created. And so on. Use CreateFile in order to retrieve one payment file. When it's not sure if multiple payment files have been created, use CreateFiles in order to retrieve them.

CreateFile

public MessageOfCreateFileResult : CreateFile
{
String Office; // The office from which the run should be created.
String payType; // The code of the run that should be created.
Int32 RunId; // The run Id of the run that should be created.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
String ExportSettings[] // An array of string arrays with optional exportsettings.
}

CreateFiles

public MessageOfCreateFileResult : CreateFiles
{
String Office; // The office from which the run should be created.
String payType; // The code of the run that should be created.
Int32 RunId; // The run Id of the run that should be created.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
String ExportSettings[] // An array of string arrays with optional exportsettings.
}

Finish

Finishing a run can be used for two different things:

  • Deleting a run, this can only be done if no postings to the 'in-transfer' ledger have taken place yet.
  • Ending a run after generating the payfile. It deletes all payrundata from Twinfield.

Conditions:

  • Phase = Pay and Status = Done
  • Phase < Posting
  • Phase = Posting and Status = Error and no lines have been posted yet

Finish

public MessageOfFinishResult : Finish
{
String Office; // The office from which the run should be finished.
String payRunCode; // The code of the run that should be finished.
Int32 RunId; // The run Id of the run that should be finished.
Int32 Touched; // The number of times the run was changed, retrieved from the last request to this particular run.
DateTime Modified; // The modification date of the run, retrieved from the last request to this particular run.
}