Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
PaymentGatewayContext Class
Namespace
Usage
The constructor of this class takes no arguments. For example:
CommercePayments.PaymentGatewayContext pgc = new CommercePayments.PaymentGatewayContext();Example
1global commercepayments.GatewayResponse processRequest(commercepayments.PaymentGatewayContext gatewayContext) {
2 commercepayments.RequestType requestType = gatewayContext.getPaymentRequestType();
3 if (requestType == commercepayments.RequestType.Capture) {
4 commercepayments.CaptureRequest captureRequest = (commercepayments.CaptureRequest) gatewayContext.getPaymentRequest();
5 }
6}PaymentGatewayContext Constructors
The following are constructors for PaymentGatewayContext.
PaymentGatewayContext(request, requestType)
Constructor to enable instance creation. This constructor is intended
for test usage and throws an exception if used outside of the Apex test
context.
Signature
global PaymentGatewayContext(commercepayments.PaymentGatewayRequest request, String requestType)
Parameters
- request: Type: commercepayments.PaymentGatewayRequest Raw payload. Sensitive attributes are masked to ensure PCI compliance.
- requestType: Type: commercepayments.RequestType Enum Defines the type of request made to the gateway
PaymentGatewayContext Methods
The following are methods for PaymentGatewayContext.