Fetch Transaction Information

A guide on using the Transaction Status API

This guide will show how to utilize the PayConex Transaction Status API. This API provides an interface to request previous transaction details or a transaction_id value prior to processing a payment.

By fetching a transaction_id value beforehand a developer can send a transaction_id within a PayConex payment request. In this scenario if a communication error, packet loss, or similar issue occurs a developer could use the Transaction Status API to request transaction details in order to determine if the transaction was successful or not.

API URLs

For the certification test environment:

https://cert.payconex.net/api/tsapi/3.8

For the production environment:

https://secure.payconex.net/api/tsapi/3.8

Transaction Status API Functions

There are two main actions that can be done using the Transaction Status API:

  • GET_TRANSACTION_ID: Returns a transaction_id for use in a PayConex payment request. This value is passed through the transaction_id parameter.
  • GET_TRANSACTION_STATUS: Returns the status of a transaction.

Fetching a Transaction ID

Here is an example of a request to fetch a transaction_id value:

curl --request POST \
  --url https://cert.payconex.net/api/tsapi/3.8 \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data account_id=220614966801 \
  --data api_accesskey=32d42f0f0b6c89616d42aed8c96801e6 \
  --data action=GET_TRANSACTION_ID

Here is an example of a PayConex API request using a pre-fetched transaction_id. For more PayConex API examples and information please see our Processing Transactions article.

curl --request POST \
  --url https://cert.payconex.net/api/qsapi/3.8 \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data account_id=220614966801 \
  --data api_accesskey=32d42f0f0b6c89616d42aed8c96801e6 \
  --data tender_type=CARD \
  --data transaction_type=SALE \
  --data transaction_amount=1.00 \
  --data card_number=4124939999999990 \
  --data card_expiration=1230 \
  --data card_verification=456 \
  --data transaction_id=000000101281

Fetching Transaction Details

Here is an example of a request to fetch the details of a previous transaction:

curl --request POST \
  --url https://cert.payconex.net/api/tsapi/3.8 \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data account_id=220614966801 \
  --data api_accesskey=32d42f0f0b6c89616d42aed8c96801e6 \
  --data action=GET_TRANSACTION_STATUS \
  --data transaction_id=000000101161

Handling Transaction Status API Responses

The Transaction Status API provides the response_format parameter to allow developers a method to specify a desired data format.

There are three supported data formats at this time:

  • FORM: A url-encoded HTTP form query string.
  • JSON: A string in JavaScript Object Notation format.
  • DEBUG: A simple, human readable array output. Intended only for use by a developer for testing.

This is an example response where the action is GET_TRANSACTION_ID with the response_format value as JSON.

{
  "transaction_id": "000000101261",
  "error": false,
  "error_code": 0,
  "error_message": null,
  "error_msg": null
}

This is an example response where the action is GET_TRANSACTION_STATUS with the response_format value as JSON.

{
  "transaction_id": "000000101161",
  "transaction_timestamp": "2021-08-12 21:53:13",
  "authorization_message": "APPROVED",
  "transaction_amount": 1,
  "cashier": "QSAPI 3.8",
  "transaction_approved": true,
  "found": true,
  "error": false,
  "error_code": 0,
  "error_message": null,
  "error_msg": null
}

TSAPI Request Format

Below are all the variables that can be posted to TSAPI along with a brief description of their function.

Variable Name Max Type Req'd Description
account_id 12 Numeric Yes This is the Payconex account identification number that you are issued after your account has been setup.
action n/a Enumerated Yes GET_TRANSACTION_ID: Returns a transaction_id for use with a new SALE, AUTHORIZATION, CREDIT transaction to be passed through the transaction_id variable. GET_TRANSACTION_STATUS: Returns the status of a transaction.
api_accesskey 32 Alphanumeric Yes This is a secret key that you will be provided when your Payconex account is set up and when you have requested access to QSAPI.
response_format 5 Enumerated No Desired response format. FORM: www-form-urlencoded string (default format) JSON: JavaScript Object Notation JSONP: JSON w/ Padding DEBUG: human readable array output
transaction_id 12 Numeric Yes/No Required for GET_TRANSACTION_STATUS action.

TSAPI Response Format

Below are all the variables that can be returned via TSAPI along with a brief description of their function.

👍

Note

For your security, transactions older than 18 months may be purged from our system.

Variable Name Max Type Description
authorization_message 50 Alphanumeric Only returned from GET_TRANSACTION_STATUS if transaction is found. Same as the response from a QSAPI SALE transaction_type.
cashier 100 Alphanumeric Only returned from GET_TRANSACTION_STATUS if transaction is found. Same as the response from a QSAPI SALE transaction_type.
found 1 Boolean Returned from GET_TRANSACTION_STATUS action as True if transaction is found.
transaction_amount 9 Numeric with decimal Only returned from GET_TRANSACTION_STATUS if transaction is found. Same as the response from a QSAPI SALE transaction_type.
transaction_approved 1 Boolean Only returned from GET_TRANSACTION_STATUS if transaction is found. Same as the response from a QSAPI SALE transaction_type.
transaction_id 12 Numeric The only variable returned from the GET_TRANSACTION_ID action.
transaction_id 12 Numeric Only returned from GET_TRANSACTION_STATUS if transaction is found. Same as the response from a QSAPI SALE transaction_type.
transaction_timestamp 19 YYYY-MM-DD HH:MM:SS Only returned from GET_TRANSACTION_STATUS if transaction is found. Same as the response from a QSAPI SALE transaction_type.

Did this page help you?