Rust
Rust
PayPal PayFlowPro - Send Transaction to Server
See more HTTP Misc Examples
Sends a simple transaction to the Gateway server.Chilkat Rust Downloads
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let 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
let req = chilkat::HttpRequest::new();
req.set_http_verb("POST");
req.set_path("/");
req.set_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");
let resp = chilkat::HttpResponse::new();
if http.http_req("https://pilot-payflowpro.paypal.com", &req, &resp).is_err() {
println!("{}", http.last_error_text());
return;
}
println!("Status code: {}", resp.status_code());
println!("Response body:");
println!("{}", resp.body_str());