---
schema_version: "1"
id: 0c686de4bb58ed3a29e0a6298673b9020ceedf8aa784a9a008e274d5093f2673
title: BaseApiPaymentMethodRequest Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1741139c57eb25eb540b079754dd51e02d92b41d71cdf51e1468372eb72c33f0
description: Abstract class used to send information about a payment method to a gateway adapter during a service call.Constructs a payment method. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.The payment method’s address. ID of the payment method request.ID of the payment method type.Indicates whether the payment method is saved as a record in Salesforce for future use.Maintains the integrity of lists of type BaseApiPaymentMethodRequest 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 BaseApiPaymentMethodRequest by determining the uniqueness of the external object records in a list.Converts a date to a string.
---
# BaseApiPaymentMethodRequest Class

Abstract class used to send information about a payment method 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

BaseApiPaymentMethodRequest is the base class for [SaleApiPaymentMethodRequest](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_SaleApiPaymentMethodRequest.htm#apex_class_commercepayments_SaleApiPaymentMethodRequest "Sends data related to a card payment method to a gateway adapter during a sale service call.") and [AuthApiPaymentMethodRequest](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AuthApiPaymentMethodRequest.htm#apex_class_commercepayments_AuthApiPaymentMethodRequest "Sends information about a payment method to a gateway adapter during an authorization service call.").

- **[BaseApiPaymentMethodRequest Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_constructors)**
- **[BaseApiPaymentMethodRequest Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_properties)**
- **[BaseApiPaymentMethodRequest Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_methods)**

## BaseApiPaymentMethodRequest Constructors

The following are constructors for BaseApiPaymentMethodRequest.

- **[BaseApiPaymentMethodRequest(address, id, saveForFuture)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_ctor)**  
    Constructs a payment method. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

### BaseApiPaymentMethodRequest(address, id, saveForFuture)

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

#### Signature

global BaseApiPaymentMethodRequest(commercepayments.AddressRequest address, String id, Boolean saveForFuture)

#### Parameters

- **address**:
    
    Type: [commercepayments.AddressRequest](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_class_commercepayments_AddressRequest "Contains address request data that is sent to a gateway adapter during a service call.")
    
    Sends
    
    data related on address request to a gateway adapter during a service call.
- **id**:
    
    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.")
- **saveForFuture**:
    
    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.")
    
    Indicates whether Salesforce saves the payment method for future use.

## BaseApiPaymentMethodRequest Properties

The following are properties for BaseApiPaymentMethodRequest.

- **[address](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_address)**  
    The payment method’s address.
- **[id](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_id)**  
    ID of the payment method request.
- **[idType](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_idType)**  
    ID of the payment method type.
- **[saveForFuture](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_saveForFuture)**  
    Indicates whether the payment method is saved as a record in Salesforce for future use.

### address

The payment method’s address.

#### Signature

global commercepayments.AddressRequest address {get; set;}

#### Property Value

Type: [AddressRequest](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AddressRequest.htm#apex_class_commercepayments_AddressRequest "Contains address request data that is sent to a gateway adapter during a service call.")

### id

ID of the payment method request.

#### Signature

global String id {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.")

### idType

ID of the payment method type.

#### Signature

public commercepayments.PaymentMethodIdType idType {get; set;}

#### Property Value

Type: commercepayments.[PaymentMethodIdType](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_commercepayments_PaymentMethodIdType.htm "Specifies the ID of the payment method type.")

### saveForFuture

Indicates whether the payment method is saved as a record in Salesforce for future use.

#### Signature

global Boolean saveForFuture {get; set;}

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

## BaseApiPaymentMethodRequest Methods

The following are methods for BaseApiPaymentMethodRequest.

- **[equals(obj)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_equals)**  
    Maintains the integrity of lists of type BaseApiPaymentMethodRequest 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_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_hashCode)**  
    Maintains the integrity of lists of type BaseApiPaymentMethodRequest by determining the uniqueness of the external object records in a list.
- **[toString()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_BaseApiPaymentMethodRequest.htm#apex_commercepayments_BaseApiPaymentMethodRequest_toString)**  
    Converts a date to a string.

### equals(obj)

Maintains the integrity of lists of type BaseApiPaymentMethodRequest 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 BaseApiPaymentMethodRequest by determining the uniqueness of the external object records in a list.

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