E-Commerce Integration - An External Interface to CAS
INTRODUCTION
External Interface to CAS will act as a bridge between CAS and PAYNET customer's (Merchant) ecommerce enable website.
With the help of this interface the following facilities will be provided:
A) Customer will be able to send transaction data generated towards sale at customer website to CAS for data consolidation and reporting purpose.
For every transaction, customer website will send transaction data in appropriate format to CAS, CAS will validate customer, after validation would store transaction data in respective database and will return response to the same to customer.
B) Customer will be able to query Inventory data related to its store.
For every query, customer website will send query data in appropriate format to CAS, CAS will validate customer, will perform operation on query and would return inventory data to customer.
HOW DOES INTEGRATION WORKS?
When integrating with CAS, the data will flow in the following way:
- The Customer's server initiates a secure connection to the CAS External Interface and then initiates an HTTPS POST of transaction data to the CAS.
- The CAS External Interface receives and processes the transaction/query data.
- The CAS External Interface then generates and submits the transaction/query response to the Customer's server.
- The Customer's server receives and processes the transaction/query response.
- In case of transaction data response a transaction number would be returned which is KEY to match transactions at CAS.
WHAT IS REQUIRED FOR INTEGRATION?
Customer should be able to perform the following functions in order to submit transaction/query data to CAS using CAS External Interface:
- Have POSID, LOGIN NAME and PASSWORD with CAS.
- Have a secure socket layer (SSL) digital certificate.
- Provide both server and client side encryption.
- Develop scripts on a WEB SERVER for the integration to the CAS External Interface (e.g. for submitting transaction/query data and receiving CAS responses).
INTEGRATION IMPLEMENATION
To implement CAS External Interface Integration, a developer would design a script that can do the following:
- Securely obtain all the information needed to process a transaction/query.
- Initiate a secure HTTPS POST from customer server to
*https://208.109.125.31:8443/CAS/ExternalInterface*
- Receive the response from the CAS External Interface and process the response to display the appropriate result to the end user.
Minimum Requirement for INTEGRATION
All communication between CAS External Interface and customer website will be done using XML only. The following table contains the minimum set of NAME/VALUE pair that must be submitted to the CAS External Interface during Integration:
Node Name |
Node Value |
Required |
Value |
Notes |
UNAME |
User Name |
Yes |
Valid Username on CAS |
|
PASS |
Password |
Yes |
|
|
MID |
Merchant ID |
Yes |
Valid Merchant ID |
|
ACTION |
Action to be taken |
Yes |
StoreTransactionData |
To Send Transaction Data to CAS for processing |
|
|
|
GetInventoryData |
To get inventory Data from CAS |
More information related to two actions, are defined in next few pages.
ACTION - StoreTransactionData
This action would be used when there is need to send transaction data from customer website to CAS for storage purpose. When the XML Request for this action would be created at the customer website, it should contain the following information in addition to minimum requirement mentioned earlier:
Node Name |
Node Value |
Required |
Value |
Notes |
POSID |
POS ID |
Yes |
Valid POS ID on CAS |
|
DATA |
|
Yes |
|
This node will contain sub nodes for transaction data |
TRANSACTION |
|
Yes |
|
This child-node will contain transaction level information |
TransactionType |
|
Yes |
1 – Sales |
|
Date |
|
Yes |
|
Transaction Date |
Remarks |
|
Optional |
|
|
CustomerID |
|
Optional |
|
Customer ID |
EmployeeID |
|
Yes |
Valid Employee ID on CAS |
|
PayModeID |
|
Yes |
1 – Cash |
|
TaxID |
|
Optional |
If entererd, valid TaxID on CAS |
|
TotalTax |
|
Yes |
|
Total Tax Collected |
TotalDiscount |
|
Yes |
|
Total Discount Given |
TotalAmount |
|
Yes |
|
Total Transaction Amount |
DiscountReasonID |
|
Optional |
If entered, valid ID on CAS |
Discount Reason ID |
CouponDiscount |
|
Optional |
|
Transaction Level Coupon Discount Given |
RefundReasonID |
|
Yes |
0 – Sales |
|
ITEMS |
|
Yes |
|
This child-node will contain item level information |
ID |
|
Yes |
Valid ItemID on CAS |
Item ID |
Quantity |
|
Yes |
|
Quantity Sold |
Rate |
|
Yes |
|
Rate on which Sold |
DiscountID |
|
Optional |
If entered, valid DiscountID on CAS |
|
TaxID |
|
Optional |
If entererd, valid TaxID on CAS |
|
Remarks |
|
Optional |
|
Optional Remarks |
Discount |
|
Optional |
|
Discount Given on Item |
Tax |
|
Optional |
|
Tax collected on Item |
ItemSrl |
|
Yes |
|
Serial Number for Items |
CoupanID |
|
Optional |
If entered, valid CoupanID on CAS |
Item Level Coupon |
CoupanAmt |
|
Optional |
|
Item Level Coupon Amount |
PAYMENT |
|
Yes |
|
This s-node will contains payment information |
PaymodeID |
|
Yes |
1 – Cash |
|
Amount |
|
Yes |
|
Amount Received for PaymodeID |
PROCESSOR |
Type of Payment Processor |
Yes |
PCCHARGE – For PCCharge Gateway |
Payment Processor Used for Processing Card Transactions |
CTRANSACTION |
|
Optional |
|
Only when PROCESSOR is not NONE |
cardtype |
|
Yes |
|
Type of Card |
Amount |
|
Yes |
|
Amount Transacted |
troutd |
|
Yes |
|
Transaction Number (from Authorize.NET) |
Result |
|
Yes |
|
Result (from Authorize.NET) |
AuthCode |
|
Yes |
|
from Authorize.NET |
AvsCode |
|
Optional |
|
from Authorize.NET |
CvsCode |
|
Optional |
|
from Authorize.NET |
TransactionKey |
|
Yes |
|
from Authorize.NET |
ReferenceNumber |
|
Yes |
|
from Authorize.NET |
After submission of XML Request to External Interface, it will return a XML containing response to the request submitted to it. The response will have following information:
Node Name |
Node Value |
Required |
Value |
Notes |
STATUS |
Status of Transaction |
Yes |
1 – For Success |
|
TRANSNUMBER |
|
Yes |
|
This will contain valid transaction number for submitted transaction on SUCCESS else blank |
ERRORCODE |
|
Yes |
|
This will contain error code generated on Interface |
ERRORDESC |
|
Yes |
|
This will contains error message generate on Interface |
Sample Request and Response XML are for StoreTransactionData can be found in Appendix – A of this document.
ACTION - GetInventoryData
This action would be used when there is need to query about inventory item / stock status from customer website to CAS. When the XML Request for this action would be created at the customer website, it should contain the following information in addition to minimum requirement mentioned earlier:
Node Name |
Node Value |
Required |
Value |
Notes |
POSID |
POS ID |
Yes |
Valid POS ID on CAS |
|
QUERYTYPE |
|
Yes |
ITEM – For Item |
This node will contain info towards what kind of query it is. |
ITEM |
|
Yes |
|
This child-node will contain Item ID or Item SKU |
After submission of XML Request to External Interface, it will return a XML containing response to the request submitted to it. The response will have following information:
Node Name |
Node Value |
Required |
Value |
Notes |
STATUS |
Status of Transaction |
Yes |
1 – For Success |
|
ERRORCODE |
|
Yes |
|
This will contain error code generated on Interface |
ERRORDESC |
|
Yes |
|
This will contains error message generate on Interface |
ID |
|
Yes |
|
Item ID |
NAME |
|
Yes |
|
Name of Item |
UPC |
|
Yes |
|
UPC of Item |
COSTP |
|
When QUERYTYPE=ITEM |
|
Item Cost |
SELLP |
|
When QUERYTYPE=ITEM |
|
Item Selling Price |
DEPT |
|
When QUERYTYPE=ITEM |
|
Department of Item |
CAT |
|
When QUERYTYPE=ITEM |
|
Item Category |
SUBCAT |
|
When QUERYTYPE=ITEM |
|
Item SubCategory |
DISCOUNT |
|
When QUERYTYPE=ITEM |
|
Discount ID |
ROYALTY |
|
When QUERYTYPE=ITEM |
|
Royalty Level |
INSTOCK |
|
When QUERYTYPE=STOCK |
|
|
Sample Request and Response XML are for GetInventoryData can be found in Appendix – B of this document.
APPENDIX – A
Sample XML Request for StoreTransactionData action:
<PAYNETTRANS>
<REQUEST>
<AUTH>
<UNAME>Demo</UNAME>
<PASS>Demo</PASS>
<MID>4</MID>
</AUTH>
<ACTION>StoreTransactionData</ACTION>
<PARAMS>
<POSID>A12323</POSID>
<DATA>
<TRANSACTION>
<TransactionType>1</TransactionType>
<Date>MM-DD-YYYY HH:MM:SS</Date>
<Remarks>Sample Remarks</Remarks>
<CustomerID></CustomerID >
<EmployeeID>12345</EmployeeID>
<PayModeID>1</PayModeID>
<TaxID>2</TaxID>
<TotalTax>1.34</TotalTax>
<TotalDiscount>15.34</TotalDiscount>
<TotalAmount>35.66</TotalAmount>
<AmountPaid>36.00</AmountPaid>
<DiscountReasonID>1</DiscountReasonID>
<CouponDiscount>1</CouponDiscount>
<RefundReasonID>0</RefundReasonID>
</TRANSACTION>
<ITEMLIST>
<ITEM>
<ID>123456789012</ID>
<Quantity>2</Quantity>
<Rate>12.34</Rate>
<DiscountID>1</DiscountID>
<TaxID>1</TaxID>
<Remarks>Sample Sales</Remarks>
<Discount>15.34</Discount>
<Tax>1.34</Tax>
<ItemSrl>1</ItemSrl>
<CoupanID></CoupanID>
<CoupanAmt></CoupanAmt>
</ITEM>
</ITEMLIST>
<PAYMENTLIST>
<PAYMENT>
<PaymodeID>1</PaymodeID>
<Amount>6.00</Amount>
</PAYMENT>
<PAYMENT>
<PaymodeID>2</PaymodeID>
<Amount>30.00</Amount>
</PAYMENT>
</PAYMENTLIST>
<PROCESSOR>AUTHNET</PROCESSOR>
<CTRANSACTIONLIST>
<CTRANSACTIONLIST>
<cardtype>MC</cardtype>
<Amount>30.00</Amount>
<troutd>1565494682</troutd>
<Result>1</Result>
<AuthCode>024487</AuthCode>
<AvsCode></AvsCode>
<CvsCode></CvsCode>
<TransactionKey>C6E55862</TransactionKey>
<ReferenceNumber>156549</ReferenceNumber>
</CTRANSACTIONLIST> </CTRANSACTIONLIST>
</DATA>
</PARAMS>
</REQUEST>
</PAYNETTRANS>
Sample XML Response for StoreTransactionData action:
<PAYNETTRANS>
<RESPONSE>
<ACTION>StoreTransactionData</ACTION>
<STATUS>1</STATUS>
<TRANSNUMBER>2007/1/1245/343</TRANSNUMBER>
<ERROR>
<ERRORCODE></ERRORCODE>
<ERRORDESC></ERRORDESC>
</ERROR>
</RESPONSE>
</PAYNETTRANS>
Sample XML Error Response for StoreTransactionData action:
<PAYNETTRANS>
<RESPONSE>
<ACTION>StoreTransactionData</ACTION>
<STATUS>0</STATUS>
<TRANSNUMBER></TRANSNUMBER>
<ERROR>
<ERRORCODE>2</ERRORCODE>
<ERRORDESC>Invalid Item</ERRORDESC>
</ERROR>
</RESPONSE>
</PAYNETTRANS>
APPENDIX – B
Sample XML Request for GetInventoryData action for Item:
<PAYNETTRANS>
<REQUEST>
<AUTH>
<UNAME>Demo</UNAME>
<PASS>Demo</PASS>
<MID>4</MID>
</AUTH>
<ACTION>GetInventoryData</ACTION>
<PARAMS>
<POSID>A12323</POSID>
<QUERYTYPE>ITEM</QUERYTYPE>
<ITEM>123456789012</POSID>
</PARAMS>
</REQUEST>
</PAYNETTRANS>
Sample XML Response for GetInventoryData action for Item:
<PAYNETTRANS>
<RESPONSE>
<ACTION>GetInventoryData</ACTION>
<STATUS>1</STATUS>
<ERROR>
<ERRORCODE></ERRORCODE>
<ERRORDESC></ERRORDESC>
</ERROR>
<ITEMDATA>
<ID>123456789012</ID>
<NAME>Sample Test Item</NAME>
<UPC>123456789012</UPC>
<COSTP>1.04</COSTP>
<SELLP>3.56</SELLP>
<DEPT>1</DEPT>
<CAT>2</CAT>
<SUBCAT>1</SUBCAT>
<DISCOUNT>NONE</DISCOUNT>
<ROYALTY>NONE</ROYALTY>
</ITEMDATA>
</RESPONSE>
</PAYNETTRANS>
Sample XML Request for GetInventoryData action for Stock:
<PAYNETTRANS>
<REQUEST>
<AUTH>
<UNAME>Demo</UNAME>
<PASS>Demo</PASS>
<MID>4</MID>
</AUTH>
<ACTION>GetInventoryData</ACTION>
<PARAMS>
<POSID>A12323</POSID>
<QUERYTYPE>STOCK</QUERYTYPE>
<ITEM>123456789012</POSID>
</PARAMS>
</REQUEST>
</PAYNETTRANS>
Sample XML Response for GetInventoryData action for Stock:
<PAYNETTRANS>
<RESPONSE>
<ACTION>GetInventoryData</ACTION>
<STATUS>1</STATUS>
<ERROR>
<ERRORCODE></ERRORCODE>
<ERRORDESC></ERRORDESC>
</ERROR>
<ITEMDATA>
<ID>123456789012</ID>
<NAME>Sample Test Item</NAME>
<UPC>123456789012</UPC>
<INSTOCK>54</INSTOCK>
</ITEMDATA>
</RESPONSE>
</PAYNETTRANS>
Sample XML Error Response for GetInventoryData action:
<PAYNETTRANS>
<RESPONSE>
<ACTION>GetInventoryData</ACTION>
<STATUS>0</STATUS>
<ERROR>
<ERRORCODE>1</ERRORCODE>
<ERRORDESC>Item Not Found</ERRORDESC>
</ERROR>
</RESPONSE>
</PAYNETTRANS>