---
schema_version: "1"
id: 2abffd6adf67755e81ffd51d1751b17bffd56b47d92ef9570e774f9b27602ea4
title: AddressRequest Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_commercepayments_AddressRequest.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 044736e8f7ca9df0ad861381c2d31b1603eabacb34bc25d88a52a93feb0c2efd
description: Contains address request data that is sent to a gateway adapter during a service call.Constructs a sample address. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.City of the payment method address.Company name of the payment method address.Country for the payment method address.Postal code for the payment method address.State for the payment method address.Street for the payment method address.Maintains the integrity of lists of type AddressRequest by determining the equality of external objects in a list. This method is dynamic and is based on the equals method in Java.Maintains the integrity of lists of type AddressRequest.Converts a date to a string.
---
# AddressRequest Class

Contains address request data that is sent to a gateway adapter during a service call.

## 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

Contains information about the payment method’s address. Use this information in authorization, sale, and tokenization requests. The payment gateway adapter uses information in an AddressRequest object to construct a JSON request to send to the payment gateway.

The constructor of this class takes no arguments. For example:

CommercePayments.AddressRequest adr = new CommercePayments.AddressRequest();

- **[AddressRequest Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_constructors)**
- **[AddressRequest Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_properties)**
- **[AddressRequest Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_methods)**

## AddressRequest Constructors

The following are constructors for AddressRequest.

- **[AddressRequest(street, city, state, country, postalCode)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_ctor)**  
    Constructs a sample address. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

### AddressRequest(street, city, state, country, postalCode)

Constructs a sample address. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

#### Signature

global AddressRequest(String street, String city, String state, String country, String postalCode)

#### Parameters

- **street**:
    
    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.")
    
    Street
    
    for the payment method's address.
- **city**:
    
    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.")
    
    City
    
    for the payment method's address.
- **state**:
    
    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.")
    
    State
    
    for the payment method's address.
- **country**:
    
    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.")
    
    Country
    
    for the payment method's address.
- **postalCode**:
    
    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.")
    
    Postal code
    
    for the payment method's address.

## AddressRequest Properties

The following are properties for AddressRequest.

- **[city](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_city)**  
    City of the payment method address.
- **[companyName](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_companyName)**  
    Company name of the payment method address.
- **[country](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_country)**  
    Country for the payment method address.
- **[postalCode](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_postalCode)**  
    Postal code for the payment method address.
- **[state](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_state)**  
    State for the payment method address.
- **[street](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_street)**  
    Street for the payment method address.

### city

City of the payment method address.

#### Signature

global String city {get; set;}

#### Property Value

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.")

### companyName

Company name of the payment method address.

#### Signature

global String companyName {get; set;}

#### Property Value

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.")

### country

Country for the payment method address.

#### Signature

global String country {get; set;}

#### Property Value

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.")

### postalCode

Postal code for the payment method address.

#### Signature

global String postalCode {get; set;}

#### Property Value

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.")

### state

State for the payment method address.

#### Signature

global String state {get; set;}

#### Property Value

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.")

### street

Street for the payment method address.

#### Signature

global String street {get; set;}

#### Property Value

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.")

## AddressRequest Methods

The following are methods for AddressRequest.

- **[equals(obj)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_equals)**  
    Maintains the integrity of lists of type AddressRequest by determining the equality of external objects in a list. This method is dynamic and is based on the equals method in Java.
- **[hashCode()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_hashCode)**  
    Maintains the integrity of lists of type AddressRequest.
- **[toString()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_commercepayments_AddressRequest_toString)**  
    Converts a date to a string.

### equals(obj)

Maintains the integrity of lists of type AddressRequest by determining the equality of external objects in a list. This method is dynamic and is based on the equals method in Java.

#### Signature

global Boolean equals(Object obj)

#### Parameters

- **obj**:
    
    Type:
    
    Object External object whose key is to be validated.

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

### hashCode()

Maintains the integrity of lists of type AddressRequest.

#### Signature

global Integer hashCode()

#### Return Value

Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")

### toString()

Converts a date to a string.

#### Signature

global String toString()

#### Return Value

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.")