ccrz.ccApiStoredPayment.fetch

Executes a SOQL query of stored payment records, and returns a list of records that match you query.

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

You can still call older versions of the API for this method, which can accept different input keys or return different output keys. Any differences in behavior for older versions aren't documented in this topic.

Note

Signature

global static Map<String, Object> fetch(Map<String, Object>)

Service Layer Classes

Data Service Provider
ccrz.ccServiceStoredPayment

Inputs (Required)

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

ccrz.ccApi.API_VERSION
The version of the B2B Commerce for Visualforce API to reference for the method call. We recommend that you use the ccrz.ccApi.CURRENT_VERSION constant whenever possible, and only reference a specific version for compatibility if necessary.

If this key isn't specified, the method returns a ccrz.ccApi.NoApiVersionException.

Note

Inputs (Optional)

The input map can also include the following keys:

ccrz.ccApi.API_SIZING
Map<String, Object> that specifies options for how the method returns data.

Specific data size requests don't apply to this method. The same fields are always returned for each object, regardless of any specific data size request in your input map.

Note

ccrz.ccApiStoredPayment.ACCOUNTTYPES
List<String> of specific ccrz__AccountType__c values on ccrz__E_StoredPayment__c records to query, such as purchase order (PO), credit card, and so on. For more information about payment types, see https://help.salesforce.com/articleView?id=b2b_commerce_payment_types.htm.

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

ccrz.ccApiStoredPayment.BYASC
Boolean
Value Usage
true Sort the returned stored payment records in ascending order.
false (default) Sort the returned stored payment records in descending order.
ccrz.ccApiStoredPayment.BYUSER
String that specifies the Salesforce ID of a user. This method returns only the ccrz__E_StoredPayment__c records where the ccrz__User__c field references this user ID.

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

ccrz.ccApiStoredPayment.EFFACT
String that specifies the Salesforce ID of an effective account for filtering the query.
ccrz.ccApiStoredPayment.ID
String that specifies the Salesforce ID of the stored payment record to query.
ccrz.ccApiStoredPayment.IDS
Set<String> that specifies the Salesforce IDs of the stored payment records to query.
ccrz.ccApiStoredPayment.ISENABLED
Boolean
Value Usage
true Return only stored payment records where the ccrz__Enabled__c field is true.
false (default) Ignore the value of the ccrz__Enabled__c field.
ccrz.ccApiStoredPayment.ISREADONLY
Boolean
Value Usage
true Return only stored payment records where the ccrz__ReadOnly__c field is true.
false (default) Ignore the value of the ccrz__ReadOnly__c field.

This input is available only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12).

Note

ccrz.ccApiStoredPayment.STOREFRONT
String that specifies the name of a storefront for filtering the query.

If the input data doesn't include this key, the method falls back to ccrz.cc_CallContext.storefront.

Note

Outputs

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

ccrz.ccApi.API_VERSION
Integer that indicates which API version was used for the query.
ccrz.ccApi.SUCCESS
Boolean
Value Usage
true The call completed.
false The call encountered errors.

B2B Commerce for Visualforce doesn't always return an exception for any errors that can occur. When this value is false, consider rolling back the API transaction to a previous savepoint.

Tip

ccrz.ccApiStoredPayment.STOREDPAYMENTLIST
List<Map<String, Object>>, where each Map<String, Object> represents a ccrz__E_StoredPayment__c record.

Each stored payment record in the return data includes the same set of fields, regardless of any specific ccrz.ccApi.SIZING input data size request.

Note

ccrz.ccApiSubscription.SUBSCRIPTIONS
List<Map<String, Object>>, where each Map<String, Object> represents a ccrz__E_Subscription__c record associated with a returned ccrz__E_StoredPayment__c record.

This output is returned only in B2B Commerce for Visualforce Winter ’21 (managed package version 4.13 and API version 12), and only when the input data specifies ccrz.ccApi.SZ_ASSOC => true:

ccrz.ccApi.SIZING => new Map<String, Object>{
    ccrz.ccApiStoredPayment.ENTITYNAME => new Map<String, Object>{
        ccrz.ccApi.SZ_ASSOC => true
    }
}

Note

Example

Fetch stored payment records by ID, and capture the first result's method of payment.

Map<String, Object> storedPaymentQuery = new Map<String, Object>{
    ccrz.ccApi.API_VERSION => ccrz.ccApi.CURRENT_VERSION,
    ccrz.ccApiStoredPayment.IDS => new Set<String>{'stored_payment_ID_1', 'stored_payment_ID_2'}
};

try {
    Map<String, Object> storedPaymentResults = ccrz.ccApiStoredPayment.fetch(storedPaymentQuery);
    if (storedPaymentResults.get(ccrz.ccApiStoredPayment.STOREDPAYMENTLIST) != null) {
        List<Map<String, Object>> outputPaymentsList = (List<Map<String, Object>>) storedPaymentResults.get(ccrz.ccApiStoredPayment.STOREDPAYMENTLIST);
        String paymentTypes = (String) outputPaymentsList[0].get('accountType');
    }
} catch (Exception e) {
    // Error handling...
}