# Before You Start

> Authorize now and capture at shipment for pre-orders.

Source: https://help.boltapp.com/api-reference/guides/delayed-capture

This guide enables merchants using our [custom cart](/custom-cart/overview) package to implement a delayed capture process. This process can be used to support backorders, pre-orders, or systems that purposefully wait to capture transactions until the time of shipment.

This process involves referencing and voiding the initial `pending` transaction (or allowing it to expire), then replacing it with a new authorization to complete the transaction at the later desired date and time.

Reach out to Bolt Support to let them know you plan to implement delayed capture and to request that Auto Capture be disabled for your account.

## Step 1: Store Transaction Reference [#step-1-store-transaction-reference]

<Tip>
  Card authorizations have a lifespan of 7-14 days depending on the payment services provider. To acquire a valid authorization that can be captured, it may be necessary to request a new authorization over the lifetime of an uncaptured transaction.
</Tip>

After you receive a `pending` transaction request, store the transaction reference at `data.source_transaction.reference` using the [Transaction Webhooks endpoint](/api-reference/merchant-callback-reference/webhooks/transactionwebhooks).

```json title="Webhook payload"
"type": "pending",
"object": "transaction",
"data": {
  "id": "T1c3p4yBuVYJ9",
  ...
  "source_transaction": {
    "id": "T1c3p4yBuVYJ9",
    "type": "cc_payment",
    "processor": "adyen_gateway",
    "date": 1615407159447,
    "reference": "LBLJ-TWW7-R9VC",
    ...
  }
  ...
}
```

## Step 2: Retrieve Transaction Details [#step-2-retrieve-transaction-details]

Use the transaction `reference` retrieved in [Step 1](#step-1-store-transaction-reference) to [retrieve Transaction Details](https://help.boltapp.com/api-bolt/#tag/Transactions/operation/transaction-details).

Then, use the retrieved `from_credit_card.id` and `from_consumer.id` values (found in the [Transaction Details](https://help.boltapp.com/api-bolt/#tag/Transactions/operation/transaction-details) response) for use in the new auth request.

## Step 3: Void Prior Transaction [#step-3-void-prior-transaction]

If it has not already expired, void the initial transaction by using its transaction `reference` with the [Void a Transaction](https://help.boltapp.com/api-bolt/#tag/Transactions/operation/void) endpoint.

## Step 4: Generate a New Authorization [#step-4-generate-a-new-authorization]

Generate a new authorization using the [Authorize a Card](https://help.boltapp.com/api-bolt/#tag/Transactions/operation/MerchantAuthorize) endpoint’s `merchant_credit_card_authorization_recharge` functionality. Be sure to include the `consumer_id` and `credit_card_id` acquired from the initial transaction.

Store the new transaction reference found at `transaction.reference` for use in [Step 6](#step-6-capture-the-transaction).

```json title="Request body"
{
    "auto_capture": false,
    "cart": {
      "items": [
        {
          "description": "Large tote with Bolt logo.",
          "quantity": 1,
          "reference": "item_100",
          "sku": "BOLT-SKU_100",
          "unit_price": 1000,
          "name": "Bolt Tote Bag"
        }
      ],
      "tax_amount": 0,
      "total_amount": 1000,
      "currency": "USD",
      "display_id": "Order #100100",
      "order_reference": "100100"
    },
    "consumer_id": "CA9oXWDogFPbb",
    "credit_card_id": "CAbw1xCK6Zeci",
    "source": "direct_payments",
    "user_identifier": {
      "email": "dev+test-merchant@boltapp.com",
      "phone": "5555555555"
    },
    "user_identity": {
      "first_name": "John",
      "last_name": "Doe"
    }
  }
```

## Step 5: (Optional) Maintain Active Authorization [#step-5-optional-maintain-active-authorization]

To guarantee funds will be available for the new transaction, maintain an active authorization until ready to capture.

Repeat Steps 2-4 at regular intervals according to your payment services provider's authorization timeout window over the lifetime of the uncaptured transaction until you are ready to capture funds.

## Step 6: Capture the Transaction [#step-6-capture-the-transaction]

Once you are ready to capture funds, use the [Capture a Transaction endpoint](https://help.boltapp.com/api-bolt/#tag/Transactions/operation/CaptureTransaction) to capture using the new `transaction_reference`.

You should have acquired the correct value for `transaction_reference` from the [Authorize a Card endpoint](https://help.boltapp.com/api-bolt/#tag/Transactions/operation/MerchantAuthorize) as instructed in [Step 4](#step-4-generate-a-new-authorization).

```json title="Request body"
{
  "amount": 754,
  "currency": "USD",
  "skip_hook_notification": false,
  "transaction_reference": "LBLJ-TWW7-R9VC"
}
```
