Skip to end of metadata
Go to start of metadata

An external system can use the API-method CreateWithdrawalCashOrder to withdraw money from BFS. This article will also show how to work with transfer receivers (found as External Accounts in BFS).

There are two main ways to work with withdrawals, the first is where we want to withdraws money from a customer account to an external account of that customer. This will result in one transaction taking place at our bank for this specific customer. The second alternative is where a transfer for multiple customers should be made to an external account owned by the house. This could occur if we would like to send money to a fund to cover multiple direct customer purchases or if we have another system that works with insurance products and BFS is being used for managing the trading accounts. In this case a transfer would have to occur to another custody account that is not being monitored by BFS.

When using the second alternative there is a setting available on the external account called batch order. By enabling that setting it is now possible to include multiple individual withdrawal orders in a batch withdrawal order to get one transaction done at the bank.

Once the individual withdrawal orders are batched, which can be accomplished manually or through an automated process in BFS, the batch order number can be used on the bank transfer instruction. Once the external system reads the bank instruction and the reference number it can then request the underlying individual orders via the function GetWithdrawalTransferOrders.

If the batch order number is used as an input to GetWithdrawalTransferOrders the method will return an array of each individual withdrawal order that is included in the batch transaction. By using the External Reference on those individual withdrawal orders the external system will get the reference that it used to create those withdrawal orders in the first place.

We are going to use our test customer, John Doe, to send two withdrawal orders using the external account on the house called Fund A in order to simulate a batch transfer to a fund. 

C# - CreateWithdrawalCashOrder
//Create two withdrawals with the WithdrawalCashOrder method
var client = new BFSServiceReference.bfsapiSoapClient();

var credentials = new BFSServiceReference.Credentials()
{
    UserName = bfsusername, //Username of administrative user in your instance of BFS
    Password = bfspassword, //Password of the administrative user in your instance of BFS
};

var response = client.CreateWithdrawalCashOrders(new BFSServiceReference.CreateWithdrawalCashOrderRequest()
{
    Credentials = credentials,

    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS        

    Entities = new[]
    {
        new WithdrawalCashOrder()
        {
            AccountNo = "10011484",
            IsPercent = false,
            Amount = 100,
            CurrencyCode = "SEK",
            ExternalReference = "Test1",
            TransferReceiver = new Guid("026094ef-2da9-4849-9a4c-ab0fe8e53eaf")            
        },
        new WithdrawalCashOrder()
        {
            AccountNo = "10011484",
            IsPercent = false,
            Amount = 110,
            CurrencyCode = "SEK",
            ExternalReference = "Test2",
            TransferReceiver = new Guid("026094ef-2da9-4849-9a4c-ab0fe8e53eaf")
        }
    }

});

foreach (var c in response.Entities)
{
    Console.WriteLine(c.BrickId + ", " + c.AccountNo);
}

The result in the console is the following:

We can see in the GUI that two orders were created for the customer:

By clicking on the information icon we can see that the external account used is the one configured on the house called Fund A.

We now have a choice, either we can process these withdrawals individually or we can create a batch order and process them as one transaction since they are both going to the same external account.

For this example we will create a batch order and associate the withdrawals to this. To create a batch order manually we will do the following:

  1. Navigate to Order Management
  2. Select Cash Orders
  3. Click on the Batch Orders tab

Next we will click on create batch orders in the action menu:

The batch order is now created and appears in the list:

The batch order number 70000076 could now be used with GetWithdrawalTransferOrders to collect the underlying orders.

The next step is to send the instruction to the bank, in this article we will do this manually to change the state of the order to Instructed.

Following this we will enter the execution step where we will enter the settlement date, value date and custody account for the withdrawal.

Looking at the custody account the transactions were made as an aggregate amount, in the same way it was booked in the bank, both in the trade and settlement dimension:

In the customer BFS-account the transactions were booked individually: