Automate PayPal Integration Tasks from PowerShell

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Are you in search of a quick and easy way to access PayPal data from PowerShell? This article demonstrates how to utilize the PayPal Cmdlets for tasks like connecting to PayPal data, automating operations, downloading data, and more.

The CData ADO.NET Provider for PayPal is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to PayPal.

ADO.NET Provider

The ADO.NET Provider provides a SQL interface for PayPal; this tutorial shows how to use the Provider to retrieve PayPal data.

Once you have acquired the necessary connection properties, accessing PayPal data in PowerShell can be enabled in three steps.

The provider surfaces tables from two PayPal APIs. The APIs use different authentication methods.

  • The REST API uses the OAuth standard. To authenticate to the REST API, set the OAuthClientId, OAuthClientSecret, and CallbackURL properties.
  • The Classic API requires Signature API credentials. To authenticate to the Classic API, obtain an API username, password, and signature.

See the "Getting Started" chapter of the help documentation for a guide to obtaining the necessary API credentials.

To select the API you want to work with, you can set the Schema property to REST or SOAP. By default the SOAP schema will be used.

For testing purposes you can set UseSandbox to true and use sandbox credentials.

  1. Load the provider's assembly:

    
    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for PayPal\lib\System.Data.CData.PayPal.dll")
        
  2. Connect to PayPal:

     
    $conn= New-Object System.Data.CData.PayPal.PayPalConnection("Schema=SOAP;Username=sandbox-facilitator_api1.test.com;Password=xyz123;Signature=zx2127;InitiateOAuth=GETANDREFRESH;")
    $conn.Open()
    
  3. Instantiate the PayPalDataAdapter, execute an SQL query, and output the results:

    
    $sql="SELECT Date, GrossAmount from Transactions"
    
    $da= New-Object System.Data.CData.PayPal.PayPalDataAdapter($sql, $conn)
    $dt= New-Object System.Data.DataTable
    $da.Fill($dt)
    
    $dt.Rows | foreach {
    	Write-Host $_.date $_.grossamount
    }
      

Ready to get started?

Download a free trial of the PayPal Data Provider to get started:

 Download Now

Learn more:

PayPal Icon PayPal ADO.NET Provider

Easy-to-use PayPal client enables .NET-based applications to easily consume PayPal Transactions, Orders, Sales, Invoices, etc.