---
schema_version: "1"
id: bf2bc257dab7cd6e9bffc71799fca8173ada1d0c469d764960aa6c80a4b9fdde
title: AbstractResponse Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_commercepayments_AbstractResponse.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: b4a9f5e8c9306cbf8e907e2583791151cf70d96ac8905de8cac315ea8ecdf029
description: Contains the normalized response fields from payment gateways that are common to all the other gateway responses.Sets the AVS (address verification system) result code information that the gateway returned. Maximum length of 64 characters.Sets the date that the transaction occurred. Some gateways don’t send this value.Sets error messages that the gateway returned for the payment request. Maximum length of 255 characters.Sets a gateway-specific result code. The code may be mapped to a Salesforce-specific result code. Maximum length of 64 characters.Sets a description of the gateway-specific result code that a payment gateway returned. Maximum length of 1000 characters.Sets the Salesforce-specific result code information. Payment gateways have many response codes for payment calls. Salesforce uses the result code information to map payment gateway codes to a predefined set of standard Salesforce result codes.Sets the retry category returned by the payment gateway for the failed payment in a batch flow.Sets the retry decision.
---
# AbstractResponse Class

Contains the normalized response fields from payment gateways that are common to all the other gateway responses.

## Namespace

[CommercePayments](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_commercepayments.htm "Use the CommercePayments namespace to provide a safe and customizable platform for managing customer payments and refunds.")

## Usage

You must specify the CommercePayments namespace when creating an instance of this class. The constructor of this class takes no arguments. For example:

CommercePayments.AbstractResponse abr = new CommercePayments.AbstractResponse();

This class can’t be instantiated on its own. This class implements the GatewayResponse class. Other GatewayResponse classes extend this class to inherit common properties.

- **[AbstractResponse Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_methods)**

## AbstractResponse Methods

The following are methods for AbstractResponse.

- **[setGatewayAvsCode(gatewayAvsCode)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_setGatewayAvsCode)**  
    Sets the AVS (address verification system) result code information that the gateway returned. Maximum length of 64 characters.
- **[setGatewayDate(gatewayDate)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_setGatewayDate)**  
    Sets the date that the transaction occurred. Some gateways don’t send this value.
- **[setGatewayMessage(gatewayMessage)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_setGatewayMessage)**  
    Sets error messages that the gateway returned for the payment request. Maximum length of 255 characters.
- **[setGatewayResultCode(gatewayResultCode)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_setGatewayResultCode)**  
    Sets a gateway-specific result code. The code may be mapped to a Salesforce-specific result code. Maximum length of 64 characters.
- **[setGatewayResultCodeDescription(gatewayResultCodeDescription)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_setGatewayResultCodeDescription)**  
    Sets a description of the gateway-specific result code that a payment gateway returned. Maximum length of 1000 characters.
- **[setSalesforceResultCodeInfo(salesforceResultCodeInfo)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commerce_payments_AbstractResponse_setSalesforceResultCodeInfo)**  
    Sets the Salesforce-specific result code information. Payment gateways have many response codes for payment calls. Salesforce uses the result code information to map payment gateway codes to a predefined set of standard Salesforce result codes.
- **[setRetryCategory(retryCategory)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commercepayments_AbstractResponse_setRetryCategory)**  
    Sets the retry category returned by the payment gateway for the failed payment in a batch flow.
- **[setRetryDecision(retryDecision)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AbstractResponse.htm#apex_commercepayments_AbstractResponse_setRetryDecision)**  
    Sets the retry decision.

### setGatewayAvsCode(gatewayAvsCode)

Sets the AVS (address verification system) result code information that the gateway returned. Maximum length of 64 characters.

#### Signature

global void setGatewayAvsCode(String gatewayAvsCode)

#### Parameters

- **gatewayAvsCode**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Code sent by gateways that use
    
    an address verification system.

#### Return Value

Type: void

### setGatewayDate(gatewayDate)

Sets the date that the transaction occurred. Some gateways don’t send this value.

#### Signature

global void setGatewayDate(Datetime gatewayDate)

#### Parameters

- **gatewayDate**:
    
    Type: [Datetime](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_datetime.htm#apex_methods_system_datetime "Contains methods for the Datetime primitive data type.")
    
    Date and time of the gateway communication.

#### Return Value

Type: void

### setGatewayMessage(gatewayMessage)

Sets error messages that the gateway returned for the payment request. Maximum length of 255 characters.

#### Signature

global void setGatewayMessage(String gatewayMessage)

#### Parameters

- **gatewayMessage**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Information on error messages sent from
    
    the gateway.

#### Return Value

Type: void

### setGatewayResultCode(gatewayResultCode)

Sets a gateway-specific result code. The code may be mapped to a Salesforce-specific result code. Maximum length of 64 characters.

#### Signature

global void setGatewayResultCode(String gatewayResultCode)

#### Parameters

- **gatewayResultCode**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.") Gateway-specific result code. Must be used to map a Salesforce-specific result code.

#### Return Value

Type: void

### setGatewayResultCodeDescription(gatewayResultCodeDescription)

Sets a description of the gateway-specific result code that a payment gateway returned. Maximum length of 1000 characters.

#### Signature

global void setGatewayResultCodeDescription(String gatewayResultCodeDescription)

#### Parameters

- **gatewayResultCodeDescription**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.") Description of the gateway’s result code. Use this field to learn more about why the gateway returned a certain result code.

#### Return Value

Type: void

### setSalesforceResultCodeInfo(salesforceResultCodeInfo)

Sets the Salesforce-specific result code information. Payment gateways have many response codes for payment calls. Salesforce uses the result code information to map payment gateway codes to a predefined set of standard Salesforce result codes.

#### Signature

global void setSalesforceResultCodeInfo(commercepayments.SalesforceResultCodeInfo salesforceResultCodeInfo)

#### Parameters

- **salesforceResultCodeInfo**: Type: [commercepayments.SalesforceResultCodeInfo](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_SalesforceResultCodeInfo.htm#apex_class_commerce_payments_SalesforceResultCodeInfo "Stores Salesforce result code information from payment gateway adapters.") Description of the Salesforce result code value.

#### Return Value

Type: void

### setRetryCategory(retryCategory)

Sets the retry category returned by the payment gateway for the failed payment in a batch flow.

#### Signature

public void setRetryCategory(commercepayments.RetryCategory retryCategory)

#### Parameters

- **retryCategory**: Type: commercepayments.[RetryCategory](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_commercepayments_RetryCategory.htm "Specifies the retry category.") Specifies the payment failure category used to determine retry eligibility. Indicates the classification of the payment failure and whether the transaction is eligible for retry.

#### Return Value

Type: void

### setRetryDecision(retryDecision)

Sets the retry decision.

#### Signature

public void setRetryDecision(commercepayments.RetryDecision retryDecision)

#### Parameters

- **retryDecision**: Type: commercepayments.[RetryDecision](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_commercepayments_RetryDecision.htm "Specifies the retry decision.") Determines whether the payment operation can be retried based on the retry category.

#### Return Value

Type: void