Skip to main content

Get Started with Affirm


Follow these steps to create a session to process a payment. The session establishes the Affirm pre-approval token that you use to request an authorization.

Send the session request

Send a POST request to the test endpoint and include these required fields:

POST /pts/v2/payment-references
merchantInformation.cancelUrl
merchantInformation.failureUrl
merchantInformation.successUrl
orderInformation.amountDetails.currency
orderInformation.billTo.address1
orderInformation.billTo.administrativeArea
orderInformation.billTo.country
orderInformation.billTo.firstName
orderInformation.billTo.lastName
orderInformation.billTo.locality
orderInformation.billTo.postalCode
orderInformation.lineItems[].productName
orderInformation.lineItems[].productSku
orderInformation.lineItems[].totalAmount
orderInformation.lineItems[].unitPrice
orderInformation.shipTo.address1
orderInformation.shipTo.administrativeArea
orderInformation.shipTo.country
orderInformation.shipTo.firstName
orderInformation.shipTo.lastName
orderInformation.shipTo.locality
orderInformation.shipTo.postalCode
paymentInformation.paymentType.method.name

Set to AFFIRM.

paymentInformation.paymentType.name

Set to INVOICE.

processingInformation.actionList

Set to AP_SESSIONS.

Include any optional fields

Include any optional fields in the request:

orderInformation.amountDetails.taxAmount

recommends including this field in your request.

orderInformation.lineItems[].productCode

For a list of possible values, see Affirm product codes.

orderInformation.lineItems[].quantity

Redirect the customer to Affirm

Redirect the customer to the Affirm URL that you received in the processorInformation.paymentUrl response field.

"processorInformation": {    "paymentUrl": "https://sandbox.affirm.com/products/checkout?public_api_key=example-of-key-public-value"}

Customer completes checkout

When the customer completes the checkout using Affirm, the customer is redirected to the merchant website based on the URL that you included in the merchantInformation.successUrl request field.

Save the pre-approval token

Save the pre-approval token that you received in the processorInformation.token field from the session response. You will need it to request an authorization.

"processorInformation": {    "token": "7TCQD02QPNEP0J27"}

What's Next

After you save the pre-approval token, use it to request an authorization. For request details and code examples, see Creating a Session and the Affirm endpoints.

Last published: September 29, 2026