Skip to main content

Merchant Help

 

Affirm Merchant Help

Magento 2 Integration

Overview

This document describes how to install and configure the Magento 2 integration for Affirm. The extension only works with USD base dollar currency, and for shipping/billing country addresses within the US. There are three major functionalities offered with the Affirm extension:

  • Affirm as payment method
  • Affirm promotional messaging
  • Order management

Install the Magento 2 extension

Install using Composer

1. In the Magento root directory,  enter the following commands using command line:

composer config repositories.magento composer https://packagist.org/
composer require affirm/magento2
composer update
php bin/magento setup:upgrade
php bin/magento setup:di:compile

Note: To get the authentication keys for repo.magento.com, refer these instructions - Get your authentication keys

2. Once done, clear your Magento 2 cache to ensure the default Magento 2 Affirm configuration options are set properly

Install using Command Line

1. Download the extension from here

2. Move the extension files to "Magento2_root/app/code/Astound/Affirm/" (You may need to create the Astound/Affirm directory)

3. In Magento2 root directory, run the following command to check if "Astound_Affirm" exists in "List of disabled modules":

php bin/magento module:status

4. In the Magento2 root directory, run the following commands:

php bin/magento module:enable Astound_Affirm
php bin/magento setup:upgrade

5. Once done, clear your Magento 2 cache to ensure the default Magento 2 Affirm configuration options are set properly

Note: If you are upgrading the extension, follow the same installation steps. Latest extension will be retrieved from packagist.org. Installation using Composer is the preferred method of extension installation.


Retrieve keys

  1. Sign in to https://sandbox.affirm.com/dashboard
  2. Retrieve API keys
    1. Hover over the profile icon area at the lower-left of the page.
      Screen Shot 2016-03-22 at 7.56.58 AM-2.png
    2. Click the API Keys link that appears.
      Screen Shot 2016-03-22 at 7.56.20 AM.png
    3. Copy the public, private, and financial product keys.

Note: If you are integrating Affirm into Shopify, ignore the financial product key and additional URLs. They are not relevant for Shopify integrations.


Configure Affirm as a payment method

Once you've installed the Affirm extension, log in to your Magento 2 admin panel and browse to Stores > Configuration > Sales > Payment Methods > Affirm to open the Affirm configuration profile. Affirm can be enabled as a payment method by updating the following configurations:

  1. Enabled: By default, payment method is disabled. Once you get the configuration settings completely filled in, activate the payment method. The Action should be set to "Yes".
  2. Mode: By default, "Sandbox" mode is selected. In testing mode use "Sandbox option", in live mode use "Production".
  3. Public API Key: Your public API key, that you retrieved from the Affirm Merchant Dashboard.
  4. Private API Key: Your private API key, that you retrieved from the Affirm Merchant Dashboard.
  5. Financial Product Key: Your financial product key, that you retrieve from the Affirm Merchant Dashboard.
  6. Payment Action: By default, "Authorize" action is selected. If you currently automatically capture, change it to "Authorize and Capture".
  7. Disable for backordered items: By default, "No" is selected. If you want to disable Affirm when a backordered item is in the cart, change the "Disable for backordered items" to "Yes".
  8. Minimum Order Total: By default, "0.01" value is entered. Identifies minimum total price threshold for when Affirm is available as a payment option at the checkout.
  9. Maximum Order Total: By default, "100000" value is entered. Identifies maximum total price threshold for when Affirm is available as a payment option at the checkout.
  10. Sort Order: Changes the order of displaying Affirm as a payment method during checkout. To change the order, enter a number in Sort Order greater than 0.
  11. Plain Text Appearance: By default, "No" option is selected. If you want to change the appearance of Affirm to display as text instead of a logo during checkout, change "Plain Text Appearance" to "Yes".
  12. Icon & Affirm Payment Method HTML: Affirm logo and sub-text displayed on the checkout page. By default, Affirm approved message is used.
  13. Enabled Checkout Button: By default, "No" option is selected. Determines if the button should be displayed on the shopping cart page. Affirm Button URL can be updated in the "Checkout Button Code".

If you have problems with the changes not showing up immediately
  1. Visit System > Cache Management
  2. Click Flush Magento Cache
  3. Log out and log back in to reset permissions

Promotional Messaging

Monthly Payment Pricing (As-Low-As)

Affirm monthly payment pricing (as low as messaging) and modal on the product description pages and shopping cart page can be enabled by going to Stores > Configuration > General > Affirm Promos and updating the following configurations:

  1. Enable for Product PDP: By default, "No" option is selected. Determines if the "as low as" message should be displayed on the Catalog Product Pages.
  2. Enable for Category PLP: By default, "No" option is selected. Determines if the "as low as" message should be displayed on the Category Pages.
  3. Enable for Shopping Cart: By default, "No" option is selected. Determines if the "as low as" message should be displayed on the Shopping Cart Page.
  4. Affirm logo: By default, "Blue" option is selected. Color of the logo.
  5. Minimum amount for displaying the monthly payment pricing: By default, monthly payment pricing is displayed if the amount above $50. Setting 100 as the value here will display monthly payment pricing for products above $100.
  6. Default Affirm Promo ID: Optional Default Affirm Promo ID value (provided by the Affirm Client Success Team) 

Note: For displaying "as low as" functionality, we are using the "Affirm/Block/Promotion/ProductPage/Aslowas" block and the "Affirm/view/frontend/templates/promotion/aslowasPDP.phtml" template. To include this block in a specific location on the PDP or cart, you will need to select the appropriate handle ("catalog_product_view.xml" by default for PDP in Magento) and "parent block or container", which will render the "as low as" block (using <referenceBlock name="parent_block_name"> structure or <referenceContainer name="test_content">), where "parent_block_name" - name "parent block" in layout.

If your website dynamically changes the product price based on size, color, or some other attribute, the tool allows for you to call the updateAffirmAsLowAs function. This function updates the monthly payment calculation whenever the price changes. See: Astound\Affirm\Block\Promotion\AslowasAbstract.php, Astound\Affirm\Block\Promotion\ProductPage\Aslowas.php, Astound\Affirm\Block\Pro motion\CartPage\Aslowas.php, Astound\Affirm\view\frontend\web\js\model\aslowas.js

Banners

Affirm promotional banners across various pages on your site can be enabled by going to Stores > Configuration > General > Affirm Promos and by updating the following configurations:

  • General Settings
    • Affirm Promo Key: By default "W6WU7UK82RS34HDH" value is used.
    • Enabled: By default, "No" option is selected. Determines if the promotional banners (images) should be displayed on specified pages.
  • Home Page Settings, Catalog Category Page Settings, Catalog Product Page Settings, Checkout Cart Page Settings
    • Display: By default, "No" option is selected. Determines if the promotional banner should be displayed on the specified page.
    • Promo Size: Determines the size of the promotional banner. See Promotional Banners for a list of possible sizes.
    • Promo Position: Determines the position of promotional banner.


Order Processing

Whenever an authorize, void, invoice or credit memo is applied to an order, the request in sent to Affirm to update order status in Affirm Merchant Dashboard. See Daily Operations for details.

Test your Affirm configuration

Test your configuration to ensure that everything is working before you go live. Email  merchanthelp@affirm.com with a link to your test site so that we can verify your configuration and provide you with production keys.

  1. Add an item to the cart on your test site.
  2. Proceed to checkout.
  3. During checkout, enter valid U.S. addresses and mobile-phone information. Affirm cannot test your configuration if the address or phone information is fake.
  4. Select Affirm as the payment option.
  5. Proceed to Affirm's testing environment checkout.

Note: The URL https://sandbox.affirm.com indicates that you are in the testing environment.

6. When prompted for your security PIN, enter 1234.

7. Select terms.

8. Confirm your loan.

 

9. Wait to ensure that you have been redirected to your confirmation page.

10. Verify that the transaction appears in your platform's admin panel and on  sandbox.affirm.com/dashboard

Note: When a customer completes checkout with Affirm as the payment method, Affirm authorizes a charge for the amount of the order. The charge appears in a pending state on the customer’s Affirm account. Authorized transactions expire if they are not captured before the capture deadline. The default capture deadline is specified in your partnership agreement with Affirm. If you did not specify your authorization-period requirements because of inventory, pre-orders, or shipping time in your onboarding form, please email merchanthelp@affirm.com for help with completing this process.

Go live with Affirm financing

After you verify that your configuration is working properly in the sandbox environment, your partnerships team activates your production keys in the dashboard.

  1. Sign in to the Affirm dashboard.
  2. Retrieve the production API keys.
    1. Hover over the profile icon area at the lower-left of the page.
      Screen Shot 2016-03-22 at 7.56.58 AM-2.png
    2. Click the API Keys link that appears.
      Screen Shot 2016-03-22 at 7.56.20 AM.png
    3. Copy the public, private, and financial product keys.
  3. Enter the production API keys into your platform.

    Note: In Shopify, clear the Use test mode check box when you enter your production API keys.

Note: The email address that you use to access the dashboard must be registered as a Google account. Check to see if your existing email address is a Google account or create a new Google account. If you create a new account, use the same construction as the email address that you enter when you sign up without Gmail (for example, example@affirm.com becomes example@gmail.com) so that you don't need to send us a separate @gmail.com address.