Ready to get started?

Download a free trial of the Authorize.Net Data Provider to get started:

 Download Now

Learn more:

Authorize.Net Icon Authorize.Net ADO.NET Provider

Easy-to-use Authorize.Net client enables .NET-based applications to easily consume Authorize.NET Transactions, Customers, BatchStatistic, etc.

Automate Authorize.Net Integration Tasks from PowerShell



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

The CData Cmdlets for Authorize.Net are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Authorize.Net.

PowerShell Cmdlets or ADO.NET Provider?

The Cmdlets are not only a PowerShell interface to Authorize.Net, but also an SQL interface; this tutorial shows how to use both to retrieve Authorize.Net data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Authorize.Net. To access Authorize.Net data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Authorize.Net.

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

You can obtain the necessary connection properties on the Security Settings -> General Settings page after logging into your Merchant Account.

  • UseSandbox: The Authorize.Net API to be used to process transactions. If you are using a production account, this property can be left blank. If you are using a developer test account, set this to 'TRUE'.
  • LoginID: The API login Id associated with your payment gateway account. This property is used to authenticate that you are authorized to submit website transactions. Note that this value is not the same as the login Id that you use to log in to the Merchant Interface.
  • TransactionKey: The transaction key associated with your payment gateway account. This property is used to authenticate that you are authorized to submit website transactions.

PowerShell

  1. Install the module:

    Install-Module AuthorizeNetCmdlets
  2. Connect:

    $authorizenet = Connect-AuthNet -LoginId "$LoginId" -TransactionKey "$TransactionKey"
  3. Search for and retrieve data:

    $includestatistics = "True" $settledbatchlist = Select-AuthNet -Connection $authorizenet -Table "SettledBatchList" -Where "IncludeStatistics = `'$IncludeStatistics`'" $settledbatchlist

    You can also use the Invoke-AuthNet cmdlet to execute SQL commands:

    $settledbatchlist = Invoke-AuthNet -Connection $authorizenet -Query 'SELECT * FROM SettledBatchList WHERE IncludeStatistics = @IncludeStatistics' -Params @{'@IncludeStatistics'='True'}

ADO.NET

  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.AuthorizeNet.AuthorizeNetConnection("LoginId=MyLoginId;TransactionKey=MyTransactionKey;") $conn.Open()
  3. Instantiate the AuthorizeNetDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT MarketType, TotalCharge from SettledBatchList" $da= New-Object System.Data.CData.AuthorizeNet.AuthorizeNetDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.markettype $_.totalcharge }