Skip to main content

Merchant Help

 

Affirm Merchant Help

Spree Integration

 

Overview

The Affirm Spree integration:

  • Enables the Affirm payment method in your checkout
  • Manages orders paid with Affirm

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.

Download the Spree extension

Go to our GitHub site to download the Spree extension.


Install the Spree extension

  1. Add this extension to your Gemfile with this line:

    gem 'spree_affirm', :github => "affirm/spree_affirm"
  2. Install the gem using Bundler:

    bundle install
    
  3. Copy and run migrations:

    bundle exec rails g spree_affirm:install
    
  4. Restart your server.


Configure Affirm as a Payment Method

Once you've installed the Affirm spree gem, Affirm can be easily enabled as a payment method by updating the following configurations:

  1. Log in to your store admin
  2. Visit Configurations > Payment Methods 
  3. Click New Payment Method 
  4. In the Payment Methods > New Payment Method page, select Spree::Gateway::Affirm as the PROVIDER
  5. Enter Affirm Monthly Payments as the NAME 
  6. Click Create
  7. Keep the SERVER set to sandbox.affirm.com for development and testing. When you are ready to go live, this should be set to api.affirm.com 
  8. Check the TEST MODE checkbox for development and testing.
  9. Enter the API KEY that you retrieved from the Affirm Sandbox Merchant Dashboard
  10. Enter the SECRET KEY that you retrieved from the Affirm Sandbox Merchant Dashboard
  11. If you currently automatically capturing your transactions, change AUTO CAPTURE to Yes
  12. Set ACTIVE to Yes to enable Affirm as a payment method on the checkout page
  13. Click Update

Screen Shot 2018-03-13 at 5.38.56 PM.png


Add Affirm Monthly Payment messaging

You can display the monthly price for a product or cart with a customizable message, such as "Starting at [monthly_price] / month with [affirm_logo]" strings, on product page, product gallery, and shopping cart for which Affirm financing is available. Integration details on how to embed the Affirm HTML and JavaScript code can be found here: https://docs.affirm.com/Integrate_Affirm/Promotional_Messaging#monthly_payment_messaging


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 Affirm Sandbox environment, your Affirm Client Success Manager will activate your Affirm Live environment access. This will allow you to sign into the Live version of the Merchant Dashboard, as well as access your Live API keys.

Retrieve Live API keys 

  1. Go to the API keys page in the Affirm dashboard.

    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. You can link your existing work email address to a Google account by signing up without Gmail.
     
  2. Retrieve your live API keys.
  3. Enter the live API keys into your integration/platform.
  4. Set the SERVER set to api.affirm.com for development and testing.
  5. Un-check the TEST MODE checkbox.