Sample code for 30+ languages & platforms
React Native

PayPal PayFlowPro - Send Transaction to Server

See more HTTP Misc Examples

Sends a simple transaction to the Gateway server.

Chilkat React Native Downloads

React Native
import { Http, HttpRequest, HttpResponse } from '@chilkat/react-native'

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

  const http = new 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

  const req = new HttpRequest();
  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');

  const resp = new HttpResponse();
  try {
    await http.httpReqAsync('https://pilot-payflowpro.paypal.com', req, resp);
  } catch {
    console.log(http.lastErrorText);
    return;
  }

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