Integrate Affirm into the Miva e-commerce platform.


This guide describes how to integrate Affirm into the Miva e-commerce platform so that you can provide Affirm as a payment option to your customers. After integrating Affirm, your Miva site will:

  • Offer Affirm as payment option on the checkout page
  • Process Affirm charges in your order management system
  • Display Affirm promotional messaging

Before you begin 

Before beginning integration, you should review:

Sandbox development

You should have received an email inviting you to create an Affirm account. Click here for information about accessing your account.

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.

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 Affirm

1. Download the free Affirm module.
2. Unzip the file.
3. Sign in to the Miva Merchant Admin page.
4. On the left-side menu, click Modules.
5. Click the large (+) button on the right.
6. Click Upload.
7. Click Choose File.
8. Select affirm.mvc from the unzipped module files.
9. Click Upload.
10. In the Add Module window, Click the + Add button.
11. On the main Miva Merchant Admin screen, choose Payment on the left-side menu.
12. In the Payment Settings window, click the Add/Remove Modules tab.
13. Verify that the Available Modules group displays Affirm module (Buy with Affirm).
14. In the Affirm module (Buy with Affirm) window, click Install.

2. Configure Affirm as a payment method

To use the Affirm as a payment method, you must use an OPAY screen with the Global Head item included and assigned to the checkout page, which is the default setup. The snippet, mvt:item name="affirm" />,  is automatically inserted into the Global Head template. To use Affirm banners and promotional messaging, the Global Head item must be included and assigned to the BASK, PROD and SFNT pages, which is the default setup.

After installing the module, enable Affirm as a payment method by updating these configurations:

1. Sign in to your Miva Merchant admin page
2. Go to Menu > Payment
3. Click on the Buy with Affirm tab
4. In the Runtime Settings section, set Operation Mode to Sandbox
5. If your checkout process automatically captures the charge, set Authorization Mode to Auth/Capture. If you would like to Manually Capture, select Auth Only
6. Verify that Active checkbox is checked
7. Check Modal Checkout if you would like your customers to go through the Affirm loan application flow in a modal while remaining on your site. Leave unchecked for them to redirect to Affirm during the application flow.
8. See Step 4 (Enable Affirm Enhanced Analytics) for details on the Enhanced Analytics checkbox.
9. Enter the Sandbox Public Key and Sandbox Private Key you retrieved from the Affirm sandbox merchant dashboard
10. Click Save Settings

3. Add Affirm promotional messaging

Add Affirm promotional messaging---which includes monthly payment messaging and educational modals---on your product, category, and cart pages.
Note that Miva Merchant software updates may replace page templates, including BASK, PROD and SFNT templates. You'll need to manually copy the Affirm MVT items to their proper locations in each of the affected templates or Affirm promotional messaging won't display.

Add promotional messaging

1. Add monthly payment messaging by inserting <mvt:item name="affirm" param="showmonthly" /> near the price display in the BASK/Basket Contents template and PROD/Product Display Layout template (monthly payment messaging tags have the class affirm-as-low-as for styling with CSS)
2. On the Miva Merchant admin main page, go to  Menu > Payment
3. Click on the Buy with Affirm tab
4. In the Monthly Promotional Messaging section, check the Show monthly promo checkbox
5. If you do not want to display the Learn More link in the messaging, uncheck the Show Learn More Link checkbox
6. Select Blue-black (default) for the default Affirm logo, Black for an all black Affirm logo or White for an all-white logo.
7. Leave BASK page promo ID and a PROD page promo ID blank unless instructed to by Affirm during your setup.
8. Click Save Settings

Add promotional banners (optional)

To add Affirm banner images to various pages on your site:

1. In the Miva Merchant admin panel, go to Menu > Payment
2. Click on the Buy with Affirm tab
3. In the Banner Messaging section, check Show banner on BASK page (cart page), Show banner on PROD pages (product pages), Show banner on SFNT page (home page) to show promotional banners on those pages
4. For each page where you want a banner displayed, select the desired Banner size
5. Insert <mvt:item name="affirm" param="showpromo" /> on the BASK/Basket Contents template, PROD/Product Display Layout template, SFNT/Home Page template as needed.
6. Click Save Settings

4. Enable Affirm Enhanced Analytics (optional)

Affirm's Enhanced Analytics can help you gain new insights into your customers shopping journeys and preferences. Enhanced Analytics also allows you to easily A/B test new promotional messaging and financing programs to ensure that their sites are fully optimized for both cost and conversion rates. To enable Enhanced Analytics, go through the following steps:

1. In the Miva Merchant admin panel, go to Menu > Payment
2. Click on the Buy with Affirm tab
3. Confirm the Enhanced Analytics checkbox is checked
4. Insert <mvt:item name="affirm" param="confirm" /> into the INVC (Invoice) page template.

5. Review your order management functions

Processing orders (authorize, void, refund, and partial refund) in Miva updates the order status in the Affirm dashboard. While you can process orders in the dashboard, we strongly recommend using Miva to keep order status synced with Affirm. To process orders in Miva, sign in to the Miva Merchant admin page and go to Orders > Payment. You have access to the following order management functions:

  • Capture
  • Void
  • Refund

For more information on processing orders in Miva, refer to their documentation.

6. Coordinate testing with Affirm

Before deploying the Affirm integration to your production site, Affirm will need to test it in your development or staging environment connected to our live environment. Contact your Integration Consultant or [email protected] to coordinate this test.

7. Deploy to production

Connect to the live Affirm environment

1. Retrieve your live API keys at https://affirm.com/dashboard/#/apikeys.
2. Sign in to your Miva Merchant admin page and go to Menu > Payment > Buy with Affirm.
3. Enter the Production Public Key and Production Private Key you just retrieved from the Affirm merchant dashboard.
4. Remove the Sandbox Public Key and Sandbox Private Key values.
5. Set Operation Mode to Production.

Launch to production

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


1. Why are orders failing intermittently in Miva but loans are authorized/captured in Affirm?

When the Affirm configuration in Miva is set to "Auth or "Auth/Capture", at times authorization call to Affirm succeeds but the order update fails due to timeout config on the Miva server. This occurs due to  the connection in Miva closing before it can get a successful response from Affirm. To fix this issue, you can add the following line to your mivavm.conf file and extend the timeout period:




Additional information about your mivavm.conf file can be found here

2. I'm experiencing an issue with my integration. What should I do?

If you're experiencing a bug with your Miva integration, please follow these steps:

1. Make sure you have the latest version of the module installed from the Miva Marketplace.
2. If you're still experiencing the issue, install the debug debug of the Affirm module here

3. File a support ticket from within your Miva admin
4. Email [email protected] with details on the issue

Did this page help you?