Newer Version Available
Payments Class
Namespace
Payments Methods
authorize(authorizePayment)
API Version
51.0
Requires Chatter
No
Signature
global static ConnectApi.AuthorizationResponse authorize(ConnectApi.AuthorizationRequest authorizePayment)
Parameters
- authorizePayment
- Type: ConnectApi.AuthorizationRequest
- Represents a payment authorization.
Return Value
postAuth(postAuthorizePayment)
API Version
54.0
Requires Chatter
No
Signature
global static ConnectApi.PostAuthorizationResponse postAuth(ConnectApi.PostAuthRequest postAuthorizePayment)
Parameters
- postAuthorizePayment
- Type: ConnectApi.PostAuthRequest
- Information about the payment, payment method, and payment gateway from the original payment authorization.
Return Value
reverseAuthorization(AuthReversalInput, authorizationId)
API Version
51.0
Requires Chatter
No
Signature
global static ConnectApi.AuthorizationReversalResponse reverseAuthorization(ConnectApi.AuthorizationReversalRequest AuthReversalInput, String authorizationId)
Parameters
- AuthReversalInput
- Type: ConnectApi.AuthorizationReversalRequest
- Input information for the payment authorization reversal.
- authorizationId
- Type: String
- The ID of the payment authorization to be reversed.
Return Value
capture(AuthCaptureInput, authorizationId)
To access Payments methods, you need these permissions.
- Salesforce Order Management License
- PaymentsAPIUser user permission. This permission is available with the Salesforce Order Management License. Your Salesforce admin assigns it to your profile.
API Version
50.0
Requires Chatter
No
Signature
global static ConnectApi.CaptureResponse capture(ConnectApi.CaptureRequest AuthCaptureInput, String authorizationId)
Parameters
- AuthCaptureInput
- Type: ConnectApi.CaptureRequest
- A ConnectApi.CaptureRequest object with information about the payment capture.
- authorizationId
- Type: String
- ID of the payment authorization. Required.
Return Value
refund(ReferencedRefundInput, paymentId)
To access Payments methods, you need these permissions.
- Salesforce Order Management License
- PaymentsAPIUser user permission. This permission is available with the Salesforce Order Management License. Your Salesforce admin assigns it to your profile.
API Version
50.0
Requires Chatter
No
Signature
global static ConnectApi.ReferencedRefundResponse refund(ConnectApi.ReferencedRefundRequest ReferencedRefundInput, String paymentId)
Parameters
- ReferencedRefundInput
- Type: ConnectApi.ReferencedRefundRequest
- A ConnectApi.ReferencedRefundRequest object with information about the refund.
- paymentId
- Type: String
- ID of the payment to be refunded. Required.
Return Value
sale(sale)
API Version
54.0
Requires Chatter
No
Signature
global static ConnectApi.SaleResponse sale(ConnectApi.SaleRequest sale)
Parameters
- sale
- Type: ConnectApi.SaleRequest
- Payment sale input class.
Return Value
Type: ConnectApi.SaleResponse
tokenizePaymentMethod(tokenizePaymentMethodInput)
API Version
52.0
Requires Chatter
No
Signature
global static ConnectApi.PaymentMethodTokenizationResponse tokenizePaymentMethod(ConnectApi.PaymentMethodTokenizationRequest tokenizePaymentMethodInput)
Parameters
- tokenizePaymentMethodInput
- Type: ConnectApi.PaymentMethodTokenizationRequest
- Information about the payment method to be tokenized.
Return Value
Usage
Accepts input parameters representing a payment method and passes them in a tokenization request to the payment gateway. The results of the tokenization request are returned as a response from the payment gateway. If the tokenization was successful, the response contains the tokenized value and details about the tokenization process. Otherwise, the response contains an error message and details about the error.
Example
1ConnectApi.PaymentMethodTokenizationRequest request = new ConnectApi.PaymentMethodTokenizationRequest();
2request.paymentGatewayId = ‘0b0xx0000001Ja5AAE’;
3ConnectApi.CardPaymentMethodRequest cpmRequest = new ConnectApi.CardPaymentMethodRequest();
4cpmRequest.cardHolderName = ‘Jo Manager’;
5cpmRequest.expiryMonth = 11;
6cpmRequest.expiryYear = 2222;
7cpmRequest.cardNumber = ‘4111111111111111’;
8cpmRequest.cvv = ‘111’;
9cpmRequest.cardCategory = ConnectApi.CardCategory.CreditCard;
10cpmRequest.cardType = ConnectApi.CardType.Visa.name();
11request.cardPaymentMethod = cpmRequest;
12ConnectApi.PaymentMethodTokenizationResponse response = ConnectApi.Payments.tokenizePaymentMethod(request);