Lua
Lua
PayPal PayFlowPro - Send Transaction to Server
See more HTTP Misc Examples
Sends a simple transaction to the Gateway server.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local http = chilkat.Http.new()
-- 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
local req = chilkat.HttpRequest.new()
req.http_verb = "POST"
req.path = "/"
req.content_type = "application/x-www-form-urlencoded"
req:add_param("PARTNER", "PayPal")
req:add_param("VENDOR", "zzz")
req:add_param("USER", "zzz")
req:add_param("PWD", "zzzzz")
req:add_param("TRXTYPE", "S")
req:add_param("AMT", "40")
req:add_param("CREATESECURETOKEN", "Y")
req:add_param("SECURETOKENID", "XXXEFF0A-XXXX-4585-XXXX-B763B1F1XXXX")
local resp = chilkat.HttpResponse.new()
local success = http:http_req("https://pilot-payflowpro.paypal.com", req, resp)
if not success then
print(http.last_error_text)
return
end
print("Status code: " .. resp.status_code)
print("Response body:")
print(resp.body_str)