DataFlex
DataFlex
PayPal PayFlowPro - Send Transaction to Server
See more HTTP Misc Examples
Sends a simple transaction to the Gateway server.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Variant vReq
Handle hoReq
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
Move False To iSuccess
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// 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
Get Create (RefClass(cComChilkatHttpRequest)) To hoReq
If (Not(IsComObjectCreated(hoReq))) Begin
Send CreateComObject of hoReq
End
Set ComHttpVerb Of hoReq To "POST"
Set ComPath Of hoReq To "/"
Set ComContentType Of hoReq To "application/x-www-form-urlencoded"
Send ComAddParam To hoReq "PARTNER" "PayPal"
Send ComAddParam To hoReq "VENDOR" "zzz"
Send ComAddParam To hoReq "USER" "zzz"
Send ComAddParam To hoReq "PWD" "zzzzz"
Send ComAddParam To hoReq "TRXTYPE" "S"
Send ComAddParam To hoReq "AMT" "40"
Send ComAddParam To hoReq "CREATESECURETOKEN" "Y"
Send ComAddParam To hoReq "SECURETOKENID" "XXXEFF0A-XXXX-4585-XXXX-B763B1F1XXXX"
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoReq to vReq
Get pvComObject of hoResp to vResp
Get ComHttpReq Of hoHttp "https://pilot-payflowpro.paypal.com" vReq vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComStatusCode Of hoResp To iTemp1
Showln "Status code: " iTemp1
Showln "Response body:"
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
End_Procedure