
It's similar to the manual Batch Upload tool available within the online administration system, but instead of requiring a user to upload and download the batch files using a browser, Direct Mode Batch allows merchant-side software to control the batch processing.
A transaction is initiated by sending an HTTP POST to our host. The host will respond momentarily with the request result on the same socket. All data files are CSV encoded, e.g. data fields are double-quote enclosed and comma separated. Each record (line) is separated by new-line "\n" or carriage-return and new-line "\r\n". If a field needs to contain a double-quote character, it should be doubled. For example, Joe "Jr" Jones would be encoded as "Joe ""Jr"" Jones". Most spreadsheet software can export to CSV format.
Commands and Status messages are URL encoded.
Batch mode is asynchronous, meaning that clients have to poll the system periodically to find out when their batch has finished processing; it is not possible to wait on a single socket for the batch to finish.
| Host | Port | Path | Description |
| secure.netbilling.com | 1401 | /gw/sas/getid3.0 | Unencrypted (HTTP) ID generator |
| secure.netbilling.com | 1401 |
/gw/sas/directbatch3.0/validate /gw/sas/directbatch3.0/upload /gw/sas/directbatch3.0/start /gw/sas/directbatch3.0/stop /gw/sas/directbatch3.0/status /gw/sas/directbatch3.0/download | Unencrypted (HTTP) batch interface (not for production) |
| secure.netbilling.com | 1402 |
/gw/sas/directbatch3.0/validate /gw/sas/directbatch3.0/upload /gw/sas/directbatch3.0/start /gw/sas/directbatch3.0/stop /gw/sas/directbatch3.0/status /gw/sas/directbatch3.0/download | Encrypted (HTTPS) batch interface |
| TRAN_TYPE | PAY_TYPE | CARD_NUMBER | CARD_EXPIRE | AMOUNT |
| S | C | 4444333322223018 | 0909 | 5.01 |
| S | C | 4444333322223026 | 1009 | 5.02 |
| S | C | 4444333322223034 | 1109 | 5.03 |
We can expect to receive the following batch response file back:
| TRAN_TYPE | PAY_TYPE | CARD_NUMBER | CARD_EXPIRE | AMOUNT | TRANS_ID | STATUS | AVS_RESULT | CVV_RESULT | AUTH_CODE | AUTH_MSG | LOCAL_AUTH_DATE |
| S | C | 4444333322223018 | 0909 | 5.01 | ? | ? | ? | ? | ? | ? | ? |
| S | C | 4444333322223026 | 1009 | 5.02 | ? | ? | ? | ? | ? | ? | ? |
| S | C | 4444333322223034 | 1109 | 5.03 | ? | ? | ? | ? | ? | ? | ? |
POST /gw/sas/directbatch3.0/validate?account_id=110006559149 HTTP/1.0 Host: secure.netbilling.com:1401 Content-Type: text/comma-separated-values Content-Length: 183 "TRAN_TYPE","PAY_TYPE","CARD_NUMBER","CARD_EXPIRE","AMOUNT" "S","C","4444333322223018","0909","5.01" "S","C","4444333322223026","1009","5.02" "S","C","4444333322223034","1109","5*03"Notice that there is a deliberate error in the amount field for the last record. This is used in the example to demonstrate the error handling. The server will respond with:
HTTP/1.0 200 OK Rejected-Records: 1 Accepted-Records: 2 Connection: close Content-Type: text/comma-separated-values Content-Length: 52 "LINE","ERROR","DATA" "3","Invalid AMOUNT","5*03"During validation data is immediately screened for formatting errors and missing fields. If any errors are detected, they will all be returned, 1 per line, in CSV format in the response body. The number of good (accepted) and bad (rejected) records are returned as HTTP header fields.
POST /gw/sas/directbatch3.0/upload?account_id=110006559149 HTTP/1.0 Host: secure.netbilling.com:1401 Content-Type: text/comma-separated-values Content-Length: 183 "TRAN_TYPE","PAY_TYPE","CARD_NUMBER","CARD_EXPIRE","AMOUNT" "S","C","4444333322223018","0909","5.01" "S","C","4444333322223026","1009","5.02" "S","C","4444333322223034","1109","5.03"The response is also similar to the validate response. It contains one additional header field, Batch-Id, which is a reference to the batch which we will need later.
HTTP/1.0 200 OK Rejected-Records: 0 Accepted-Records: 3 Batch-Id: 109706081619 Connection: close Content-Type: text/comma-separated-values Content-Length: 0This is how batch data is loaded into the system. No transaction processing will occur yet, however, the uploaded data is immediately screened for formatting errors, just like during validation. If any errors are detected, it will not abort the batch upload, but the invalid records will not be loaded. Instead, information on the errors are returned, 1 per line, in CSV format in the upload response body. The number of good (loaded) and bad (rejected) records is returned as header fields.
POST /gw/sas/directbatch3.0/start?account_id=110006559149&batch_id=109706081619 HTTP/1.0 Host: secure.netbilling.com:1401 Content-Length: 0The system will respond with the URL encoded current batch status (STARTING), the number of total_records (3), records_done so far (0), approvals (0), declines (0) and exceptions (0).
HTTP/1.0 200 OK Batch-Id: 109706081619 Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: 82 approvals=0&total_records=3&status=STARTING&records_done=0&exceptions=0&declines=0
POST /gw/sas/directbatch3.0/status?account_id=110006559149&batch_id=109706081619 HTTP/1.0 Host: secure.netbilling.com:1401 Content-Length: 0The response format is the same as for the start command.
HTTP/1.0 200 OK Batch-Id: 109706081619 Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: 82 approvals=3&total_records=3&status=FINISHED&records_done=3&exceptions=0&declines=0In the example above, the status field indicates that the batch has FINISHED processing, and is ready for download.
POST /gw/sas/directbatch3.0/download?account_id=110006559149&batch_id=109706081619 HTTP/1.0 Host: secure.netbilling.com:1401 Content-Length: 0All the uploaded fields, even those (if any) not recognized by our system such as custom user fields, will be returned back in the same order. The response fields will be appended at the end of each line.
HTTP/1.0 200 OK Batch-Id: 109706081619 Connection: close Content-Type: text/comma-separated-values Content-Length: 497 "TRAN_TYPE","PAY_TYPE","CARD_NUMBER","CARD_EXPIRE","AMOUNT","TRANS_ID","STATUS","AVS_RESULT","CVV2_RESULT","AUTH_CODE","AUTH_MSG","LOCAL_AUTH_DATE" "S","C","4444333322223018","0909","5.01","109721726994","1","X","M","999999","TEST APPROVED","2004-06-16 17:05:29" "S","C","4444333322223026","1009","5.02","109721792530","1","X","M","999999","TEST APPROVED","2004-06-16 17:05:29" "S","C","4444333322223034","1109","5.03","109789687891","1","X","M","999999","TEST APPROVED","2004-06-16 17:05:29"
| Input Fields | |
|---|---|
| Column heading | Corresponding parameter name and definition |
| "PAY_TYPE" | pay_type |
| "TRAN_TYPE" | tran_type |
| "SITE_TAG" | site_tag |
| "AMOUNT" | amount |
| "CARD_NUMBER" | card_number |
| "CARD_EXPIRE" | card_expire |
| "CARD_CVV2" | card_cvv2 |
| "NAME1" | bill_name1 |
| "NAME2" | bill_name2 |
| "BILL_STREET" | bill_street |
| "BILL_CITY" | bill_city |
| "BILL_STATE" | bill_state |
| "BILL_ZIP" | bill_zip |
| "BILL_COUNTRY" | bill_country |
| "PHONE" | cust_phone |
| "EMAIL" | cust_email |
| "DESCRIPTION" | description |
| "FORCE_CODE" | force_code |
| "ORIG_ID" | orig_id |
| Output Fields | |
|---|---|
| Column heading | Corresponding parameter name and definition |
| "TRANS_ID" | System generated Transaction ID for each transaction |
| "STATUS" | status_code |
| "AVS_RESULT" | avs_code |
| "CVV2_RESULT" | cvv2_code |
| "AUTH_CODE" | auth_code |
| "AUTH_MSG" | auth_msg |
| "LOCAL_AUTH_DATE" | Local transaction time in YYYY-MM-DD HH:MM:SS format |