---
schema_version: "1"
id: 87273f52a4439726486a279f176c1cadd051d9567b35fc306e44ace7072feccd
title: CaptureRequest Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_commercepayments_CaptureRequest.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 97fc831892ebda7493b6ff3ccb1842bee1beccdcd6316a8a11d73f5d3b585371
description: Represents a capture request. This class extends the BaseRequest class and inherits all its methods.This constructor is intended for test usage and throws an exception if used outside of the Apex test context.Account ID value. References an account record.Amount of currency that needs to be captured.ID value that references a PaymentAuthorization.
---
# CaptureRequest Class

Represents a capture request. This class extends the BaseRequest class and inherits all its methods.

## Namespace

[CommercePayments](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_commercepayments.htm "Use the CommercePayments namespace to provide a safe and customizable platform for managing customer payments and refunds.")

## Usage

The CaptureRequest class’s buildCaptureRequest method creates a CaptureRequest object to store payment information, such as value and currency, as JSON strings.

## Example

Builds a CaptureRequest object for a multicurrency org.

    private String buildCaptureRequest(commercepayments.CaptureRequest captureRequest) {
        Boolean IS\_MULTICURRENCY\_ORG = UserInfo.isMultiCurrencyOrganization();
        QueryUtils qBuilderForAuth = new QueryUtils(PaymentAuthorization.SObjectType);
        // Add required fields
        qBuilderForAuth.getSelectClause().addField('GatewayRefNumber', false);
        if (IS\_MULTICURRENCY\_ORG) {
            // addField also takes a boolean to enable translation (uses label instead of actual value)
            qBuilderForAuth.getSelectClause().addField('CurrencyIsoCode', false);
        }

- **[CaptureRequest Constructors](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm#apex_commerce_payments_CaptureRequest_constructors)**
- **[CaptureRequest Properties](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm#apex_commerce_payments_CaptureRequest_properties)**

## CaptureRequest Constructors

The following are constructors for CaptureRequest.

- **[CaptureRequest(amount, authorizationId)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm#apex_commerce_payments_CaptureRequest_ctor)**  
    This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

### CaptureRequest(amount, authorizationId)

This constructor is intended for test usage and throws an exception if used outside of the Apex test context.

#### Parameters

- **amount**:
    
    Type: [Double](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_double.htm#apex_methods_system_double "Contains methods for the Double primitive data type.")
    
    The amount to be debited or captured.
- **authorizationId**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Represents
    
    a payment authorization record.

## CaptureRequest Properties

The following are properties for CaptureRequest.

- **[accountId](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm#apex_commerce_payments_CaptureRequest_accountId)**  
    Account ID value. References an account record.
- **[amount](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm#apex_commerce_payments_CaptureRequest_amount)**  
    Amount of currency that needs to be captured.
- **[paymentAuthorizationId](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_commercepayments_CaptureRequest.htm#apex_commerce_payments_CaptureRequest_paymentAuthorizationId)**  
    ID value that references a PaymentAuthorization.

### accountId

Account ID value. References an account record.

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### amount

Amount of currency that needs to be captured.

#### Property Value

Type: [Double](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_double.htm#apex_methods_system_double "Contains methods for the Double primitive data type.")

### paymentAuthorizationId

ID value that references a PaymentAuthorization.

#### Property Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")