Enterprise Level Payment Processing Gateway

HTML JavaScript Integration

Table of Contents


Our API is JSON based. The HTML JavaScript library gives you an option of AJAX and WebSocket connections. Don’t worry, if you are not familiar with these technologies, just use HTML sample page that we provide and go from there.

HTML JavaScript Sandbox

We like to make it simple.

In this demo, every action shows the corresponding bit of source code.

The sample has adequate functionality for a simple payment operations, but if you wish to dive deeper into the API, please see below.

How Does It Work?

a) Establish a Connection

This is self-explanatory. Connect to the URL of the API server.

let sUrl = 'https://testlink.c9pg.com:11911/restApi'; // test server
nConn = PgcNewConn(sUrl, 'Browser1', '');

b) Create a Session

Session is a wrapper for transactions. You can have a single transaction per Session (default) or many. Session is what gets sent to the API server. 

 nSess = PgcNewSess(nConn, 1);

c)  Set Request Parameters

//Set Merchant Account Info (Merchant ID, Terminal ID, Password)
//This is a test account preconfigured for you
PgcSetStr(nSess, 0, "GMID", '1001396250');
PgcSetStr(nSess, 0, "GTID", 'GT1001396253');
PgcSetStr(nSess, 0, "GMPW", '123');
//Set Operation Type (SALE|REFUND|etc)
PgcSetStr(nSess, 0, "TransType" , "Sale");
//Set Transaction Type (CREDIT CARD)
PgcSetStr(nSess, 0, "Medium", "Credit");
// Set Transaction Info (ACCOUNT_NUM, EXP_DATE, AMOUNT, REF#)
PgcSetStr(nSess, 0, "AccountNum", "4111111111111111");
PgcSetStr(nSess, 0, "ExpDate", "0828");
// etc

d) Send the Session. No need to close it (autoclose is by default)

 let nErr = PgcRequest(nSess, onReply);

e) Read the Response

        let sStatus     = PgcGetStr(nCbkSess, 0, "Status");
       let sRespCode   = PgcGetStr(nCbkSess, 0, "ResponseCode");
       let sRespText   = PgcGetStr(nCbkSess, 0, "ResponseText");
       let sRespTransID = PgcGetStr(nCbkSess, 0, "GTRC"); // Gateway Tracking ID

You can see our full API below if you want to know what other parameters and values are available

Test Account

 You will be using a TSYS test server.  For successful transactions, you will need to use specific test card numbers, amounts, CVV, AVS, etc.

IMPORTANT:  please, see TSYS Test Account for complete information on getting successful authorizations with our test sandbox.  You will receive errors if you use the wrong parameters.

As a quick guide, you can use real card numbers (they will not be charged or used), $1.00 amounts and 999 CVV.



To identify GMID & GTID, look at the bottom of vTerminal screen or use Account Identification Guide.

Contact us to obtain GMPW.

C9 OpenAPI Introduction

We are proud to present to you our C9 API in the OpenAPI format (Swagger). This is a documentation suite combined with a testing sandbox, which allows you to play with live samples while learning how the API works.  Full schema and examples are included.

The following are the, tools that are provided by the OpenAPI Documentation:
  1. Schema, which is just a list of parameter names and their values. You can see those in the sample source code. They have names, such “Sale” or “GMID”, which stands for Gateway Merchant ID
  2. Examples. which show you sample ways of using the Schema
  3. Try It, which is a way to run the JSON payload against the API server

OpenAPI Documentation

Scroll to Top