Unicode C++
Unicode C++
PayPal PayFlowPro - Send Transaction to Server
See more HTTP Misc Examples
Sends a simple transaction to the Gateway server.Chilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkHttpRequestW.h>
#include <CkHttpResponseW.h>
void ChilkatSample(void)
{
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttpW http;
// Implements the following CURL command:
// curl https://pilot-payflowpro.paypal.com -d PARTNER=PayPal -d VENDOR=zzz -d USER=zzz -d PWD=zzzzz -d TRXTYPE=S -d AMT=40 -d CREATESECURETOKEN=Y -d SECURETOKENID=XXXEFF0A-XXXX-4585-XXXX-B763B1F1XXXX
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
CkHttpRequestW req;
req.put_HttpVerb(L"POST");
req.put_Path(L"/");
req.put_ContentType(L"application/x-www-form-urlencoded");
req.AddParam(L"PARTNER",L"PayPal");
req.AddParam(L"VENDOR",L"zzz");
req.AddParam(L"USER",L"zzz");
req.AddParam(L"PWD",L"zzzzz");
req.AddParam(L"TRXTYPE",L"S");
req.AddParam(L"AMT",L"40");
req.AddParam(L"CREATESECURETOKEN",L"Y");
req.AddParam(L"SECURETOKENID",L"XXXEFF0A-XXXX-4585-XXXX-B763B1F1XXXX");
CkHttpResponseW resp;
success = http.HttpReq(L"https://pilot-payflowpro.paypal.com",req,resp);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
wprintf(L"Status code: %d\n",resp.get_StatusCode());
wprintf(L"Response body:\n");
wprintf(L"%s\n",resp.bodyStr());
}