ccrz.cc_hk_Payment.processPayment

Prepares transaction payment data during checkout, and passes that payment information to the ccrz.cc_hk_Order.createTransaction method. This method also provides an extension point for implementing validation of a custom payment type. This method supports Apex callouts.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

Signature

global virtual Map<String, Object> processPayment(Map<String, Object>)

Inputs (Required)

Map<String, Object> that must include the following required keys:

ccrz.cc_hk_Payment.PARAM_CART
ccrz__E_Cart__c record that's being converted to an order.
ccrz.cc_hk_Payment.PARAM_TRANSACTION_DATA
JSON-formatted string of transaction payment properties and their values, which the ccrz.cc_hk_Payment.deserializeTransactionParams method parses into a ccrz.cc_hk_Payment.TransactionPaymentParams object.

To include custom payment fields during checkout, override this method in your custom subscriber class. Be sure to deserialize the string to a different object.

Note

Logic Performed

This method completes the following actions:

  1. Sets the transaction payment's amount based on the cart's ccrz__TotalAmount__c value.
  2. Evaluates the transaction input data's accountType and sets the ccrz.cc_hk_Payment.PARAM_ACCOUNT_TYPE key.
  3. Invokes the ccrz.cc_hk_Payment.getPaymentProcessor method for returning the ccrz.ccPaymentProcessor configured for the specified accountType.
  4. Invokes the ccrz.ccPaymentProcessor.preProcess method for handling any Apex callouts for the specified accountType. If the transaction's input data specified a storedPaymentId, this method sets the ccrz.cc_hk_Payment.PARAM_STORED_PAYMENT key in the input map for ccrz.ccPaymentProcessor.preProcess.

When you implement a custom payment type, be sure to override this method in your extension implementation to include validation for the payment. The exact validation logic required depends on the conventions and requirements of the payment type.

Important

Outputs

Map<String, Object> that can include the following keys:

ccrz.cc_hk_Payment.PARAM_ACCOUNT_TYPE
String, based on the input data's accountType, that specifies the transaction's method of payment, such as purchase order (PO), credit card, and so on. This value is passed to the ccrz.ccPaymentProcessor.preProcess method.
ccrz.cc_hk_Payment.PARAM_PAYMENT_PROCESSOR
ccrz.ccPaymentProcessor instance configured for the specified accountType, which the ccrz.cc_hk_Payment.getPaymentProcessor method returned.
ccrz.cc_hk_Payment.PARAM_TRANSACTION_DATA
A copy of the original input ccrz.cc_hk_Payment.PARAM_TRANSACTION_DATA.
ccrz.cc_hk_Payment.PARAM_TRANSACTION_PROCESSED_DATA
ccrz.cc_hk_Payment.TransactionPaymentParams object that represents the original input ccrz.cc_hk_Payment.PARAM_TRANSACTION_DATA, updated with the cart's amount set.