---
schema_version: "1"
id: 6ac110c59fbcf8d373979eb9d559e7e0cccc6bad2f50c789ae5bc839d03c55d5
title: AlternativePaymentMethodRequest Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: df08dc6785a35e2ee14d9c78c5de9d6a80789020be919f1465abbe61616ef2bb
description: The class contains information about the alternative payment method that are required for a gateway to process the request.Creates a new instance of the CommercePayments.AlternativePaymentMethodRequest class.Salesforce account ID to which this payment method is linked.Email address of the card holder.A unique, alphanumeric ID, that a payment gateway generates when it first processes a payment.Information about the gateway token.Name that you assign to the PaymentMethod object.Maintains the integrity of lists of type AlternativePaymentMethodRequest by determining the equality of external objects in a list. This method is dynamic and based on the equals method in Java.Maintains the integrity of lists of type AlternativePaymentMethodRequest by determining the uniqueness of the external object records in a list.Converts a date to a string.
---
# AlternativePaymentMethodRequest Class

The class contains information about the alternative payment method that are required for a gateway to process the request.

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

## Example

commercepayments.PostAuthApiPaymentMethodRequest apiPaymentMethod =(commercepayments.PostAuthApiPaymentMethodRequest) postAuthRequest.paymentMethod;
commercepayments.AlternativePaymentMethodRequest alternativePaymentMethod= (commercepayments.AlternativePaymentMethodRequest) apiPaymentMethod.alternativePaymentMethod;
String gatewayToken = (String)alternativePaymentMethod.gatewayToken;
String gatewayTokenDetails = (String)alternativePaymentMethod.gatewayTokenDetails;
String name = (String)alternativePaymentMethod.name;
String accountId = (String)alternativePaymentMethod.accountId;
String email = (String)alternativePaymentMethod.email;

- **[AlternativePaymentMethodRequest Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_constructors)**
- **[AlternativePaymentMethodRequest Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_properties)**
- **[AlternativePaymentMethodRequest Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_methods)**

## AlternativePaymentMethodRequest Constructors

The following are constructors for AlternativePaymentMethodRequest.

- **[AlternativePaymentMethodRequest(gatewayToken)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_ctor)**  
    Creates a new instance of the CommercePayments.AlternativePaymentMethodRequest class.

### AlternativePaymentMethodRequest(gatewayToken)

Creates a new instance of the CommercePayments.AlternativePaymentMethodRequest class.

#### Signature

public AlternativePaymentMethodRequest(String gatewayToken)

#### Parameters

- **gatewayToken**:
    
    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.")
    
    A unique, alphanumeric ID, called a token, that a payment gateway generates when it first processes a payment. The token replaces the actual payment data so that the data is kept secure. This token is stored as encrypted text, and can be used for recurring payments.

## AlternativePaymentMethodRequest Properties

The following are properties for AlternativePaymentMethodRequest.

- **[accountId](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_accountId)**  
    Salesforce account ID to which this payment method is linked.
- **[email](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_email)**  
    Email address of the card holder.
- **[gatewayToken](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_gatewayToken)**  
    A unique, alphanumeric ID, that a payment gateway generates when it first processes a payment.
- **[gatewayTokenDetails](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_gatewayTokenDetails)**  
    Information about the gateway token.
- **[name](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_name)**  
    Name that you assign to the PaymentMethod object.

### accountId

Salesforce account ID to which this payment method is linked.

#### Signature

public String accountId {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.")

### email

Email address of the card holder.

#### Signature

public String email {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.")

### gatewayToken

A unique, alphanumeric ID, that a payment gateway generates when it first processes a payment.

The token replaces the actual payment data so that the data is kept secure. This token is stored as encrypted text, and can be used for recurring payments.

#### Signature

public String gatewayToken {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.")

### gatewayTokenDetails

Information about the gateway token.

#### Signature

public String gatewayTokenDetails {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.")

### name

Name that you assign to the PaymentMethod object.

#### Signature

public String name {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.")

## AlternativePaymentMethodRequest Methods

The following are methods for AlternativePaymentMethodRequest.

- **[equals(obj)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_equals)**  
    Maintains the integrity of lists of type AlternativePaymentMethodRequest by determining the equality of external objects in a list. This method is dynamic and based on the equals method in Java.
- **[hashCode()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_hashCode)**  
    Maintains the integrity of lists of type AlternativePaymentMethodRequest 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_AlternativePaymentMethodRequest.htm#apex_commercepayments_AlternativePaymentMethodRequest_toString)**  
    Converts a date to a string.

### equals(obj)

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

#### Signature

public 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 AlternativePaymentMethodRequest by determining the uniqueness of the external object records in a list.

#### Signature

public 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

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