Existing integrations

Learn how to modify your existing integration to implement Affirm Connect.

This guide walks you through updating your existing integration to offer lease-to-own payment options for your customers. You only need to make the following modifications to the existing checkout object


1. Modify the checkout object

Set the exchange_lease_enabled field

Set the exchange_lease_enabled field to true on the Merchant object.

Set the leasable field

Set a leasable field for each Item object within the items array. Set the value to false if the merchandise cannot be leased (e.g. gift cards, warranties), and true if it is eligible to be leased.

Check the discount object

Check that all discounts are being added to the discount object, the Katapult checkout will not be triggered if the line item totals do not match the order total.

affirm.checkout.open({
      "merchant": {
        "user_confirmation_url":    "https://merchantsite.com/confirm",
        "user_cancel_url":          "https://merchantsite.com/cancel",
        "user_confirmation_url_action": "POST",
        "name": "Your Customer-Facing Merchant Name",
        "exchange_lease_enabled": true, 
      },
      "shipping":{
        "name":{
          "first":"Joe",
          "last":"Doe"
        },
        "address":{
          "line1":"633 Folsom St",
          "line2":"Floor 7",
          "city":"San Francisco",
          "state":"CA",
          "zipcode":"94107",
          "country":"USA"
        },
        "phone_number": "4153334567",
        "email": "[email protected]"
      },
      "billing":{
        "name":{
          "first":"Joe",
          "last":"Doe"
        },
        "address":{
          "line1":"633 Folsom St",
          "line2":"Floor 7",
          "city":"San Francisco",
          "state":"CA",
          "zipcode":"94107",
          "country":"USA"
        },
        "phone_number": "4153334567",
        "email": "[email protected]"
      },
      "items": [{
        "display_name":         "Awesome Pants",
        "unit_price":           1999,
        "qty":                  3,
        "item_image_url":       "http://merchantsite.com/images/awesome-pants.jpg",
        "item_url":             "http://merchantsite.com/products/awesome-pants.html",
        "leasable": true,
         "qty": 1,
         "sku": "ABC-123",
         "unit_price": 1999
        ]
      }
   ],
      "discounts":{
         "RETURN5":{
            "discount_amount":500,
            "discount_display_name":"Returning customer 5% discount"
        },
        "PRESDAY10":{
            "discount_amount":1000,
            "discount_display_name":"President's Day 10% off"
      }
   },
   "metadata":{
      "shipping_type":"UPS Ground",
   },
   "order_id":"JKLMO4321",
   "currency":"USD",  
   "financing_program":"flyus_3z6r12r",
   "shipping_amount":1000,
   "tax_amount":500,
   "total":100000
})

2. Use the Transactions API

You'll need to update the Direct API integration using the Charges API v2 for processing financed to use the Transaction API in order to process both loans and leases.


3. Test your integration

How to test the Affirm flow

📘

When testing the checkout process, enter 1234 as your verification code as we don't send text messages from our sandbox.

While developing and testing in our sandbox, step through the checkout process in your browser to trigger the HTTP request with the checkout token.

Follow these steps to receive the checkout token:

  1. Initiate checkout to access the Affirm account creation screen.
  2. If you have an existing account, click Sign In.
  3. If you don't have an existing account, create one with the following:
    • Any first and last name
    • An email address with a valid format
    • A valid US cell phone number (you do not need access to this number) that you will use in all subsequent checkout attempts
    • A birth date older than 18 years old
    • Any four digits
  4. Enter **1234** for the verification code and click VERIFY CODE.
  5. Complete checkout flow and click CONFIRM LOAN.
  6. Click next to confirm Loan Schedule.

How to test the Katapult flow

  1. Initiate checkout to access the Affirm account creation screen.
  2. If you have an existing account, click Sign In.
  3. If you don't have an existing account, create one with the following:
    • Any first and last name
    • An email address with a valid format
    • A birth date: Use the date 12/01/1981 to trigger an Affirm decline and handoff to Katapult's pre-approval. Note that another other birthdate above the age of 18 will trigger an Affirm approval.
    • Social security : Any four digits
  4. Enter **1234** for the verification code and click VERIFY CODE.
  5. Select Check out with Katapult.
  6. Click next to confirm Loan Schedule.
  7. Katapult Payment information:
    • Card Number: 4111 1111 1111 1111
    • Expiration: future date
    • CVV: 3 digit number
Katapult flow

🚧

Important

  • To successfully test Katapult flow in Affirm's sandbox environment, enter a new identity (name, phone number, address, etc.) every time you go through the checkout flow.
  • If you get declined once, you may continue to get Katapult declined due to browser cookie caching. We recommend clearing your browser cookies / cache (or use Incognito browser window) before each test.

How to test the Snap flow

  1. Enter any valid US Number.
  2. Use 1234 for the PIN.
  3. Enter a name and email address.
  4. Use 07-07-1977 as the birth date.
  5. Enter any 4 digits for the SSN.
  6. Enter an income less than $100,000.
  7. Enter any payment dates.
  8. Enter any 9 digits for the routing number, except do not use 0 as the final number.
  9. Enter any 6-10 digits for the bank account number.
  10. Review the lease and proceed to the order confirmation page.
Snap flow

Related topics
Did this page help you?