## Overview

This guide describes how to add the Affirm Telesales Add-on module for Magento 2. The module allows your phone representatives and administrators to provide Affirm as a payment option when creating orders in Magento. When they create an order using the Telesales option, Affirm sends the customer a link via email and SMS to begin their loan application process.

**Before you begin**

Before adding the module, [you should have already installed and configured Affirm for Magento 2](🔗).

[Click here to review the Magento 2 Telesales module release notes](🔗).

**Sandbox development**

Develop and test the Affirm integration in your development environment connected to our sandbox. To use our sandbox, retrieve your sandbox API keys at <https://sandbox.affirm.com/dashboard/#/apikeys> for use during integration.

Note that we only send SMS messages with the checkout link from the Affirm Live environment. During Sandbox environment testing, use email messages for the checkout link.

After development and testing, you'll need to update your integration to use your live API keys, which you can find at <https://affirm.com/dashboard/#/apikeys>.

## 1. Install the M2 Telesales module

[Download the Magento Telesales Add-on module here](🔗)

### Install using Composer

1\. Go to **MAGENTO_ROOT** and run the following command:



2\. Update the module by running the following commands:





## 2. Configure the M2 Telesales module

After installing the Magento 2 Telesales module, enable it by updating Magento 2 configurations:

1\. Sign in to your Magento 2 admin portal. 2\. Go to **Stores > Configuration > Sales > Payment Methods > Affirm > Affirm Telesales Extension**. 3\. Set **Enabled** to **Yes**. 4\. Under Affirm, keep **Mode** set to **Sandbox** (for development and testing) and make sure the rest of the settings are configured, such as the **Public API** Key and **Private API Key** you retrieved from the Affirm sandbox merchant dashboard. 5\. If your checkout process automatically captures the charge, set **Payment Action** to **Authorize and Capture**.






## 3. Test the M2 Telesales module

We only send SMS messages with the checkout link from the Affirm Live environment. During Sandbox environment testing, use email messages for the checkout link.

1\. In your order management system, create an order. 2\. Enter a valid U.S. address and mobile phone number (Affirm won't work with a fake address or phone number). 3\. Select **Affirm** as the payment option.



4\. Click **Submit Order** to place it in a pending state. 5\. Under **Payment Information**, click **Send Affirm Checkout Link** button.



6\. Find the email with the checkout link and click it. 7\. If you have an existing account, click **Sign In**. 8\. 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

9\. Enter **1234** for the verification code and click **VERIFY CODE**. 10\. Complete checkout flow and click **CONFIRM LOAN**. 11\. Verify that the order is processed or complete in your order management dashboard. 12\. Verify that the transaction appears in your platform's admin panel and on [sandbox.affirm.com/dashboard](🔗).




## 4. Go live

### Step 1: Sandbox development

Before going live with your Affirm integration, we suggest testing in in your development environment connected to our sandbox. To use our sandbox, retrieve your sandbox API keys at <https://sandbox.affirm.com/dashboard/#/apikeys> for use during integration.

After development and testing, you'll need to update your integration to use your live API keys, which you can find at <https://affirm.com/dashboard/#/apikeys>.

### Step 3: Connect to the live Affirm environment

1\. Retrieve your live API keys at <https://affirm.com/dashboard/#/apikeys>. 2\. In the Magento 2 admin panel, go to **Stores > Configuration > Sales > Payment Methods > Affirm**. 3\. Set **Mode** to **Production**. 4\. Enter the **Public API Key** and **Secret Key** (private key) you just retrieved from the Affirm merchant dashboard.

### Step 3: Go live!

After you've connected to our live environment and we've tested your integration, you're ready to go live and offer Affirm as a payment option to your customers.




## FAQ & other known issues

1\. How to solve compatibility issues with Magento 2.2.x Magento 2.2.x version or lower will need to have the following functions replaced: `addCommentToStatusHistory` --> `addStatusHistoryComment`



Changes related to CsrfAwareActionInterface will need to be removed: `class Confirm extends Action implements CsrfAwareActionInterface` --> `class Confirm extends Action`



2\. How to solve blank admin error page issue when installing under `MAGENTO_ROOT/app/code/` Magento 2.2.x:



Magento 2.3.x: