13.01.2013 Views

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

Connecting to PaymentTrust's Secure Transaction Network - WorldPay

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C++ code sample<br />

Communication with STLink can be performed via VC’s WinInet Internet classes –<br />

CInternetSession, CHttpConnection, and CHttpFile.<br />

The following code fragment illustrates sending of HTTPS and HTTP data <strong>to</strong> STLink.<br />

// Create the Internet objects<br />

CInternetSession session;<br />

CHttpConnection *pConnection = NULL;<br />

CHttpFile *pFile = NULL;<br />

CString URL =<br />

“https://www.paymenttrust.ca/stlinkssl/test/stlink.dll?StringIn=VersionUsed^3~MerchantId^100000<br />

~UserName^Mariah~UserPassword^rr87uy~<strong>Transaction</strong>Type^RG~IsTest^1~TimeOut^60000~M<br />

OP^CC~AcctName^John<br />

Smith~AcctNumber^4459510002561039~ExpDate^092010~CurrencyId^840~Amount^56.78~Firs<br />

tName^John~LastName^Smith~Address1^2130 Gold~City^New<br />

York~CountryCode^US~PhoneNumber^6188565656~REMOTE_ADDR^205.188.146.23“;<br />

CString POSTstring =<br />

"https://www.paymenttrust.ca/stlinkssl/test/stlink.dll?StringIn=VersionUsed^3~MerchantId^100000<br />

~UserName^Mariah~UserPassword^rr87uy~<strong>Transaction</strong>Type^RG~IsTest^1~TimeOut^60000~M<br />

OP^CC~AcctName^John<br />

Smith~AcctNumber^4459510002561039~ExpDate^092010~CurrencyId^840~Amount^56.78~Firs<br />

tName^John~LastName^Smith~Address1^2130 Gold~City^New<br />

York~CountryCode^US~PhoneNumber^6188565656~REMOTE_ADDR^205.188.146.23";<br />

int status, x;<br />

UINT numbytes=0;<br />

char buffer[10000], *temp;<br />

CString outstring, server, object, inbox_buffer;<br />

DWORD service_type;<br />

INTERNET_PORT url_port;<br />

// get the URL and parse it<br />

AfxParseURL(URL, service_type, server, object, url_port);<br />

outstring = object;<br />

// GET Request<br />

try<br />

{<br />

265

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!