Difference between revisions of "C Languages API Documentation"
(→REQUIRED LIBRARIES plus Live Sample and Source Code) |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
Please, review the '''[[Payment_Processing_Developer_Guide|Developer Guide]]''' to determine the best integration approach, before diving into the API Documentation below. | Please, review the '''[[Payment_Processing_Developer_Guide|Developer Guide]]''' to determine the best integration approach, before diving into the API Documentation below. | ||
− | =Live Sample | + | =Online API Documentation= |
+ | ==Cloud9 Payment Gateway Documentation== | ||
+ | → ''' Please, see [http://cloud9paymentgateway.com/docs/API Payment Gateway C-languages Documentation] | ||
+ | |||
+ | ==JSON Sandbox== | ||
+ | → '''Online Documentation:''' [http://apidocs.c9pg.com.com C9 API Documentation & Sandbox] | ||
+ | <br>We recommend that you browse through the API intro below, first. | ||
+ | |||
+ | =REQUIRED LIBRARIES plus Live Sample and Source Code= | ||
+ | Windows Development Environment is contained in the '''[[Windows Integration Samples]]'''<br> | ||
→ '''NOTE:''' It is '''highly recommended''' that you use the live '''[[Windows Integration Samples]]''', which have real time source code windows to help you understand the API. | → '''NOTE:''' It is '''highly recommended''' that you use the live '''[[Windows Integration Samples]]''', which have real time source code windows to help you understand the API. | ||
Line 41: | Line 50: | ||
#'''Un-Initialize'''<br><code>PgcUninit("PgcSample"); // Uninitializing library; called once per application upon exit</code> | #'''Un-Initialize'''<br><code>PgcUninit("PgcSample"); // Uninitializing library; called once per application upon exit</code> | ||
− | |||
=Using API Documentation= | =Using API Documentation= |
Latest revision as of 19:37, 13 August 2020
Cloud9 Payment Gateway Documentation. This site can also be reached at http://docs.cloud9paymentgateway.com
Contents
Step One
Please, review the Developer Guide to determine the best integration approach, before diving into the API Documentation below.
Online API Documentation
Cloud9 Payment Gateway Documentation
→ Please, see Payment Gateway C-languages Documentation
JSON Sandbox
→ Online Documentation: C9 API Documentation & Sandbox
We recommend that you browse through the API intro below, first.
REQUIRED LIBRARIES plus Live Sample and Source Code
Windows Development Environment is contained in the Windows Integration Samples
→ NOTE: It is highly recommended that you use the live Windows Integration Samples, which have real time source code windows to help you understand the API.
Elements
The library has two basic elements:
- Connection
- Client can either connect directly to
a)Cloud9 Server Payment Web Controller (PWC) - this is a good option is local hardware payment terminals are not used
b)Local Payment Device Controller (PDC), which controls the payment terminal. - Payment Processing Transaction Session
- an object that holds description of the transaction and it's result. There is one transaction per session
Connection Types
- Payment Device Controller (PDC) Connection:Connects to the local device driver - wss://localhost:5556/
Advantage: Offline Store & Forward Capability
Disadvantage: Needs local software install - Web Based Payment Device Controller (PWC):Connects directly to the Cloud9 server - https://testlink.c9pg.com:5558/hj
Advantage: No local software required, unlimited cross platform capability
Disadvantage: No Offline Store & Forward Capability
Basic Flow
- Initialize
- Connect
repeat as many times as necessary
- Create New Transaction Session
- Set Transaction Parameters (uses simple Set String and Set Value commands)
- Send Transaction Request
- Get Transaction Response (uses simple Get String and Get Value commands)
- Close the Session
go back to create a new transaction session, if more transactions needed
- Disconnect
Detailed Flow with C Examples
- Initialize the library
PgcInit("PgcSample");
- Connect to the Payment Web Controller (PWC - direct Cloud9 Server connection) or local Payment Device Controller (PDC) Server
- Create Connection Handle
int nConn = PgcNewConn(PGC_SVC_C9PG_PDC, "Name", "Token", PGC_TIMEO_TXN_UI, "PgcSample", ""); //USE PGC_SVC_C9PG_PWE_TEST for PWE
- Open the Connection, specified by Connection Handle
int nErr = PgcConnect(nConn);
- Create Connection Handle
- Create New Transaction Session
int nSess = PgcNewSess(nConn, 1);
- Set Session Parameters
- Set MID/TID/PWD
PgcSetStr(nSess, 0, PGC_GWKEY_GMID, "1001396250"); // Gateway merchant ID
PgcSetStr(nSess, 0, PGC_GWKEY_GTID, "GT1001396253"); // Gateway terminal ID
PgcSetStr(nSess, 0, PGC_GWKEY_GMPW, "123"); // Gateway merchant password - Set Transaction Type
PgcSetStr(nSess, 0, PGC_GWKEY_TXNACT, PGC_GWVAL_TXNACT_AUTH); // Transaction action type -> authorization
- Set Transaction Medium (e.g. Credit Card)
PgcSetStr(nSess, 0, PGC_GWKEY_MDM, PGC_GWVAL_MDM_CREDIT); // Payment medium -> credit card
- Set Transaction Parameters (e.g. Amount, Tax, Trace#)
PgcSetAmt(nSess, 0, PGC_GWKEY_MAINAMT, 123); // Main amount -> $1.23
PgcSetAmt(nSess, 0, PGC_GWKEY_INCTAXAMT, 8); // Included tax amount -> $0.08
PgcSetStr(nSess, 0, PGC_GWKEY_SRCTRACENUM, "123456"); // Source trace number; will be returned for matching
- Set MID/TID/PWD
- Send Transaction Request
int nErr = PgcRequest(nSess);
- Get Transaction Response and Approval Code
PgcGetStr(nSess, 0, PGC_GWKEY_STATUS, sStatus, 256); // Transaction status, indicating if it is successful
...
PgcGetStr(nSess, 0, PGC_GWKEY_RSPCODE, sRspCode, 256); // Response code returned from the host
...
PgcGetStr(nSess, 0, PGC_GWKEY_RSPTEXT, sRspText, 256); // Response text returned from the host
...
PgcGetStr(nSess, 0, PGC_GWKEY_AUTHCODE, sAuthCode, 256); // Auth code - Close the Transaction Session
PgcFreeSess(nSess);
- Disconnect from Server
PgcDisconnect(nConn); // Disconnecting from the controller; will be called automatically upon closing
PgcFreeConn(nConn); // Closing connection to the controller; called once per connection - Un-Initialize
PgcUninit("PgcSample"); // Uninitializing library; called once per application upon exit
Using API Documentation
- There are two main files of interest:
- PgcClient.h
- contains functions
- PgcKey.h
- contains parameter definitions for the key pairs
You can use the File List and File Member functions like so, to get more detail on what is available.
You can also use Search to find a function
This is how you can browse the parameter definitions
Cloud9 Payment Gateway Documentation
→ Please, see Payment Gateway C-languages Documentation
From the makers of Cloud9 Payment Processing Gateway and Creditline Credit Card Processing Software