Apex Reference Guide
Summer '26 (API version 67.0)
Spring '26 (API version 66.0)
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
CardCategory Enum
NotificationStatus Enum
RequestType Enum
SalesforceResultCode Enum
Newer Version Available
CommercePayments Namespace
Use the CommercePayments namespace to provide a
safe and customizable platform for managing customer payments and refunds.
To review CommercePayments use cases and walkthroughs, go to Use Cases for the CommercePayments Namespace.
The following are the classes in the CommercePayments namespace.
-
AbstractResponse Class
Contains the normalized response fields from payment gateways that are common to all the other gateway responses. -
AddressRequest Class
Contains address request data that is sent to a gateway adapter during a service call. -
AuditParamsRequest
AuditParamsRequest is used for audit parameters in a transaction request. This is an abstract request class that is extended by the BaseRequest class. -
AbstractTransactionResponse Class
Abstract class for storing normalized information sent from payment gateways about a payment transaction. Holds the common response fields sent from payment gateways for authorization, sale, capture, and refund transactions. -
AuthApiPaymentMethodRequest Class
Sends information about a payment method to a gateway adapter during an authorization service call. -
AuthorizationReversalRequest Class
Sends information about an authorization reversal request to a gateway adapter during a service call. -
AuthorizationReversalResponse Class
Response sent by the payment gateway following a payment authorization reversal service. -
AuthorizationRequest Class
Sends information about an authorization request to a gateway adapter during a service call. -
AuthorizationResponse Class
Response sent by the payment gateway adapter for an authorization service. -
BaseApiPaymentMethodRequest Class
Abstract class used to send information about a payment method to a gateway adapter during a service call. -
BaseNotification Class
Abstract class for storing notification information sent from payment gateways. -
BasePaymentMethodRequest Class
Abstract class for storing information about payment methods. -
BaseRequest Class
BaseRequest is extended by all the request classes. -
CaptureNotification Class
When a payment gateway sends a notification for a capture transaction, the payment gateway adapter creates the CaptureNotification object to store information about the notification. -
CaptureRequest Class
Represents a capture request. This class extends the BaseRequest class and inherits all its methods. -
CaptureResponse Class
The payment gateway adapter sends this response for the capture request type. This class extends AbstractResponse and inherits its methods. -
CardCategory Enum
Defines whether the payment method represents a credit card or a debit card. -
CardPaymentMethodRequest Class
Sends data related to a card payment method to a gateway adapter during a service call. -
CustomMetadataTypeInfo Class
Access information about custom metadata. The PaymentGatewayAdapter can send CustomMetadataTypeInfo to transaction requests through the response object’s SalesforceResultCodeInfo. -
GatewayErrorResponse Class
Use to respond with an error indication following errors from the PaymentGateway adapter, such as request-forbidden responses, custom validation errors, or expired API tokens. -
GatewayNotificationResponse Class
When the payment gateway sends a notification to the payments platform, the platform responds with a GatewayNotificationResponse indicating whether the platform succeeded or failed at receiving the notification. -
GatewayResponse Interface
Generic payment gateway response interface. This class extends the CaptureResponse, AbstractTransactionResponse, and AbstractResponse classes and inherits all their properties. It has no unique methods or parameters. -
NotificationClient Class
Communicates with the payment platform regarding the gateway’s notification. -
NotificationSaveResult Class
Contains the result of the payment platform’s attempt to record data from the gateway’s notification. -
NotificationStatus Enum
Shows whether the payments platform successfully received the notification from the gateway. -
PaymentGatewayAdapter Interface
PaymentGatewayAdapters can implement this interface in order to process requests. -
PaymentGatewayAsyncAdapter Interface
Implement the interface to allow customers to process payments asynchronously. -
PaymentGatewayContext Class
Wraps the information related to a payment request. -
PaymentGatewayNotificationContext Class
Wraps the information related to a gateway notification. -
PaymentMethodTokenizationRequest Class
Stores data about a request to tokenize a card payment method. The tokenization process occurs in the payment gateway. This process replaces sensitive customer data, such as a card number or CVV, with unique identification symbols. The symbols are used while the data is handled by Salesforce, the payment gateway, and the customer bank, allowing Salesforce to store the token without storing sensitive customer data. -
PaymentMethodTokenizationResponse Class
Gateway response sent by payment gateway adapters for the payment method tokenization request. The response includes the payment method’s token ID value. -
PaymentGatewayNotificationRequest Class
Contains the notification request data from the gateway. -
PaymentsHttp Class
Makes an HTTP request to start the interaction with the payment gateway. -
RefundRequest Class
Sends data related to a refund to the payment gateway adapter. -
ReferencedRefundNotification Class
When a payment gateway sends a notification for a refund transaction, the payment gateway adapter creates the ReferencedRefundNotification object to store information about notification. -
ReferencedRefundRequest
Access information about the referenced refund requests. Extends the RefundRequest class. -
ReferencedRefundResponse Class
The payment gateway adapter sends this response for the ReferencedRefund request type. -
RequestType Enum
Defines the type of payment transaction request made to the payment gateway. -
SaleApiPaymentMethodRequest Class
Sends data related to a card payment method to a gateway adapter during a sale service call. -
SaleRequest Class
Stores information about a sales request. -
SaleResponse Class
Response sent by payment gateway adapters for a sales service. -
SalesforceResultCode Enum
Defines the gateway call status values in Salesforce based on the call status values that the payment gateway returned. -
SalesforceResultCodeInfo
Stores Salesforce result code information from payment gateway adapters.