Configure Affirm

This guide walks you through configuring Affirm at checkout in Cybersource.

Configure Affirm

1. Get your merchant ID

Integrating Affirm into CyberSource requires a merchant ID, which is the same ID value you will use for the sandbox and live environments.

1. Inform Affirm that you'd like to integrate with CyberSource.
2. Get your Affirm merchant ID from your Client Success Manager.
3. Provide your merchant ID to your CyberSource contact.


2. Build your integration using CyberSource APIs

Follow the CyberSource Affirm Services integration guide to build your checkout and order management integration:


Initiate Checkout

When you initiate checkout using the Sessions service, you'll receive a checkout URL (merchantURL) in the Sessions Reply. Redirect the client browser to that checkout URL (merchantURL) using a client-side scripting language, such as JavaScript. After being redirected to Affirm, the customer will complete their loan application. After confirming the loan, the customer will then be redirected back to a success_url value sent in the Sessions service. You will also receive the checkout_token at this URL. (See FAQ section for initiating Affirm checkout in a modal)


Parse checkout_token

The checkout_token is included in the request (via GET method) when the client is redirected back to your site (to the success_url) after confirming their Affirm loan. Use this checkout_token as preapprovalToken in the CyberSource authorization service.


Authorize

Like a card transaction, the authorization will hold the funds and allow you to save the customer's order. The authorization response returns another transaction id to use in subsequent actions (capture, refund, etc.).


Capture

Once you've fulfilled an order, capture the associated Affirm payment. Capturing a payment completes the transaction and initiates settlement into your bank account. Captures should occur within 30 days of the authorization. Affirm does not support multiple or partial capture requests. We recommend capturing the whole amount when shipping the first item, and refunding if the customer cancels the remaining items.


Refund

If you need to refund all or part of a transaction, you can use the Refund service. You can process any number of refunds, which can only be processed within 120 days of capturing the charge. A full refund cancels the transaction, which will refund the entire loan principal to the customer.


Did this page help you?