This subprocedure is used to query a transaction using the CyberSource REST Transaction Query API. This subprocedure requires a record for your merchant ID in CTICFGRPT, and you must populate the record with a shared and secret key pair for use with CyberSource’s HTTP Signature Authentication. For more information on generating these keys, please see this guide from CyberSource: Create a Shared Secret Key for HTTP Signature Authentication

The ADDRPTKEY command can be used to easily create a record for your merchant ID and generated security keys in CTICFGRPT.

The query response will be downloaded to an IFS file in the download directory specified in your CTICFGMCH record. This file can be parsed with the CTI_ParseTransactionQuery() subprocedure.

If an error occurs, this subprocedure will return *OFF, and information about the error will be present in the pErrorDS parameter which contains a CTI_ErrorDS_t data structure.

Subprocedure Prototype

D CTI_QueryTransaction...
D                 PR              N   Extproc('CTI_QueryTransaction')

Returns *OFF if an error occurs during processing, *ON otherwise.

D  pUniqueId                          Const Like(CTI_UniqueId_t)

Unique ID generated with CTI_NextUniqueID()


D  pQueryTransactionDS...
D                                     LikeDS(CTI_QueryTransactionDS_t)

A data structure containing configuration information for the query to be performed


D  pErrorDS                           LikeDS(CTI_ErrorDS_t)

Error data structure used to capture subprocedure and CyberSource errors


Data Structures

D CTI_QueryTransactionDS_t...
D                 DS                  Qualified Template Inz
D  MerchantId                         Like(CTI_MerchantId_t)

Merchant ID used to process the transaction


D  Environment                   5A

CyberSource environment where the report will be retrieved from


Valid Values:


D  KeyLabel                     50A   Varying

Unique label to identify the security key in CTICFGRPT to be used

Default Value: CTI_DEFAULT

D  TransactionId                50A   Varying

CyberSource unique identifier for the transaction to be queried

D  Filepath                           Like(CTI_FilePath_t)

Name of the file where the report will be downloaded. This file will be saved in the default download directory set for the specified merchant ID in CTICFGMCH

D CTI_ErrorDS_t   DS                  Qualified Template Inz
D  Subproc                     132A   Varying

Name of subprocedure returning error

D  MessageId                     7A

Message ID of error message

D  Message                    1024A   Varying

Error message text

D  Source                       10A

Error message source

D  LogFile                            Like(CTI_FilePath_t)

IFS filepath of generated log file

Input Table Files



CyberSource Report API Configuration Record



Merchant ID for the reporting account

A  ENV            5A         VARLEN


CyberSource environment for which the security key was generated

A  KEYLABEL      50A         VARLEN


Optional unique identifier for the security key, to allow multiple keys for one merchant ID/environment

A  SHAREDKEY     36A         VARLEN

CyberSource HTTP Signature Authentication shared key

A  SECRETKEY     50A         VARLEN

CyberSource HTTP Signature Authentication secret key