WebPOS 3rd Party Integration Tool (W3P)
WebPOS 3rd Party Integration Tool (W3P)
Jan 18, 2019 – major updates to make the tool more SAP friendly
This document will guide third party to connect with WebPOS through WebPOS 3rd Party Integration Tool of W3P.
Key Functions
Master Database
Product Master (Two Way)
Warehouse Master (Two Way)
Account Master (Two Way)
Table of Contents
I. SOAP Technology
Components of W3P
User Credentials
SOAP Interface
II. PULL MASTER DATA
ACTION: GET_ACCOUNT
Synchronization Flow Example
Account Master Synchronization
ACTION: GET_CREDIT
ACTION: GET_OFFICE
ACTION: GET_PRODUCT
ACTION: GET_SERIAL
ACTION: GET_WAREHOUSE
III. SAVE MASTER DATA
ACTION : SAVE_ACCOUNT
fthirdpartyid
Return Values
Account Master Mapping
Formatting Errors
ACTION : SAVE_CREDIT
ACTION : SAVE_OFFICE
ACTION : SAVE_PRODUCT
ACTION : SAVE_SERIAL
ACTION : SAVE_UOM
ACTION : SAVE_WAREHOUSE
IV. Inventory Movements
ACTION: SAVE_STOCK_ADJUSTMENT, SAVE_STOCK_COUNT, SAVE_STOCK_TRANSFER
fdoctype 0 = IN, 1 = OUT ,101 = TRANSFER
Header Mapping
Product Mapping
ACTION: GET_STOCK_ADJUSTMENT, GET_STOCK_COUNT, GET_STOCK_TRANSFER
ACTION: VOID_STOCK_ADJUSTMENT, VOID_STOCK_COUNT, VOID_STOCK_TRANSFER
ACTION: GET_STOCK_STATUS
ACTION: SAVE_STOCK_STATUS
STOCK STATUS SYNCING
V. Sales
ACTION: GET_SALES
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 1
Sales Header Mapping
Sales Product Mapping
Sales Payment Mapping
ACTION: GET_SALES_TRANSACTION
VI. PURCHASING
ACTION: GET_RR
Receiving Report Header Mapping
Receiving Report Product Mapping
ACTION: GET_DELIVERY
Delivery Report Header Mapping
Delivery Report Product Mapping
ACTION: UPDATE_RR
VII. OTHERS
ACTION: REGISTER_WEBHOOK
ACTION: SAVE_LOCAL_KEY
ACTION : GET_LOCAL_KEY
ACTION: POST_LOG
ACTION: BYPASS_RECORD
ACTION: CONCLUDE_RECORD
Mutual Exclusion Control
Maximum Characters
VIII. Activation
I. SOAP Technology
We will use SOAP to communicate.
Components of W3P
W3P will have 2 components:
1st component (W3P-1) will be based in PHP and reside in the same server as WebPOS. This will be SOAP server based extension of WebPOS.
2nd component (W3P-2) will be OS specific to the requirement of the 3rd party system. In case of SAP, this will be VB based in Windows environment.
For other system, this can be PHP based running in linux, etc.
W3P-2 will handle all customization specific to communicate with 3rd party system and relay them through W3P-1 through the standard interface.
WebPOS will be shielded from all of these.
W3P-2 can also be developed by the 3rd party system.
WebPOS
W3P-2 (SAP) W3P-2 (System W3P-2 (System 2) W3P-2 (System 3) W3P-2 (System 4)...
VB, Windows 1)
PHP, Linux
User Credentials
Maintained per company account
Each company can have multiple users. To communicate from different location , we can register several users with same company.
3rd party must request Alliance to register the users before any exchange can take place. In return, they will received an ID (w3p_id ) and
access key (w3p_key) which they need to use in all SOAP communication.
SOAP Interface
We will have single entry point for all SOAP communications -
URL : http://<server>/appserv/app/w3p/W3PSoapServer.php
WSDL : http://<server>/appserv/app/w3p/w3p.wsdl
Function : call
5 - Other Essentials
POST_LOG
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 2
REGISTER_WEBHOOK
SOAP_HEADER
GET_LOCAL_KEY
SAVE_LOCAL_KEY
Example Code:
<?php
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient("http://localhost:8888/appserv/app/w3p/w3p.wsdl",
array("location" => "http://localhost:8888/appserv/app/w3p/W3PSoapServer.php")
$p = "<root>
<id>
<fw3p_id>15082683</fw3p_id>
<fw3p_key>12345</fw3p_key>
</id>
<data>
<filter>
<faccountid>WEBPOS</faccountid>
</filter>
</data>
</root>";
$s = $client->call("GET_ACCOUNT",$p);
echo "RESULT=".$s."\n";
?>
Note
ACTION: GET_ACCOUNT
Parameter
<data>
<filter>
<faccountid>WEBPOS</faccountid>
<fthirdpartyid>WEBPOS</fthirdpartyid>
<fkeyword></fkeyword>
<fcustomer_flag>0</fcustomer_flag>
<fsupplier_flag>0</fsupplier_flag>
</filter>
</data>
To search for single or selected records, you do not need to specify these parameters. Just supply the filter.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 3
Actual Example: Getting Account based on Keyword
$p = "
<root>
<id>
<fw3p_id>15082683</fw3p_id>
<fw3p_key>12345</fw3p_key>
</id>
<data>
<filter>
<fkeyword>WEBPOS</fkeyword>
</filter>
</data>
</root>
";
$s = $client->call("GET_ACCOUNT",$p);
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190118170641</fnew_batchid>
<flast_batchid>
<flast_key>2</flast_key>
<fdone>1</fdone>
<record id="WEBPOS">
<faccountid>WEBPOS</faccountid>
<fthirdpartyid>WEBPOS</fthirdpartyid>
<fname>WEBPOS</fname>
<factive_flag>1</factive_flag>
<fmemo>
<fcustomer_flag>1</fcustomer_flag>
<fsupplier_flag>0</fsupplier_flag>
<fupdated_date>20190114143611</fupdated_date>
<fthirdparty_branchid>1</fthirdparty_branchid>
<frestrict_office_flag>1</frestrict_office_flag>
<fofficeid>MAIN</fofficeid>
</fmemo></record>
</flast_batchid></data>
</root>
soap->call(ACTION,
<root>
<id>
<fw3p_id>
<fw3p_key>
<data>
<flast_batchid> YYYYMMDDHHMMSS
Last successful full synchronization
blank if from scratch
<fnew_batchid> YYYYMMDDHHMMSS
if blank, it represents the first batch of download
Downloads are broken into batches to avoid lumping
everything together
<flast_key> Last record count from last batch
we will resume from flast_key + 1
Return Value
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 4
<return_code>
<messages>
<data>
<fnew_batchid>
<flast_batchid>
<flast_key>
<fdone> 0 : not yet, 1: yes
<record>
<record>
<faccountid>
<fthirdpartyid>
<record>
<record>
...
3rd party system needs to store the data (fnew_batchid, flast_batchid, flast_key) for the next cycle of pull record call.
At this point, 3rd party should store these values since fdone = 1
flast_batchid = fnew_batchid or
flast_batchid = 20170704145000
At this point, 3rd party should store these values since fdone = 1
flast_batchid = fnew_batchid or
flast_batchid = 20170704180000
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 5
Actual Example:
$p = "<root>
<id>
<fw3p_id>15082683</fw3p_id>
<fw3p_key>12345</fw3p_key>
</id>
<data>
<filter>
<fnew_batchid>20170704180000</fnew_batchid>
<flast_batchid>20170704145000</flast_batchid>
<flast_key>100</flast_key>
</filter>
</data>
</root>
";
$s = $client->call("GET_ACCOUNT",$p);
ACTION: GET_CREDIT
Parameter
<data>
<filter>
<fcreditid>WEBPOS</fcreditid>
<fthirdpartyid>WEBPOS</fthirdpartyid>
<fkeyword></fkeyword>
</filter>
</data>
Return Values:
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190118183546</fnew_batchid>
<flast_batchid>
<flast_key>1</flast_key>
<fdone>1</fdone>
<record id="4">
<fcreditid>4</fcreditid>
<fthirdpartyid>4</fthirdpartyid>
<fname>Visa</fname>
<fmemo>VISA</fmemo>
</record>
</flast_batchid></data>
</root>
ACTION: GET_OFFICE
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 6
Parameter
<data>
<filter>
<fofficeid>MAIN</fofficeid>
<fthirdpartyid>MAIN</fthirdpartyid>
<fkeyword></fkeyword>
</filter>
</data>
Return Values:
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190121100248</fnew_batchid>
<flast_batchid></flast_batchid>
<flast_key>2</flast_key>
<fdone>1</fdone>
<record id="MAIN">
<fofficeid>MAIN</fofficeid>
<fthirdpartyid>13</fthirdpartyid>
<fname>Main Branch</fname>
<factive_flag>1</factive_flag>
<fsiteid>MAIN</fsiteid>
<fmemo>Generated by default</fmemo>
<faddress1></faddress1>
<faddress2></faddress2>
<faddress3></faddress3>
<fphone></fphone>
<fupdated_date>20190111152956</fupdated_date>
<fthirdparty_siteid>MAIN</fthirdparty_siteid>
</record>
</data>
</root>
ACTION: GET_PRODUCT
Parameter
<data>
<filter>
<fproductid>01</fproductid>
<fthirdpartyid></fthirdpartyid>
<fkeyword></fkeyword>
<fcompress>1</fcompress>
</filter>
</data>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 7
Return Values:
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190121100931</fnew_batchid>
<flast_batchid/>
<flast_key>2</flast_key>
<fdone>1</fdone>
<record id="0ESPRESSO">
<fproductid>0ESPRESSO</fproductid>
<fthirdpartyid>0ESPRESSO</fthirdpartyid>
<fname>ESPRESSO GROUND</fname>
<factive_flag>1</factive_flag>
<fmemo/>
<fsale_flag>1</fsale_flag>
<fuomid>PCS</fuomid>
<fstnd_cost>1.000000</fstnd_cost>
<fpurchase_uom>GRAM</fpurchase_uom>
<falternate1/>
<flist_price>1.000000</flist_price>
<ftax_type>0</ftax_type>
<fproduct_type>0</fproduct_type>
<fbarcode1/>
<fbarcode2/>
<fbarcode3/>
<fvariationid/>
<fsub_product_flag>0</fsub_product_flag>
<fsingle_lot_flag>0</fsingle_lot_flag>
<fcategory_value1/>
<fcategory_value2/>
<fcategory_value3/>
<fcategory_value4/>
<fcategory_value5/>
<fcategory_value6/>
<fupdated_date>20180830163955</fupdated_date>
</record>
</data>
</root>
ACTION: GET_SERIAL
Parameter
<data>
<filter>
<flotno>J3</flotno>
<fproductid>01</fproductid>
<fthirdparty_productid></fthirdparty_productid>
<fcompress>1</fcompress>
</filter>
</data>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 8
Return Values:
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20200824160638</fnew_batchid>
<flast_batchid/>
<flast_key>2</flast_key>
<fdone>1</fdone>
<record id="J3">
<fproductid>LOT1</fproductid>
<fthirdpartyid>J3</fthirdpartyid>
<flotno>J3</flotno>
<fime1>J31</fime1>
<fime2>J32</fime2>
<fmemo/>
<factive_flag>1</factive_flag>
<fupdated_date>20200824152442</fupdated_date>
<fname>LOT1</fname>
</record>
</data>
</root>
ACTION: GET_UOM
Parameter
<data>
<filter>
<fuomid>PCS</fuomid>
<fthirdpartyid></fthirdpartyid>
<fkeyword></fkeyword>
</filter>
</data>
Return Values:
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190121101103</fnew_batchid>
<flast_batchid/>
<flast_key>2</flast_key>
<fdone>1</fdone>
<record id="PCS">
<fuomid>PCS</fuomid>
<fname>PCS</fname>
<fbase_uom>PCS</fbase_uom>
<fupdated_date>20160916170523</fupdated_date>
<def>
<fuom>PCS</fuom>
<fqty>1.000000</fqty>
</def>
</record>
</data>
</root>
ACTION: GET_WAREHOUSE
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 9
Parameter
<data>
<filter>
<fsiteid>01</fsiteid>
<fthirdpartyid>01</fthirdpartyid>
<fkeyword></fkeyword>
</filter>
</data>
Return Values:
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190121095234</fnew_batchid>
<flast_batchid/>
<flast_key>1</flast_key>
<fdone>1</fdone>
<record id="01">
<fsiteid>01</fsiteid>
<fthirdpartyid>01</fthirdpartyid>
<fname>General Warehouse</fname>
<factive_flag>1</factive_flag>
<fmemo>Ported from SAP</fmemo>
<fupdated_date>20190111121103</fupdated_date>
</record>
</data>
</root>
ACTION : SAVE_ACCOUNT
You use this to save or update accounts – one or multiple records at a time.
Parameters:
fthirdpartyid
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 10
We allow third party to use their ID for product, account and warehouse.
WebPOS will still maintain its own code. If fthirdparty ID is in the same format with WebPOS (ALPHA NUMERIC + -), WebPOS will adopt it.
Either way, we need to supply at least one of the key (ie. faccountid or fthirdpartyid in case of account).
$p = "
<root>
<id>
<fw3p_id>15082683</fw3p_id>
<fw3p_key>12345</fw3p_key>
</id>
<data>
<record>
<fthirdpartyid>ACCOUNT01</fthirdpartyid>
<fname>John Doe</fname>
<fmemo>This a memo.</fmemo>
</record>
</data>
</root>
";
$s = $client->call("SAVE_ACCOUNT",$p);
Return Values
These return codes are applicable to all
error code
100 action not supported
101 ID is invalid
102 database error
103 parameter error (ie. Invalid parameter)
104 operation error
105 no records
106 concurrent user access, busy
<root>
<return_code>0</return_code>
<data>
<record id="AC004554" result="OK">
<fthirdpartyid>Account01</fthirdpartyid>
<fname>John Doe</fname>
<new_fmemo>This a memo.</new_fmemo>
<faccountid>AC004554</faccountid>
<fmemo>This a memo.</fmemo>
<femail>account01@test.com</femail>
<fresult>OK</fresult>
</record>
</data>
</root>
Basically tells you which account has been successfully updated or not.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 11
Account Master Mapping
Column Description
fthirdpartyid up to 64 chars
fname up to 64 chars
femail up to 64 chars
fcustomer_flag 1: yes, 0: no
fsupplier_flag 1: yes, 0: no
if both customer and supplier flags are 0s, then this will automatically make the record inactive.
fupdated_date YYYYMMDDHHMMSS
Formatting Errors
Actual Example:
<root>
<return_code>104</return_code>
<data>
<record id="..." result="ERROR">
...
<fresult>ERROR</fresult>
<errors>
<error>faccountid is not a valid code, must be alphanumeric, consisting of
max 40 chars</error>
</errors>
</record>
</data>
</root>
ACTION : SAVE_CREDIT
Credit Master Mapping
Column Description
fthirdpartyid up to 64 chars
fname up to 64 chars
fupdated_date YYYYMMDDHHMMSS
ACTION : SAVE_OFFICE
Office Master Mapping
Column Description
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 12
fofficeid WebPOS ID, up to 16 chars (ALPHANUMERIC + - only)
fthirdpartyid up to 64 chars
fname up to 64 chars
factive_flag 0 or 1
faddress1 up to 64 chars
faddress2 up to 64 chars
faddress3 up to 64 chars
fphone up to 64 chars
fupdated_date YYYYMMDDHHMMSS
ACTION : SAVE_PRODUCT
Product Master Mapping
Column Description
fname up to 64 chars
factive_flag 0 or 1
fupdated_date YYYYMMDDHHMMSS
ACTION : SAVE_SERIAL
Product Serial Master Mapping
Column Description
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 13
flotno WebPOS ID, up to 32 chars (ALPHANUMERIC + - only)
fmemo Memo
factive_flag 0 or 1
fupdated_date YYYYMMDDHHMMSS
fcreated_date YYYYMMDDHHMMSS
<data>
<record>
<flotno>J4</flotno>
<fthirdpartyid>J4</fthirdpartyid>
<fproductid>LOT1</fproductid>
<fime1>J41</fime1>
<fime2>J42</fime2>
<fmemo/>
<factive_flag>1</factive_flag>
</record>
</data>
ACTION : SAVE_UOM
Unit of Measure Master Mapping
Column Description
fname up to 64 chars
fbase_uom up to 16 chars
fupdated_date YYYYMMDDHHMMSS
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 14
Actual Example: UOM with Details
<data>
<record>
<fuomid>XX3</fuomid>
<fname>test</fname>
<fbase_uom>XX3</fbase_uom>
<def>
<fqty>6</fqty>
<fuom>XX6</fuom>
</def>
<def>
<fqty>4</fqty>
<fuom>XX4</fuom>
</def>
</record>
</data>
ACTION : SAVE_WAREHOUSE
Warehouse Master Mapping
Column Description
fthirdpartyid up to 64 chars
fname up to 64 chars
factive_flag 0 or 1
fupdated_date YYYYMMDDHHMMSS
Parameters
<data>
<record>
<freference_code/>
<fdoctype>0</fdoctype>
<ftrxdate>20190120</ftrxdate>
<fsiteid>MAIN</fsiteid>
<fthirdparty_siteid/>
<fmemo/>
<fcreated_date>20171231000012</fcreated_date>
<product>
<fproductid>000</fproductid>
<fthirdparty_productid/>
<fqty>-2</fqty>
<fuom>PCS</fuom>
<fuomqty>1.000000</fuomqty>
<fextprice>50.000000</fextprice>
</product>
</record>
</data>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 15
fdoctype 0 = IN, 1 = OUT ,101 = TRANSFER
Header Mapping
Column Description
fcreated_date YYYYMMDDHHMSS, very important, must specify this to avoid posting the same document
Others
Product Mapping
Column Description
flotno Lot No
fextprice Cost
Header Section
fposted_date YYYYMMDDHHMMSS
fresult OK or ERROR
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 16
<fresult>ERROR</fresult>
<errors>
<error>Line 1 : fproductid is invalid, must be an active inventory product</error>
</errors>
fseqno Sequence No
Parameters
<data>
<filter>
<fdocument_no></fdocument_no>
<freference_code></freference_code>
<fsiteid></fsiteid>
<fmemo></fmemo>
<fposted_by></fposted_by>
<ffrom>20190101</ffrom>
<fto></fto>
<ftrxtype>1</ftrxtype>
<fdoctype>1</fdoctype>
</filter>
</data>
Applicable Filters : fdocument_no, freference_code, fsiteid, fdst_siteid, fthirdparty_siteid, fthirparty_dst_siteid, fposted_by, ffrom, fto
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 17
Return Data
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>201912</fnew_batchid>
<flast_batchid>20180103140000</flast_batchid>
<flast_key>11</flast_key>
<fdone>0</fdone>
<record>
<fdocument_no>3236</fdocument_no>
<freference_code>FWM01219</freference_code>
<ftrxdate>20190101</ftrxdate>
<fdoctype>1</fdoctype>
<fstatus_flag>POSTED</fstatus_flag>
<fsiteid>MEGAWORLD</fsiteid>
<fthirdparty_siteid>WH000007</fthirdparty_siteid>
<fsite_name>megaworld</fsite_name>
<fmemo>g.uli sa customer kay hupas</fmemo>
<ftotal_cost>-22.020000</ftotal_cost>
<fposted_by>BBFINVENTORYCLERK@GMAIL.COM</fposted_by>
<fposted_date>20190102133742</fposted_date>
<ftrxtype>1</ftrxtype>
<fofficeid>MEGAWORLD</fofficeid>
<fthirdparty_officeid>14</fthirdparty_officeid>
<foffice_name>Megaworld ilo-ilo city</foffice_name>
<fkey>W3P-INV-15082683-100-3236</fkey>
<ftransmitid></ftransmitid>
<product>
<fseqno>1</fseqno>
<fproductid>CHP00008</fproductid>
<fthirdparty_productid>CHP00008</fthirdparty_productid>
<flotno></flotno>
<fqty>1.000000</fqty>
<fuom>PCS</fuom>
<fuomqty>1.000000</fuomqty>
<fextprice>22.020000</fextprice>
<funitprice>22.020000</funitprice>
<fuomid>PCS</fuomid>
<fbase_uom>PCS</fbase_uom>
</product>
</record>
</data>
</root>
Parameters:
<data>
<record>
<fdocument_no>
<freference_code>
</record>
<record> ... </record>
</data>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 18
Either fdocument_no or freference_code must be specified.
Return Values
<data>
<record>
<fdocument_no>33</fdocument_no>
<fresult>ERROR</fresult>
<errors>
<error>No POSTED transaction found with given condition</error>
</errors>
</record>
<record>
<freference_code>GRX125</freference_code>
<fresult>ERROR</fresult>
<errors>
<error>No POSTED transaction found with given condition</error>
</errors>
</record>
</data>
ACTION: GET_STOCK_STATUS
Get the stock status of WebPOS
Parameters
<data>
<filter>
<fproductid/>
<flotno/>
<fsiteid/>
<fthirdparty_productid/>
<fthirdparty_siteid />
</filter>
</data>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 19
Return Values
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190122095307</fnew_batchid>
<flast_batchid></flast_batchid>
<flast_key>10</flast_key>
<fdone>1</fdone>
<record>
<fproductid>0ESPRESSO</fproductid>
<fsiteid>WH01</fsiteid>
<flotno>
<fthirdparty_productid>0ESPRESSO</fthirdparty_productid>
<fthirdparty_siteid>WH01</fthirdparty_siteid>
<fqty>-121880.000000</fqty>
</flotno>
</record>
</data>
</root>
ACTION: SAVE_STOCK_STATUS
Parameters
<data>
<record>
<fthirdparty_productid>0ESPRESSO</fthirdparty_productid>
<fthirdparty_siteid>MAIN</fthirdparty_siteid>
<flotno></flotno>
<fqty>50</fqty>
<fstnd_cost>23.5</fstnd_cost>
</record>
<record>...</record>
</data>
Return Values
<root>
<return_code>0</return_code>
<data>
<record>Main Branch was successfully posted as reference #304</record>
</data>
</root>
The strategy for syncing is to do this in interval. Typically once or twice a day.
Example
8:00am Start syncing
Subsequent sync
Check if flast_key = 0
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 20
Check if flast_batchid is beyond our interval
Otherwise,
We're not done with previous syncing
Continue syncing
if fdone = 1
Save fnew_batchid to flast_batchid, flast_key = 0
We can alternatively save current time stamp to flast_batchid so the next interval will start at the end of current syncing process.
V. Sales
ACTION: GET_SALES
Get the summarized sales for each reading
Parameters
<data>
<filter>
<ftermid>0002</ftermid>
<ffrom>20190106</ffrom>
<fto>20190106</fto>
<fzcounter>504</fzcounter>
<fper_customer_flag>0</fper_customer_flag>
</filter>
</data>
if fper_customer_flag
= 0, we will group the entire sales together, each product will be segregated by warehouse
= 1, we will group the sales by customer, each product will be segregated by warehouse
Return Format
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 21
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190121113643</fnew_batchid>
<flast_batchid></flast_batchid>
<flast_key>2</flast_key>
<fdone>0</fdone>
<record>
<fsale_date>20190106</fsale_date>
<fzcounter>504</fzcounter>
<ftermid>0002</ftermid>
<ffrom_document_no>20667</ffrom_document_no>
<fto_document_no>20701</fto_document_no>
<fupdated_date>20190106200008</fupdated_date>
<sales>
<fsale_date>20190106</fsale_date>
<fthirdparty_branchid>13</fthirdparty_branchid>
<ftotal_discount>75.000000</ftotal_discount>
<fline_discount>0.000000</fline_discount>
<fscdiscount>713.100000</fscdiscount>
<fpwd_discount>0.000000</fpwd_discount>
<fdip_discount>0.000000</fdip_discount>
<fgross>63368.940000</fgross>
<flocal_tax>0.000000</flocal_tax>
<famusement_tax>0.000000</famusement_tax>
<frefund>0.000000</frefund>
<fservice_charge>5744.900000</fservice_charge>
<ftax>5868.410000</ftax>
<ftax_sale>54771.660000</ftax_sale>
<fnotax_sale>0.000000</fnotax_sale>
<fzero_rated_sale>0.000000</fzero_rated_sale>
<fcash>45544.220000</fcash>
<fcharge>0.000000</fcharge>
<fcredit>17824.720000</fcredit>
<fcheck>0.000000</fcheck>
<fothers>0.000000</fothers>
<fevat>427.860000</fevat>
<fvat_exempt>8597.280952</fvat_exempt>
<fewt>0.000000</fewt>
<fcustomer_count>85</fcustomer_count>
<fkey>W3P-SALES-15082683-0002-504</fkey>
<ftransmitid>
<product>
<fproductid>12</fproductid>
<fthirdparty_productid>12</fthirdparty_productid>
<fsiteid>MAIN</fsiteid>
<fthirdparty_siteid>MAIN</fthirdparty_siteid>
<flotno></flotno>
<fqty>1.000000</fqty>
<ftotal_line>132.00</ftotal_line>
<ftax>12.86</ftax>
<fbase_uom>ORDER</fbase_uom>
<fpriceid/>
<fuomid>ORDER</fuomid>
<fentry_type>0</fentry_type>
</product>
<product>...</product>
<payment>
<ftype>CASH</ftype>
<famount>45544.220000</famount>
<finfo1></finfo1>
</payment>
<payment>...</payment>
</sales>
</record>
</data>
</root>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 22
Notes
Column Description
fsale_date YYYYMMDD
fofficeid Branch ID
fevat EVAT
fewt EWT
fupdated_date YYYYMMDDHHMMSS
faccountid Customer ID
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 23
ftransmitid blank or the ID when it was tagged as processed in
SET_TRANSMIT_LOG
Custom Fields
Column Description
fproductid Product ID
fsiteid Warehouse ID
flotno Lot No
fpriceid Price ID
fentry_type 0: regular/others, 1: choice type product, 4: kit components, 9: choices of the choice type product
Column Description
ftype CASH, CREDIT, CHECK, CHARGE, COUPON, EXCESS, OTHERS (all other payment types)
ACTION: GET_SALES_TRANSACTION
Parameters
<data>
<filter>
<ftermid>0002</ftermid>
<ffrom>20190106</ffrom>
<fto>20190106</fto>
<fzcounter>504</fzcounter>
<faccountid></faccountid>
<fthirdparty_accountid></fthirdparty_accountid>
<fdocument_no></fdocument_no>
<fexclude_return>0<
/fexclude_return>
<fexclude_void>1</fexclude_void>
</filter>
</data>
Applicable filter : ftermid, ffrom, fto, fdocument_no, fzcounter, faccountid, fhirdparty_accountid, fexclude_return, fexclude_void
If fexclude_void is set to "1", voided transactions will not be included in the list.
If fexclude_return is set to "1", returned transactions will not be included in the list.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 24
Return Format
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20190121114617</fnew_batchid>
<flast_batchid/>
<flast_key>35</flast_key>
<fdone>1</fdone>
<record>
<fsale_date>20190106</fsale_date>
<fsale_time>1100</fsale_time>
<fzcounter>504</fzcounter>
<ftermid>0002</ftermid>
<fdocument_no>20667</fdocument_no>
<faccountid/>
<faccount_name/>
<fthirdparty_accountid/>
<ftotal_discount>0.000000</ftotal_discount>
<fline_discount>0.000000</fline_discount>
<fscdiscount>0.000000</fscdiscount>
<fpwd_discount>0.000000</fpwd_discount>
<fdip_discount>0.000000</fdip_discount>
<fgross>1056.000000</fgross>
<flocal_tax>0.000000</flocal_tax>
<famusement_tax>0.000000</famusement_tax>
<frefund>0.000000</frefund>
<fservice_charge>96.000000</fservice_charge>
<fsubtotal>960.000000</fsubtotal>
<ftax>102.860000</ftax>
<ftax_sale>960.000000</ftax_sale>
<fnotax_sale>0.000000</fnotax_sale>
<fzero_rated_sale>0.000000</fzero_rated_sale>
<fcash>1056.000000</fcash>
<fcharge>0.000000</fcharge>
<fcredit>0.000000</fcredit>
<fcheck>0.000000</fcheck>
<fothers>0.000000</fothers>
<fevat>0.000000</fevat>
<fvat_exempt>96.000000</fvat_exempt>
<fewt>0.000000</fewt>
<fcustomer_count>1</fcustomer_count>
<fposted_date>20190106113056</fposted_date>
<fupdated_date>20190106200008</fupdated_date>
<fcashierid>CATHERINE</fcashierid>
<product>
<fseqno>1</fseqno>
<fproductid>FRESH2</fproductid>
<fthirdparty_productid>FRESH2</fthirdparty_productid>
<fsiteid>MAIN</fsiteid>
<fthirdparty_siteid>MAIN</fthirdparty_siteid>
<flotno/>
<fqty>1.000000</fqty>
<fuomqty>1.000000</fuomqty>
<ftax>10.714286</ftax>
<fextprice>100.00</fextprice>
<ftotal_discount>0.00</ftotal_discount>
<ftotal_line>100.00</ftotal_line>
<ftax_type>0</ftax_type>
<ftype>0</ftype>
<fdeposit_flag>0</fdeposit_flag>
</product>
<product>...
</product>
<payment>
<fseqno>1</fseqno>
<ftype>CASH</ftype>
<fmemo/>
<famount>1056.000000</famount>
<finfo1/>
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 25
<finfo2/>
<finfo3/>
<ftrxdate/>
</payment>
</record>
</data>
</root>
0 = "Active Deposit"
3 = "Claimed Deposit"
B = "Claim Transaction"
4 = "Claim Transaction (with Deposit)"
2 = "Claim Transaction (without Deposit)"
If empty or not added, will return all rows regardless of the deposit flag.
Notes
fsale_date YYYYMMDD
fsale_time HHMM
fdocument_no Receipt No
faccountid Customer ID
fsubtotal Subtotal
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 26
fcash Total Cash
fevat EVAT
fewt EWT
fposted_date YYYYMMDDHHMMSS
Custom Fields
Column Description
fseqno Sequence No
fsiteid Warehouse ID
fproductid Product ID
flotno Lot No
fqty Qty
Column Description
fseqno Sequence No
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 27
famount Total amount
finfo2
finfo3
VI. PURCHASING
ACTION: GET_RR
Parameters
<data>
<filter>
<fdocument_no>3</fdocument_no>
<fstatus_flag>6</fstatus_flag>
<frrfrom>20180808</frrfrom>
<frrto>20190808</frrto>
<fsource_flag>0</fsource_flag>
<freference_code></freference_code>
<fofficeid>MAIN</fofficeid>
<fsiteid>MAIN</fsiteid>
<fsupplierid>0</fsupplierid>
<fref_siteid></fref_siteid>
<fthirdpartyid>3</fthirdpartyid>
</filter>
</data>
Applicable filters : fdocument_no, fstatus_flag, frrfrom & frrto, fsource_flag, freference_code, fofficeid, fsiteid, fsupplierid, fref_siteid, fthirdpartyid
Return Value
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 28
Return Format
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20201027104004</fnew_batchid>
<flast_batchid/>
<flast_key>1</flast_key>
<fdone>1</fdone>
<record>
<frrid>3</frrid>
<fofficeid>MAIN</fofficeid>
<fthirdpartyid>3</fthirdpartyid>
<ftrxdate>20180808</ftrxdate>
<freference_code/>
<fdocument_no>3</fdocument_no>
<fsiteid>MAIN</fsiteid>
<fref_siteid>SHOST-18011886,RAWR</fref_siteid>
<fsource_flag>0</fsource_flag>
<fsupplierid>0</fsupplierid>
<fsupplier_name>Cashier</fsupplier_name>
<fmemo/>
<fstatus_flag>6</fstatus_flag>
<product>
<fproductid>COKE</fproductid>
<fproduct_name>Coke</fproduct_name>
<fordered_qty>1.000000</fordered_qty>
<fqty>1.000000</fqty>
<fuomid>BOX</fuomid>
<fextprice>10.000000</fextprice>
<funitprice>10.000000</funitprice>
<ftotal_cost>10.000000000000</ftotal_cost>
<fdr_no>0</fdr_no>
<flotno/>
<fexpiry/>
</product>
</record>
</data>
</root>
Column Description
fsiteid Warehouse
(Supplier = 0; Warehouse = 1)
fsupplierid Supplier ID
fmemo Memo
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 29
fstatus_flag Document Status
Column Description
fproductid Product ID
fextprice Cost/Price
ACTION: GET_DELIVERY
Parameters
<data>
<filter>
<fdocument_no></fdocument_no>
<fdrfrom></fdrfrom>
<fdrto></fdrto>
<freference_code></freference_code>
<fofficeid></fofficeid>
<fsiteid></fsiteid>
<fdst_siteid></fdst_siteid>
<fauto_receipt_flag></fauto_receipt_flag>
<fstatus_flag></fstatus_flag>
<ffulfillment_flag></ffulfillment_flag>
<fthirdpartyid></fthirdpartyid>
</filter>
</data>
Applicable filters : fdocument_no, fstatus_flag, frrfrom & frrto, fsource_flag, freference_code, fofficeid, fsiteid, fsupplierid, fref_siteid, fthirdpartyid
Return Value
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 30
Return Format
<root>
<return_code>0</return_code>
<data>
<fnew_batchid>20201027132839</fnew_batchid>
<flast_batchid/>
<flast_key>1</flast_key>
<fdone>1</fdone>
<record>
<fdeliveryid>24</fdeliveryid>
<fofficeid>BR000003</fofficeid>
<ftrxdate>20201026</ftrxdate>
<freference_code>RERER</freference_code>
<fdocument_no>20</fdocument_no>
<fsiteid>MAIN</fsiteid>
<fdst_siteid>WH01</fdst_siteid>
<fauto_receipt_flag>0</fauto_receipt_flag>
<fstatus_flag>6</fstatus_flag>
<ffulfillment_flag>0</ffulfillment_flag>
<fmemo>RERER</fmemo>
<product>
<fproductid>LT</fproductid>
<fproduct_name>LT</fproduct_name>
<fonreplenish_qty>0.000000</fonreplenish_qty>
<fqty>1.000000</fqty>
<fuom>PCS</fuom>
<fextprice>100.000000</fextprice>
<funitprice>100.000000</funitprice>
<ftotal_cost>100.000000000000</ftotal_cost>
<flotno>A</flotno>
<fserved_qty>1.000000</fserved_qty>
</product>
<product>
<fproductid>LT</fproductid>
<fproduct_name>LT</fproduct_name>
<fonreplenish_qty>0.000000</fonreplenish_qty>
<fqty>1.000000</fqty>
<fuom>PCS</fuom>
<fextprice>100.000000</fextprice>
<funitprice>100.000000</funitprice>
<ftotal_cost>100.000000000000</ftotal_cost>
<flotno>B</flotno>
<fserved_qty>0.000000</fserved_qty>
</product>
</record>
</data>
</root>
Column Description
fsiteid Warehouse
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 31
fstatus_flag Supplier ID
fmemo Memo
Column Description
fproductid Product ID
fextprice Cost/Price
ACTION: UPDATE_RR
Allow posted transaction to be voided and pending transactions to be cancelled.
Parameters
<data>
<record>
<fdocument_no>
<freference_code>
<fstatus_flag>
</record>
<record> ... </record>
</data>
Return Value
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 32
Return Format
<data>
<record>
<fdocument_no/>
<freference_code>77786</freference_code>
<fstatus_flag>7</fstatus_flag>
<fresult>ERROR</fresult>
<errors>
<error>fdocument_no is Required</error>
<error>No POSTED/CANCELLED transaction found with given condition</error>
</errors>
</record>
<record>
<fdocument_no>23</fdocument_no>
<freference_code>8871</freference_code>
<fstatus_flag>7</fstatus_flag>
<fresult>ERROR</fresult>
<errors>
<error>No POSTED/CANCELLED transaction found with given condition</error>
</errors>
</record>
</data>
VII. OTHERS
WARNING
We're longer supporting the webhook implementation, instead you can use a much improved SOAP implementation above.
ACTION: REGISTER_WEBHOOK
If the third party wishes to be notified if there are changes in the system, they can register their webhook.
One webhook per user. Multiple webhooks allowed for one company or account.
Parameter
<data>
<fproduct_url>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_product.php</fproduct_url>
<fwarehouse_url>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_warehouse.php<
/fwarehouse_url>
<faccount_url>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_account.php</faccount_url>
<fsales_url>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_sales.php</fsales_url>
<finventory_url>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_inventory.php<
/finventory_url>
<fsync_url>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_sync.php</fsync_url>
</data>
Sales URL = if terminal performs EOD, and uploads the data to server, system will trigger this.
User can either download the sales transaction or sales summary.
Inventory URL = this has very high traffic. Every time there are changes in the inventory (sales or adjustment), it will trigger this. Use this with caution.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 33
Return Values
<root>
<return_code>0</return_code>
<data>
<record>
<fkey>fproduct_url</fkey>
<fvalue>http://127.0.0.1:8888/appserv/app/w3p/sample_webhook/webhook_product.php<
/fvalue>
<fresult>OK</fresult>
</record>
<record> ... </record>
</data>
</root>
ACTION: SAVE_LOCAL_KEY
Allows third party to store small custom data in WebPOS. Usually data relevant to syncing (ie. flast_batchid, flast_key).
Parameters
<data>
<record>
<fkey>PRODUCT-FLAST_BATCHID</fkey>
<fvalue>VALUE 1</fvalue>
</record>
<record> ... </record>
</data>
Column Description
Return Values
<root>
<return_code>0</return_code>
<data>
<record>
<fkey>PRODUCT-FLAST_BATCHID</fkey>
<fvalue>VALUE 1</fvalue>
<fresult>OK</fresult>
</record>
</data>
</root>
ACTION : GET_LOCAL_KEY
Allows user to retrieve the custom data.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 34
Parameters
<data>
<filter>
<fkey>PRODUCT%</fkey>
</filter>
</data>
Return Values
<root>
<return_code>0</return_code>
<data>
<record id="mst_product_tpi_auto_assign">
<fkey>mst_product_tpi_auto_assign</fkey>
<fvalue>1</fvalue>
</record>
<record id="mst_product_tpi_max_len">
<fkey>mst_product_tpi_max_len</fkey>
<fvalue>50</fvalue>
</record>
<record id="mst_product_tpi_prefix">
<fkey>mst_product_tpi_prefix</fkey>
<fvalue>PR</fvalue>
</record>
</data>
</root>
ACTION: POST_LOG
Logs all requests being processed.
Parameters
<data>
<fstatus_flag>ERROR</fstatus_flag>
<frecordid>INVENTORY</frecordid>
<finput_param>The input data you used, must be properly formatted</finput_param>
<foutput_param>The output data you got, must be properly formatted</foutput_param>
</data>
Column Description
frecordid PRODUCT,SALES,INVENTORY,ACCOUNT,WAREHOUSE,WEBHOOK,W3P
<root>
<return_code>0</return_code>
</root>
ACTION: BYPASS_RECORD
Log all exceptions and errors on W3P using bypass record.
For cases when there is a need to block synchronization because of urgent errors.
In order to proceed, users then have to bypass the exceptions.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 35
Parameters
<data>
<frecordid>PRODUCT</frecordid>
<fid>PRODUCT-02</fid>
<finput_param>Product 02, contains illegal characters.</finput_param>
<ferror_msg>Error Outputing Product 01</ferror_msg>
<faction>PRODUCT.PushToSAP</faction>
<fsource>1</fsource>
</data>
Column Description
frecordid PRODUCT,SALES,INVENTORY,ACCOUNT,WAREHOUSE,WEBHOOK,W3P
finput_param blob
faction up to 64 characters
fsource Default is 1.
Return Values
<root>
<return_code>0</return_code>
<data>
<fbypass_flag>0</fbypass_flag>
</data>
</root>
fbypass_flag is initially set to 0. Once bypassed, the record will be deleted from the exception list.
ACTION: CONCLUDE_RECORD
Exceptions can be bypassed through this.
Parameters
<data>
<frecordid>PRODUCT</frecordid>
<fid>PRODUCT-02</fid>
</data>
This operation will permanently delete the exception from the exception lists.
Maximum Characters
To specify the maximum characters of master records for product, account and warehouse, use SAVE_LOCAL_KEY.
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 36
Example:
$p = "
<root>
<id>
<fw3p_id>17021082</fw3p_id>
<fw3p_key>12345678</fw3p_key>
</id>
<data>
<record>
<fkey>MST_ACCOUNT_MAX_LEN</fkey>
<fvalue>14</fvalue>
</record>
<record>
<fkey>MST_PRODUCT_MAX_LEN</fkey>
<fvalue>14</fvalue>
</record>
<record>
<fkey>MST_WAREHOUSE_MAX_LEN</fkey>
<fvalue>14</fvalue>
</record>
</data>
</root>";
$s = $client->call("SAVE_LOCAL_KEY",$p);
VIII. Activation
Activation is done per company.
Column Description
fw3p_id W3P ID, usually use the number component of company ID. (Ex: 18092342)
fw3p_key Key or password. Used together with the w3p ID for authentication.
femail Optional
W3P Activation
[END OF DOCUMENT]
Copyright © 2009-2019 Alliance Software Inc. and Alliance WebPOS. All Rights Reserved. Page 37