SaleRequest Class

Stores information about a sales request.

CommercePayments

This class holds all the required details about a sale request. Gateway adapters read the fields of this class object while constructing a sale JSON request thatis sent to the payment gateway. The object of this class is made available through commercepayments.paymentGatewayContext by calling getPaymentRequest().

The following are constructors for SaleRequest.

  • SaleRequest(amount)

    Constructor for defining an amount for the sale request. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

Constructor for defining an amount for the sale request. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

global SaleRequest(Double amount)

  • amount:

    Type: Double

    Amount of the sale request.

The following are properties for SaleRequest.

Customer account ID for the sale request.

global String accountId {get; set;}

Type: String

Amount of the sale request. Can be positive only.

global Double amount {get; set;}

Type: Double

Additional information about the sale request.

global String comments {get; set;}

Type: String

Currency code for the sale request.

global String currencyIsoCode {get; set;}

Type: String

Represents enhanced payment data, including Level 2 and Level 3 fields.

Supported only for third-party payment gateways; not supported for native payments.

public commercepayments.EnhancedPaymentDataInput enhancedPaymentData {get; set;}

Type: commercepayments.EnhancedPaymentDataInput

ID of the source that initiated the payment.

Supported only for third-party payment gateways; not supported for native payments. See PaymentInitiationSource object documentation for more information.

public String paymentInitiationSourceId {get; set;}

Type: String

Payment method used in the sale request.

global commercepayments.SaleApiPaymentMethodRequest paymentMethod {get; set;}

Type: SaleApiPaymentMethodRequest

Payment method data used in the sale request.

This field is populated when SaleInput specifies a saved payment method. Accessible using paymentMethodData on SaleRequest. The map contains these fields from SavedPaymentMethod: GatewayToken, Type, GatewayReference, and StandardEntryCode for direct gateway interaction without querying the database.

public Map<String,String> paymentMethodData {get; set;}

Type: Map<String,String>

Indicates whether the sale request is submitted by the marchant (true) or not (false).

public Boolean submittedByMerchant {get; set;}

Type: Boolean

The following are methods for SaleRequest.

  • equals(obj)

    Compares this object with the specified object and returns true if both objects are equal; otherwise, returns false.

  • hashCode()

    Maintains the integrity of lists of type SaleRequest by determining the uniqueness of the external object records in a list.

  • toString()

    Converts a date to a string.

Compares this object with the specified object and returns true if both objects are equal; otherwise, returns false.

global Boolean equals(Object obj)

  • obj:

    Type: Object

Type: Boolean

Maintains the integrity of lists of type SaleRequest by determining the uniqueness of the external object records in a list.

global Integer hashCode()

Type: Integer

Converts a date to a string.

global String toString()

Type: String