Sample code for 30+ languages & platforms
Dart

PayPal PayFlowPro - Send Transaction to Server

See more HTTP Misc Examples

Sends a simple transaction to the Gateway server.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final http = CkHttp();

  // 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

  final req = CkHttpRequest();
  req.httpVerb = 'POST';
  req.path = '/';
  req.contentType = 'application/x-www-form-urlencoded';
  req.addParam('PARTNER', 'PayPal');
  req.addParam('VENDOR', 'zzz');
  req.addParam('USER', 'zzz');
  req.addParam('PWD', 'zzzzz');
  req.addParam('TRXTYPE', 'S');
  req.addParam('AMT', '40');
  req.addParam('CREATESECURETOKEN', 'Y');
  req.addParam('SECURETOKENID', 'XXXEFF0A-XXXX-4585-XXXX-B763B1F1XXXX');

  final resp = CkHttpResponse();
  try {
    http.httpReq('https://pilot-payflowpro.paypal.com', req, resp);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  print('Status code: ${resp.statusCode}');
  print('Response body:');
  print(resp.bodyStr);
}