---
updatedAt: 2026-02-20T16:48:44.000Z
agentTools:
  siteIndex: https://docs.affirm.com/llms.txt
  projectIndex: https://docs.affirm.com/developers/llms.txt
---

# Authorize and Capture Transactions

Learn how Affirm's authorization and capture process works. Authorize a transaction to reserve funds and generate a unique ID, then capture it to settle the funds and complete payment. Supports both full and partial captures.

<HTMLBlock>{`
<style>
  .dropdown-menu {
    font-family: Arial, sans-serif;
    max-width: 250px;
    margin-left: auto; /* Align to the right */
  	margin-right: 0; /* Ensure it's flush to the right */
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: #4A4AF4;
    overflow: hidden; /* Ensure the container grows with content */
  }

  .dropdown-item {
    margin-bottom: 10px;
  }

  .dropdown-toggle {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
  }

  .dropdown-toggle:hover {
    background: #f0f0f0;
  }

  .dropdown-content {
    display: none;
    margin-top: 5px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
  }

  .dropdown-item.open .dropdown-content {
    display: block;
  }

  .flag-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
  }

  .product-item {
    margin-bottom: 5px;
  }

  .product-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
  }
  
  .country-title {
    font-family: Arial, sans-serif;
    font-size:20px;
    text-align: center;
    font-weight: bold;
    color: #ffffff;
  } 

</style>
  <div class="dropdown-menu">
    <p class="country-title" alt="Countries where this product is available">Country Availability</p>

    <div class="dropdown-item">
      <button class="dropdown-toggle" onclick="toggleDropdown(event)" alt="Drop down menu displaying the available countries for this product">
        <b>Country List</b> ⬇️
      </button>
      <div class="dropdown-content">
        <div class="product-item">
          <img src="https://files.readme.io/a4c8b3d6596d943e2b93c82cb1d432a2edaf6998667835c2e97ef4a31d460c7e-us-circle-01.png" alt="USA" class="flag-icon">
          USA
        </div>
        <div class="product-item">
          <img src="https://files.readme.io/3ca294a1b4b8b8506c3ff32876abc6e3e33d0e65a509dab81398915094bdbc5c-61TcZ33ZrJL._AC_UY1000_.jpg" alt="Canada" class="flag-icon">
          Canada
        </div>
        <div class="product-item">
          <img src="https://files.readme.io/db98461fef617df7c9970e98f01150f067fcee1fc823a450f09056138b9f70be-united-kingdom-flag-rounded-icon-uk-flag-union-jack-vector.jpg" alt="UK" class="flag-icon">
          UK
        </div>
      </div>
    </div>

  </div>
`}</HTMLBlock>

## Authorize Transaction

Authorizing a transaction occurs after a user successfully completes the Affirm checkout flow and returns to the merchant site. The <Anchor label="Authorize Transaction" target="_blank" href="https://docs.affirm.com/developers/reference/authorize_transaction">Authorize Transaction</Anchor> endpoint creates a loan and reserves the funds. You must authorize a transaction before capturing it.

When you authorize a transaction, Affirm generates a unique `id` that you can use to reference the loan moving forward.

<Image align="center" alt="Diagram showcasing the authorize and capture flow." caption="This represents the authorize and capture flow." title="Authorization_& Capture flow_Isoflow_Diagram_7_8_2021.png" src="https://files.readme.io/fb07311-Authorization__Capture_flow_Isoflow_Diagram_7_8_2021.png" width="smart" />

<Callout icon="❗️" theme="error">
  If you don’t authorize a transaction, the transaction isn’t considered active. This means the user can’t see the loan and you can’t capture the funds. For this reason, you should authorize the loan as soon as you receive a `checkout_token`.
</Callout>

To authorize a transaction, you need the `checkout_token` returned from your [Checkout Integration](https://docs.affirm.com/payments/docs/transactions-web) to pass it into the `transaction_id` parameter.

```curl
curl https://sandbox.affirm.com/api/v1/transactions
     -X POST
     -u "{public_api_key}:{private_api_key}"
     -H "Content-Type: application/json"
     -d '{"transaction_id": "{checkout_token}","order_id": "{order_id}"}'
```
```php
$endpoint = "https://sandbox.affirm.com/api/v1/transactions";
$data = '{"transaction_id": "' . $_POST["transactions_id"] . '"}';
try {
 $response = callAffirm($endpoint, $data);
 // Handle the response
} catch (Exception $e) {
 // Handle the exception
}
```
```csharp
using(var httpClient = new HttpClient()) {
	using(var request = new HttpRequestMessage(new HttpMethod("POST"), "https://sandbox.affirm.com/api/v1/transactions")) {
		var base64authorization = Convert.ToBase64String(Encoding.ASCII.GetBytes("<public_api_key>:<private_api_key>"));
		request.Headers.TryAddWithoutValidation("Authorization", $ "Basic {base64authorization}");
		request.Content = new StringContent("{\"transaction_id\":\"<checkout_token>\"}");
		request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
		var response = await httpClient.SendAsync(request);
		HttpContent responseContent = response.Content;
		using(var reader = new StreamReader(await responseContent.ReadAsStreamAsync())) {
			Console.WriteLine(await reader.ReadToEndAsync());
		}
		Console.ReadKey();
	}
}
```

You should receive a response that contains a unique ID ("AMLC-5X0W" in this example).

```json
{
    "status": "authorized",
    "amount_refunded": 0,
    "provider_id": 1,
    "created": "2021-06-23T23:25:55Z",
    "order_id": "ABC123",
    "checkout_id": "7WYDR0M83CGE47GJ",
    "currency": "USD",
    "amount": 49999,
    "events": [
        {
            "currency": "USD",
            "amount": 49999,
            "type": "auth",
            "id": "7WYDR0M83CGE47GJ",
            "created": "2021-06-23T23:26:28Z"
        }
    ],
    "remove_tax": false,
    "authorization_expiration": "2021-07-23T23:26:28Z",
    "id": "AMLC-5X0W"
}
```

After successfully authorizing a transaction and receiving the response object, your site should do the following:

* Validate that the authorized amount equals the order total
* Store the `id` (transaction identifier).
* Mark the order payment as pending.

If the authorization fails, your site could potentially store this checkout attempt, as it is **not** required on our end.

> 📘 Authorization Guidelines
>
> Authorize each Affirm loan only once for the full amount of the transaction being purchased. If you have a specific use case where this may be difficult, please contact us at <merchanthelp@affirm.com> or use the support widget at the bottom of the page.

## Capture a Transaction

After an order is fulfilled, you must send a [Capture Transaction](https://docs.affirm.com/developers/reference/capture_transaction) request to Affirm in order to capture or settle the funds. Perform this activity from your secure back-end systems. To capture an authorized transaction, you need the `id` provided in the `Authorization` API response.  There are no required fields that need to be stored from the `Capture` response.

Capturing the funds is similar to capturing a credit card transaction. After you capture the loan, the following happens:

* Affirm notifies the customer that the loan has been captured and that their first payment is due to Affirm in 30 days (for monthly installments) or 2 weeks (for Pay in 4), or any other payment timeline.
* Affirm pays the merchant within 2-3 business days via ACH transfer to the provided bank account.

```curl
curl https://sandbox.affirm.com/api/v1/transactions/{id}/capture
     -X POST
     -u {public_api_key}:{private_api_key}"
     -H "Content-Type: application/json"
     -d '{"order_id": "{order_id}", "shipping_carrier": "USPS", "shipping_confirmation": "1Z23223", "amount":49999}'
```
```php
$endpoint = "https://sandbox.affirm.com/api/v1/transactions";
$url = $endpoint . "/" . $_GET["id"] . "/capture";
$data = '';
try {
 $response = callAffirm($url, $data);
// Handle the response
} catch (Exception $e) {
 // Handle the exception
```

> 📘 Partial Capture
>
> You can perform a partial capture by specifying a value in cents within the `amount` parameter.\
> The cumulative sum of partial capture amounts can't exceed the originally authorized total.

You then receive a response with the confirmation.

```json
{
    "fee": 1500,
    "created": "2021-06-23T23:27:13Z",
    "order_id": "ABC123",
    "currency": "USD",
    "amount": 49999,
    "reference_id": "6789",
    "type": "capture",
    "id": "7WYDR0M83CGE47GJ"
}
```

# Sibling pages

* [Transaction States](https://docs.affirm.com/developers/docs/transaction-states.md)
* [Read, Void, Refund, and Update Transactions](https://docs.affirm.com/developers/docs/read-void-refund-and-update-transactions.md)
* [Manage Split Capture Transactions](https://docs.affirm.com/developers/docs/split-capture-transactions.md)