Skip to main content

Merchant Help Center

 

Affirm Merchant Help Center

Oracle Commerce (ATG) Integration

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.

Affirm Module 

You can download different Affirm Oracle Commerce module version from here:

The Affirm module is packaged as an ATG module. This structure will be familiar to all users of Oracle Commerce. The directory structure for the non-Versioned module contains:

Directory/File

Description

build.properties

Configuration for the build

build.xml

The build file, modeled after the Oracle Commerce Reference Store build

data

Reference Only: File to hold sample data.

etc

Reference Only: This holds the JSP files that were used for integrating the module with the Oracle Commerce Reference Store.

lib

The libraries required for JSON parsing

META-INF

The module definition file

sql

The required SQL for the switching and core schemas to support the module functionality

src

This holds both the Java source as well as configuration files

Versioned

This is the base of the module for BCC support.


The Versioned module is similar, but only has META-INF, sql and src directories, along with the build.xml and build.properties files to work with the Oracle Commerce Reference Store build scripts.

Install and Configure the Affirm Module

The reference implementation of the Affirm integration modules was done using the Oracle Commerce Reference Store. Therefore, the build scripts rely on the Oracle Commerce Reference Store ant build files. The merchant can choose to either keep the module separate from the existing application, or integrate the files in the module into the source code of the existing application. Details for each approach are below.

  • Maintain a separate module

If the module is going to be kept separate, then the module will at least need to be integrated to the existing build system and built and deployed with the application. This will require mimicking the existing applications build.xml file structure and including those in the separate module. The Affirm integration module's MANIFEST.MF needs to be updated to have ATG-Required: point to the existing main commerce module for the application. There will likely be individual files that need to be updated in this module, so building and deploying it along with the rest of the application is required. Finally, you will need to include the Affirm module in the module list when assembling your EAR file for deployment, and if you are specifying a command-line module list when starting your Oracle Commerce instances, you will need to add this module there as well.

  • Incorporate module code into existing module

If incorporating the code from the Affirm module into your existing application commerce module, you will simply copy the files in the src, config, and lib directories into your existing commerce module. The MANIFEST.MF will need to be updated to include the JSON libraries that are in the Affirm module's lib folder.

  • Module Configurations

The following configurations can be made in a centralized configuration component. The nucleus component path is /affirm/commerce/payment/AffirmPaymentConfiguration. Properties are:

Property Name

Type

Description

apiVersion

String

Currently set to 2. This is the Affirm API version

apiUrl

String

Set to sandbox or production URL. Use environment module or server configs to set production URL.
Defaults to sandbox: https://sandbox.affirm.com/api/v2

jsUrl

String

Set to sandbox or production URL. Use environment module or server configs to set production URL.
Defaults to sandbox: https://cdn1-sandbox.affirm.com/js/v2/affirm.js

enabled

boolean

If false, disable display of Affirm offers, and do not show the Affirm payment option at checkout.
Default module config is set to true. 

capturePaymentOnOrderSubmit

boolean

If true, the debit call is made immediately after the authorize call as part of checkout.
Default module config is set to false 

publicAPIKey

String

The public API key

privateAPIKey

String

The private API key

defaultRuleId

String

The repository id of the rule that you want to set as a default rule to show. This rule will not be checked to see if the cart/products qualify. It is intended to apply to any product or cart as the default.

minimumAmount

double

If the amount of the product (product/category pages) or cart (cart/checkout pages) is less than this amount, then we won't render the JSP code to invoke the Affirm Javascript call at all.

affirmCancelUrl

String

The URL to return to when the user cancels on the Affirm site for some reason

affirmConfirmationUrl

String

The URL to return to after the user has completed the loan.

moduleVersion

String

This is set in the module to either be version 11.x or 10.x

These will need to be configured as appropriate for your different environments. You can find information on BCC rules setup for customized Affirm's monthly payment pricing and configuration here - AffirmUserGuide.zip

  • Required Code for Checkout Integration

The purchase process needs to redirect to Affirm at the time of checkout to complete the loan. That process either sends the user back to the billing page, or to a page that will submit the order and run it through the order processing pipeline. The merchant will need to handle these cases using the existing codebase. This front-end integration will be custom for each merchant. Examples of how this was done in the Reference Store can be found in src/Java/com/affirm/commerce/payment/AffirmCheckoutFormHandler.java and src/Java/com/affirm/commerce/payment/AffirmPaymentFormHandler.java.

  • Handling void/refund/capture operations

The module adds a payment method in the standard way all ATG payment methods work. This means that all existing calls that perform standard payment group operations will work the same as they do for an order with a credit card payment group. For example, calling PaymentManager.debit on an order with an Affirm payment method will automatically debit the Affirm payment group by making the API call to Affirm for the debit operation. Sample code exists in the module for invoking the debit, void, refund, and shipping update methods using a separate form handler. These can be found in the src/Java/com/affirm/commerce/payment/AffirmProcessingFormHandler.java file.

 

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 a 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.