v1

latestOpenAPI 3.0.02026-07-262561105.1 KB
Transactions API

Authorize Transaction

Authorizes a transaction. After a user completes the Affirm checkout flow and returns to the merchant site, the merchant should call the Authorize Transaction endpoint. Authorizing a transaction generates a unique id that will be used as a reference moving forward.

post/transactions

Headers

Idempotency-Keystring

Unique identifier pre-generated by the client and used by the server to recognize successive calls to the same endpoint. This is required for Split Capture and encouraged for single transaction functionality. Note: If a request fails or times out, use the same idempotency key to retry the operation without risk of double-processing. For details, see the Idempotency section on About Split Capture.

Request body

expandstring

A comma-separated set of related objects to expand in the response.

order_idstring

Identifies the order within the merchant's order management system that this transaction corresponds to. It is only returned in the response if included in the request.

reference_idstring

An optional, unique identifier that may be associated with each transaction event and reconciled with the system of record used by the merchant.

transaction_idstring

Required. A unique identifier representing the checkout.

currencystring

Three-letter ISO currency code in uppercase.

totalinteger

The total amount of the checkout in the lowest denomination of the currency.

Example request

{
  "expand": "checkout",
  "order_id": "order_125",
  "reference_id": "202307011027",
  "transaction_id": "1234567890ABCDEF",
  "currency": "USD",
  "total": 1999,
  "shipping": {
    "name": {
      "first": "John",
      "last": "Doe",
      "full": "John Doe"
    },
    "address": {
      "line1": "123 Example Street",
      "line2": "Apt 123",
      "city": "San Francisco",
      "state": "CA",
      "country": "US"
    },
    "email": "test@example.com"
  },
  "items": [
    {
      "item": {
        "display_name": "Awesome Pants",
        "sku": "ABC-123",
        "unit_price": 1999,
        "qty": 3,
        "item_image_url": "http://merchantsite.com/images/awesome-pants.jpg",
        "item_url": "http://merchantsite.com/products/awesome-pants.html"
      }
    }
  ]
}

Response

HTTP 200 OK