Express Checkout API

Overview of the Affirm Express Checkout Shipping & Totals endpoint, including how it returns shipping options, taxes, and final order amounts during the hosted checkout flow.

❗️

Interested in offering Affirm Express Checkout?
Reach out to your Affirm Account Manager to confirm availability and for next steps on building your APIs.

Overview

Affirm Express Checkout relies on one merchant-hosted API endpoint to dynamically complete checkout within the Affirm experience: Shipping & Totals Endpoint. This endpoint enables Affirm to collect customer shipping details, present valid shipping methods, calculate taxes and totals, and return finalized order details to the merchant after loan confirmation.

By offloading address collection and checkout calculation into Affirm’s hosted flow, merchants can reduce front-end checkout complexity while retaining full control over shipping logic, pricing, and tax calculations on the backend.

Shipping & Totals endpoint types

The Shipping & Totals endpoint calculates and returns available shipping options and final order totals based on the customer’s shipping address during checkout.

Request

Headers

HeaderTypeRequiredDescription
X-Affirm-SignaturestringYesUsed to verify that the request is legitimately from Affirm. It contains a timestamp and an HMAC-SHA512 hash of the request body, signed with your Private API Key.
Content-TypestringYesMust be set to application/json as the endpoint accepts and returns JSON payloads.

Body

FieldTypeRequiredDescription
order_idstringYesMerchant identifier to reference the current checkout session. Note you are still expected to give an order_id post-loan confirmation.
currencystringYesThree-letter ISO currency code in uppercase.
shippingShippingBilling.AddressYesShipping Address.
ShippingBilling.Address
FieldTypeRequiredDescription
line1stringYesAddress line 1 (e.g., street, PO Box, or company name).
line2stringNoAddress line 2 (e.g., apartment, suite, unit, or building).
citystringYesCity, district, suburb, town, or village.
statestringYesState, county, province, or region.
zipcodestringYesZIP or postal code.
countrystringYesTwo-letter country code (ISO 3166-1 alpha-2).

HTTP 200 Response

Body

Field

Type

Required

Description

order_id

string

Yes

Merchant identifier to reference the current checkout session. Note you are still expected to give an order_id post-loan confirmation.

currency

string

Yes

Three-letter ISO currency code in uppercase.

subtotal

integer

Yes

Total cost amount of the items in the cart, excluding any taxes or shipping fees, in the minor currency unit of the specified ISO currency code.

Example: 100 cents to charge $1.00

shipping_options

Array<Object> (ShippingOption)

Yes

The available shipping options along with their associated order totals.

ShippingOption

Field

Type

Required

Description

shipping_type

string

Yes

Yes A unique, merchant-generated identifier for the shipping option. This value is used to map the customer’s selection to your internal fulfillment records and must remain persistent throughout the session. Please ensure that each shipping option has its own unique shipping_type value.

Examples:

  • “Shipping_ups_123”,
  • “Shipping_fedex_456”,
  • “instore_pickup_789”.

shipping_label

string

Yes

The shipping method label displayed to the user.

Example: “Standard Shipping (7-10 Days)')”

shipping_amount

integer

Yes

The cost of shipping in the minor currency unit of the specified ISO currency code.

Example: 100 cents to charge $1.00

tax_amount

integer

Yes

The total tax amount in the minor currency unit of the specified ISO currency code.

Example: 100 cents to charge $1.00

total

integer

Yes

The total amount of the checkout in the minor currency unit of the specified ISO currency code.

Example: 100 cents to charge $1.00

HTTP 422 Response

Body

FieldTypeRequiredDescription
errorsArray<Object> (Error)YesAn array of one or more error objects describing why the request could not be processed. Must contain at least one element.

Error

FieldTypeRequiredDescription
error_codeenumYesOne of the predefined Affirm error codes.
messagestringYesA description of the error.
fieldsstring[]NoThe request payload property that caused the error.
error_code Enum
Error codeDescription
UNSUPPORTED_SHIPPING_ZONEUsed when the address is valid but the merchant does not ship to that region (e.g., Hawaii/Alaska).
INVALID_SHIPPING_ADDRESSThe provided address does not exist or is malformed.
ORDER_NOT_FOUNDThe order_id passed in the request does not match an active session or cart in the merchant's system.
CURRENCY_MISMATCHThe merchant's system does not support the currency specified in the request (e.g., merchant only supports CAD but receives USD).
INVENTORY_UNAVAILABLEBetween initiating checkout and calculating totals, items in the items array have gone out of stock.
SHIPPING_METHOD_UNAVAILABLENo valid shipping options can be generated for the requested address (e.g., oversized items to a remote area).
INTERNAL_SERVER_ERRORA catch-all for unexpected merchant-side backend failures or database timeouts during the calculation.