Sessions
To begin processing a payment, send a create session request. Creating a session enables your customer to checkout using their Affirm account. When sending a session request, you must include the information for each good or service being purchased using the line item array fields. For more information about how to include line items in your request, see Line Items.
A successful request is indicated by an Affirm redirect URL and a pre-approval token in the response message. Send your customer to the redirect URL in order for the customer to apply for credit from Affirm and complete the purchase. Save the pre-approval token and include it in the authorization request to link the session to the authorization.
See Affirm API Endpoints.
Endpoint
POST /pts/v2/payment-references
POST /pts/v2/payment-references
Line Items
Line item fields include information about a purchase, such as product name, quantity, and price.
Line items are represented as the lineItems[] array. An array is a data structure used to send multiple values in a single field, which are enclosed in square brackets.
Example: Including Line Items
This example shows three valid line items.
{ "orderInformation": { "lineItems": [ { "productSku": "shirt$bluegreen", "productName": "Blue shirt", "quantity": "2", "unitPrice": "75.00", "totalAmount": "150.00" }, { "productSku": "pant$black", "productName": "Black pant", "quantity": "1", "unitPrice": "50.00", "totalAmount": "50.00" }, { "productSku": "dress$orange", "productName": "Orange dress", "quantity": "3", "unitPrice": "30.00", "totalAmount": "90.00" } ] }}You must include these line item fields for each purchase:
| Field |
|---|
orderInformation.lineItems[].productName |
orderInformation.lineItems[].productSku |
orderInformation.lineItems[].totalAmount |
orderInformation.lineItems[].unitPrice |
Create a Session
{ "orderInformation": { "billTo": { "firstName": "John", "lastName": "Smith", "address1": "Happy", "locality": "Austin", "administrativeArea": "TX", "postalCode": "78757", "country": "US" }, "shipTo": { "firstName": "John", "lastName": "Smith", "address1": "Happy", "locality": "Austin", "administrativeArea": "TX", "postalCode": "78757", "country": "US" }, "amountDetails": { "currency": "USD" }, "lineItems": [ { "productSku": "shirt$bluegreen", "productName": "Blue shirt", "quantity": "2", "unitPrice": "75.00", "totalAmount": "154.50" } ] }, "paymentInformation": { "paymentType": { "name": "INVOICE", "method": { "name": "AFFIRM" } } }, "processingInformation": { "actionList": "AP_SESSIONS" }, "merchantInformation": { "cancelUrl": "https://www.merchant.redirect.url.from.request.html?actioncancel", "successUrl": "https://www.merchant.redirect.url.from.request.html?actionsuccess", "failureUrl": "https://www.merchant.redirect.url.from.request.html?actionfail" }}{ "_links": { "self": { "method": "POST", "href": "/pts/v2/payment-references" }, "updateSession": { "method": "PATCH", "href": "/pts/v2/payment-references/7297988359016005403955" }, "status": { "method": "POST", "href": "/pts/v2/refresh-payment-status/7297988359016005403955" }, "order": { "method": "POST", "href": "/pts/v2/payment-references/7297988359016005403955/intents" } }, "clientReferenceInformation": { "code": "1729798836037" }, "id": "7297988359016005403955", "orderInformation": { "amountDetails": { "totalAmount": "150.00", "currency": "USD" } }, "processorInformation": { "responseDetails": "00000", "paymentUrl": "https://sandbox.affirm.com/products/checkout?public_api_key=example-of-key-public-value", "responseCode": "00000", "token": "7TCQD02QPNEP0J27" }, "reconciliationId": "XFZ552N8IYKV", "status": "COMPLETED", "submitTimeUtc": "2024-10-24T19:40:36Z"}Response Statuses
responds with one of these statuses in the status response field.
COMPLETED: The session is created. When the customer completes the payment using the Affirm redirect URL, you can send an authorization request.FAILED: The session request is not successful. Send a new session request.
also provides a reconciliation ID for tracking and reporting purposes in the reconciliationId response field.
Thanks for your feedback!
Last published: September 29, 2026