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.

CommercePayments

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

CommercePayments.PaymentMethodTokenizationRequest pmtr = new CommercePayments.PaymentMethodTokenizationRequest();

This class holds all the required details about the tokenize request. Gateway adapters read the information in this class while constructing a tokenization JSON request, which is sent to the payment gateway.

The following code is used within your payment gateway adapter Apex class.

Use the GatewayResponse class’s processRequest method to build responses based on the request type that it receives from an instance of PaymentGatewayContext. If the request type is Tokenize, GatewayResponse calls the createTokenizeResponse method and passes an instance of the PaymentMethodTokenizationRequest class. The passed PaymentMethodTokenizationRequest object contains the address and cardPaymentMethod information that the payment gateway needs to manage the tokenization process. For example:

Configure the createTokenizeResponse method to accept an instance of PaymentMethodTokenizationRequest. Then, build an instance of PaymentMethodTokenizationResponse based on the values received from the payment gateway.

The tokenizeResponse contains the results of the gateway’s tokenization process, and if successful, the tokenized value.

The following are constructors for PaymentMethodTokenizationRequest.

Payment gateway ID constructor used with paymentMethodTokenizationRequest. This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

global PaymentMethodTokenizationRequest(String paymentGatewayId)

  • paymentGatewayId:

    Type: String

    The payment method’s payment gateway ID that will be tokenized.

The following are constructors for PaymentMethodTokenizationRequest.

global PaymentMethodTokenizationRequest()

The following are properties for PaymentMethodTokenizationRequest.

  • address

    The card payment method address to be tokenized.

  • bankPaymentMethod

    The bank payment method containing data to be tokenized.

  • cardPaymentMethod

    The card payment method containing data to be tokenized.

  • savedByMerchant

    Indicates whether the payment method to be tokenized is saved by the marchant (true) or not (false).

The card payment method address to be tokenized.

global commercepayments.AddressRequest address {get; set;}

Type: AddressRequest

The bank payment method containing data to be tokenized.

public commercepayments.BankPaymentMethodRequest bankPaymentMethod {get; set;}

Type: commercepayments.BankPaymentMethodRequest

The card payment method containing data to be tokenized.

global commercepayments.CardPaymentMethodRequest cardPaymentMethod {get; set;}

Type: CardPaymentMethodRequest

Indicates whether the payment method to be tokenized is saved by the marchant (true) or not (false).

public Boolean savedByMerchant {get; set;}

Type: Boolean

The following are methods for PaymentMethodTokenizationRequest.

  • equals(obj)

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

  • hashCode()

    Maintains the integrity of lists of type PaymentMethodTokenizationRequest by determining the uniquness of the external object records in a list.

  • toString()

    Converts a date to a string.

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

global Boolean equals(Object obj)

  • obj:

    Type:

    Object External object whose key is to be validated.

Type: Boolean

Maintains the integrity of lists of type PaymentMethodTokenizationRequest by determining the uniquness of the external object records in a list.

global Integer hashCode()

Type: Integer

Converts a date to a string.

global String toString()

Type: String