Never Use Real API Keys
Never use real API Keys when testing. The gateway allows Partners to create Test Merchant Accounts. Testing should always use keys from the Test Accounts and never keys from a Standard Account.
Overview
While our online reporting interface gives merchants quick access to detailed transaction history, some workflows require additional flexibility. For example, a merchant using custom accounting tools may need automated, daily updates on the settlement status of all credit card transactions.
This reference outlines how developers can query our reporting engine directly to retrieve transaction data in a consistent, machine readable format. After retrieval, the data can be parsed and integrated into internal systems, accounting platforms, or other third party applications.
Communication
The Query API uses standard HTTPS communication and accepts requests as URL encoded name–value pairs separated by ampersands.
| URL | Example Post Data |
|---|---|
https://secure.nmi.com/api/query.php | security_key=security_key&transaction_id=123456789 |
Send all requests to the Query API using the POST method. The full list of supported name–value pairs is documented in the Variables section below.
The Query API can be accessed using live credentials or a dedicated test account. If you need test credentials, contact your Merchant Service Provider.
All responses from the Query API are returned in Coordinated Universal Time (UTC).
Example Response
Query with no report_type or report_type "transaction"
<nm_response>
<transaction>
<transaction_id>2612675976</transaction_id>
<partial_payment_id></partial_payment_id>
<partial_payment_balance></partial_payment_balance>
<platform_id></platform_id>
<transaction_type>cc</transaction_type>
<condition>complete</condition>
<order_id>1234567890</order_id>
<authorization_code>123456</authorization_code>
<ponumber></ponumber>
<order_description></order_description>
<first_name>John</first_name>
<last_name>Smith</last_name>
<address_1>123 Main St</address_1>
<address_2>Apt B</address_2>
<company></company>
<city>New York City</city>
<state>NY</state>
<postal_code>10001</postal_code>
<country>US</country>
<email>[email protected]</email>
<phone>1234567890</phone>
<fax></fax>
<cell_phone></cell_phone>
<customertaxid></customertaxid>
<customerid></customerid>
<website></website>
<shipping_first_name></shipping_first_name>
<shipping_last_name></shipping_last_name>
<shipping_address_1></shipping_address_1>
<shipping_address_2></shipping_address_2>
<shipping_company></shipping_company>
<shipping_city></shipping_city>
<shipping_state></shipping_state>
<shipping_postal_code></shipping_postal_code>
<shipping_country></shipping_country>
<shipping_email></shipping_email>
<shipping_carrier></shipping_carrier>
<tracking_number></tracking_number>
<shipping_date></shipping_date>
<shipping>1.00</shipping>
<shipping_phone></shipping_phone>
<cc_number>4xxxxxxxxxxx1111</cc_number>
<cc_hash>f6c609e195d9d4c185dcc8ca662f0180</cc_hash>
<cc_exp>1215</cc_exp>
<cavv></cavv>
<cavv_result></cavv_result>
<xid></xid>
<eci></eci>
<directory_server_id></directory_server_id>
<three_ds_version></three_ds_version>
<avs_response>N</avs_response>
<csc_response>M</csc_response>
<cardholder_auth></cardholder_auth>
<cc_start_date></cc_start_date>
<cc_issue_number></cc_issue_number>
<check_account></check_account>
<check_hash></check_hash>
<check_aba></check_aba>
<check_name></check_name>
<account_holder_type></account_holder_type>
<account_type></account_type>
<sec_code></sec_code>
<drivers_license_number></drivers_license_number>
<drivers_license_state></drivers_license_state>
<drivers_license_dob></drivers_license_dob>
<social_security_number></social_security_number>
<processor_id>processora</processor_id>
<tax>1.00</tax>
<currency>USD</currency>
<surcharge></surcharge>
<convenience_fee></convenience_fee>
<misc_fee></misc_fee>
<misc_fee_name></misc_fee_name>
<cash_discount></cash_discount>
<tip></tip>
<card_balance></card_balance>
<card_available_balance></card_available_balance>
<entry_mode>Keyed</entry_mode>
<cc_bin>411111</cc_bin>
<cc_type>visa</cc_type>
<network_token_used>Y</network_token_used><network_token_cryptogram_created>true</network_token_cryptogram_created>
<network_token_created>true</network_token_created>
<signature_image> iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAACGSURBVDhPlZGBEoAgCEO1//9nG83mxMrr3dkBG0hVW2vFqLX26CYbPIc7ySAVe8LBq5u4elyV4M0NXIoGXYqAw4QqMAwJCRu+Az7HSlvgHtexlFKwGrLjG/h/rESmhrhRnLCKwjiNeLYv5QsXOoNSig8IsNYaZ0tXJoGU9hU1k18XlZLOQHTenf7Icf3BwAAAABJRU5ErkJggg==
</signature_image>
<product>
<sku>RS-100</sku>
<quantity>1.0000</quantity>
<description>Red Shirt</description>
<amount>10.0000</amount>
</product>
<action>
<amount>11.00</amount>
<action_type>sale</action_type>
<date>20150312215205</date>
<success>1</success>
<ip_address>1.1.1.1</ip_address>
<source>virtual_terminal</source>
<api_method></api_method>
<username>demo</username>
<response_text>SUCCESS</response_text>
<batch_id>0</batch_id>
<processor_batch_id></processor_batch_id>
<response_code>100</response_code>
<processor_response_text>NO MATCH</processor_response_text>
<processor_response_code>00</processor_response_code>
<requested_amount>11.00</requested_amount>
<device_license_number></device_license_number>
<device_nickname></device_nickname>
</action>
<action>
<amount>11.00</amount>
<action_type>level3</action_type>
<date>20150312215205</date>
<success>1</success>
<ip_address>1.1.1.1</ip_address>
<source>virtual_terminal</source>
<api_method></api_method>
<username>demo</username>
<response_text></response_text>
<batch_id>0</batch_id>
<processor_batch_id></processor_batch_id>
<response_code>100</response_code>
<processor_response_text></processor_response_text>
<processor_response_code></processor_response_code>
<device_license_number></device_license_number>
<device_nickname></device_nickname>
</action>
<action>
<amount>11.00</amount>
<action_type>settle</action_type>
<date>20150313171503</date>
<success>1</success>
<ip_address></ip_address>
<source>internal</source>
<api_method></api_method>
<username></username>
<response_text>ACCEPTED</response_text>
<batch_id>76158269</batch_id>
<processor_batch_id>782</processor_batch_id>
<response_code>100</response_code>
<processor_response_text></processor_response_text>
<processor_response_code>0000000000021980</processor_response_code>
<device_license_number></device_license_number>
<device_nickname></device_nickname>
</action>
</transaction>
</nm_response>Example Response With Processor Details
Query with report_type "profile" and processor_details "true"
<nm_response>
<protected>false</protected>
<is_gateway>false</is_gateway>
<merchant>
<company>Test Company</company>
<email>[email protected]</email>
<phone>123-456-7890</phone>
<url></url>
<address1>123 Fake St</address1>
<address2></address2>
<city>Beverly Hills</city>
<state>CA</state>
<zip>90210</zip>
<country>US</country>
<timezone>America/New_York (GMT-05:00) Eastern Time (US & Canada)</timezone>
<card_schemes>Visa,Mastercard,American Express,Discover,Diner's Club,JCB,Maestro,Banco Popular,Isracard,Hipercard,Credomatic Card,EBT</card_schemes>
</merchant>
<gateway>
<company>Test Reseller</company>
<url></url>
<email>[email protected]</email>
<phone>123-456-7890</phone>
<primary_color>36175F</primary_color>
<complimentary_color_1>F1577B</complimentary_color_1>
<complimentary_color_2>26CC9D</complimentary_color_2>
</gateway>
<merchant_defined_fields></merchant_defined_fields>
<merchant_favicon>iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAMAAAAKE/YAAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAACfUExURUdwTPX19fX19fb29vn5+fX19fX19fb29vX19fX19fb29vb29v////b29vX19f////n5+fX19fn5+fX19ff39/X19fb29vX19fb29vX19f////X19fX19fb29vX19fb29vX19fX19fb29mRkZBcXF/X19e7u7hsbGx8fH0dHR8rKytjY2IWFhb6+vqysrDk5OTg4OFBQUCgoKCEhISIiIjOJ5RMAAAAjdFJOUwD83x8tUeeStfk9rAbl7w8wzDHsINJ82Y42CcFnf/0/9v4+JiMvSAAAAqRJREFUeNrt3dlSwkAUBNBhkSTsyCqr4lyRffP/v81dS0wmQCnc1u5Hn85DhAxV022MK+1ht+XXk9VATpSgmqz7re6wbY7MVa9zMuw3fKd3dbi41mjKmdNs1A4iX+b6oiD93OXe5LIvauKX9yKXvIQoSsIrxZsvMqIsmYsYct4ThfHyLnOqIipTSUWb0wVRmkI6ypwtitoUsxHma1Gc61B1uiiqUwx5QlIFUZ7Ct//GfEXUp7L7yecJQLyd70GByJfvxlIGA50poT0cOw9IOYGCTny+qfoCE//jnCJAeT/L5JDQubcz7A0Suv962m0IVBov6CYWuvnym4yA5flXnB4auveE7qChO8a0AzR00DYDgcvAdPHQXdPCQ7eQXpY+X5rqeOi6SeKhk6aKh66aiI/pyWy92tpzZrtazybhH9Qm9M+LpdWR5SKMF4aejq2ejKd7oecbqymb+R7o+cjqymgei55urLZspnHosdWXcQx6YTVm4UYvVaKXTvTE6szEhZ4pRc9c6LVS9NqFXilFr1zorVL01oW2WkM00Uei77XGhb7VGqKJJppoookmmmiiiSaaaKKJJloTeqQ1/FmMaKKJJppoookm+qfQd78aookmmmiiiSaaaKKJ/ttonlyIJhrgYEs00UQTTTTR/wPNdw+iMS6cPfy5q32Qlyghr6tCXgyGvIKNedkdslYAs8ABsioDs5QEs/4Fs2hHe6VRJFp1TIBnDjBruiAL0SCr5yBL/iDrFCGLKwErQoeYZayQtbeYBcOQVc6QpdmY9eSQRfCQlfuY4waQMxKYgx2Q0yiYIzSQcz+Yw0qYE1aQY2GYs2yYA3iYU4OYo46Y85mYQ6WYk7Cg47uYM8evg9Iqzo2HDEqDTneDjqS/zdEPzjNHP3DP0T8C4oBc15g2YiAAAAAASUVORK5CYII=</merchant_favicon>
<account_details>
<account_status>active</account_status>
<test_mode_enabled>false</test_mode_enabled>
</account_details>
</nm_response>