Requisition :

  • Optimum database code (provided by QNE)

  • Optimum Login user name and password (provided by registered company)

  • Database is upgraded to the latest

  • Access Optimum APIV2 UI via https://dev-api.qne.cloud

     

    Integration Steps:

    Step1: Configure posting accounts for different payment method

    Step2: Post cash sales transaction with details to Optimum via API

     


    Step1: Configure posting accounts for different payment method

    The most commonly used payment methods are cash, debit card, credit card.
    Before we can post the transaction, we need to know what account code to use for each payment method. To find out what are the account codes, follow these steps:


  • Login to optimum from this URL https://www.qne.cloud/

  • In our example, we will use the Testing database

    • Database code : TEST

    • Username : Admin

    • Password : <leave it empty>
  •  Navigate to Chart of Accounts > Current Assets > CASH / BANK ACCOUNT
  • * Note: Different database may have different account name and account code

In this example, our cash account code is 700-0400Maybank account code 700-0310assume credit card payment will be received with Public Bank Berhad 700-0320. Save these account codes into your database for later use. We will need to use these settings when generate the multi-payment transactions.

 

* You may want to provide an interface for your system user to fill up this account code and store it in your system. Example : Create a form for your end-users to fill up the account codes.

 

Step2: Post cash sales transaction with details to Optimum via API

Our API is using RETful design, you will need to issue a HTTP request to the target server with json format body. For C# programmer, you can use a third party library “RestSharp” to issue HTTP request.

Endpoint: POST https://dev-api.qne.cloud/api/CashSales

 

Transaction Example:

Walk-in customer purchased 2 unit(s) of product “ITEM-001”, unit price is RM100, total amount is RM200. Received the following payment amount from customer: Cash RM100, debit card paid RM50, credit card paid RM50.

 

C# Code Example:

var client = new RestClient("https://dev-api.qne.cloud");

           var request = new RestRequest("api/CashSales");

           request.AddHeader("DbCode", "TEST");

           var body = @"{

cashSalesDate: '2018-08-24',

currency: 'RM',

useMultiPayment: true,

multiPayments: [

   {

     depositTo: '700-0400',

     description: 'PAYMENT BY CASH',

     amount: 50

   },

   {

     depositTo: '700-0310',

     description: 'PAYMENT BY DEBIT CARD',

     amount: 50

   },

            {

     depositTo: '700-0320',

     description: 'PAYMENT BY CREDIT CARD',

     amount: 100

   }

],

details: [

   {     

     stock: 'ITEM-001',

     description: 'ITEM 001',

     qty: 2,

     uom: 'UNIT(S)',

     unitPrice: 100,

     taxCode: null

   }

]

}";

           request.AddParameter("application/json", body, ParameterType.RequestBody);

           var resp = client.Post(request);

 

 

* Note : UseMultipayment field is required to set it to “true” for multi-payment transactions. The default value is false.

Verify Your result

 

Login to https://www.qne.cloud , you should be able to see the following transaction

 

  • Cash Sales Header

  • Details item

  • Multi-Payments item

 

  • Cash Sales Posting item

You can download the above document from attachment.