Ready to get started?

Learn more about the PayPal PowerShell Cmdlets or download a free trial:

Download Now

PowerShell でPayPal Data データをCSV に落としてみた

標準PowerShell cmdlets を使ってPayPal テーブルにアクセス。

CData Cmdlets Module for PayPal は、直感的なPayPal データ連携を提供する標準cmdlet です。 本記事では、PayPal Cmdlets を使ったサンプルを提供します。

Creating a Connection to Your PayPal Data

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, you will need to set the OAuthClientId, OAuthClientSecret, and CallbackURL properties.
  • The Classic API requires Signature API credentials. To authenticate to the Classic API, you will need to 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.

$conn = Connect-PayPal  -Schema "$Schema" -Username "$Username" -Password "$Password" -Signature "$Signature"

Selecting Data

Follow the steps below to retrieve data from the Transactions table and pipe the result into to a CSV file:

Select-PayPal -Connection $conn -Table Transactions | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myTransactionsData.csv -NoTypeInformation

You will notice that we piped the results from Select-PayPal into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.