This guide describes how to integrate Affirm Connect into WooCommerce eCommerce so you can provide Affirm as a payment option to your customers. After integrating Affirm, your WooCommerce site will:
- Offer Affirm as payment option on the checkout page
- Process Affirm charges in your order management system
- Display Affirm promotional messaging
The integration steps are:
- Install and configure the Affirm WooCommerce extension
- Update product attribute to be leasable or non leasable
- Review your order management functions
- Test your integration
- Deploy to production
NOTE: Upgrading from existing Affirm WooCommerce Extension read the following guide.
Before you begin
Before beginning integration, you should review:
- The transaction flow when buying with Affirm
- Your current checkout process to understand how Affirm will affect operations and customer experience
- Settlement reports to know how to reconcile transactions with the deposits into your bank account
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 and configure the Affirm WooCommerce extension
- Download the woocommerce-gateway-affirm.zip
- Visit WooCommerce for instructions on how to install and configure Affirm
When configuring Affirm, ensure that Affirm Sandbox is checked for development and testing. Return here to complete the integration.
2. Update product attribute to be leasable or non leasable
Each product will have an additional attribute to identify if the product is leasable, by default if leasable is not checked product will be non leasable.
To mark a product as leasable navigate to WordPress Admin -> Product -> All Products -> select product -> General and check leasable checkbox.
3. Review your order management functions
Processing orders (authorize, void, refund, and partial refund) in WooCommerce updates the order status in the Affirm dashboard. While you can process orders in the dashboard, we strongly recommend using WooCommerce to keep order status synced with Affirm. For more information on processing orders in WooCommerce, refer to their documentation.
Under WooCommerce > Orders, every order paid with Affirm Connect will show payment via Affirm if loan was issued by Affirm or a lease to own partner if loan was not issued by Affirm. Payments made with Affirm will have a transaction number with link to the Affirm merchant portal at the top. Payments made with lease to own partners will have a transaction number for reference ONLY. You can also prompt Affirm to issue refunds from the order view.
4. Test your integration
After completing your integration, do a thorough testing of both your front-end and order management functions in our sandbox to ensure that everything works as expected. Click here for our recommended test plan. However, you’ll need to tailor your testing plan to your specific systems, processes, and integration.
Checkout through Zibby
- Initiate checkout to access the Affirm account creation screen
- If you have an existing account, click Sign In
- 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
- Income - below options will only affect sandbox environment only.
- A value less than 100,00 to trigger an Affirm decline and handoff to Zibby pre-approval.
- A value greater than 100,000 to trigger an Affirm approval.
- Enter 1234 for the verification code and click VERIFY CODE
- Select "Check out with Zibby"
- Click next to confirm Loan Schedule
- Zibby Payment information
- Card Number : 4111 1111 1111 1111
- Expiration : future date
- CVV: 3 digit number
- To successfully test Zibby flow in Affirm's sandbox environment, enter a new identity (name, phone number, address, etc.) every time you go through the checkout flow.
- If you get declined once, you may continue to get Zibby declined due to browser cookie caching. We recommend clearing your browser cookies / cache (or use Incognito browser window) before each test.
5. Deploy to production
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@example.com to coordinate this test.
Connect to the live Affirm environment
- Retrieve your live API keys at https://affirm.com/dashboard/#/apikeys
- Enter the Public API Key and Private API Key you just retrieved from the Affirm merchant dashboard
- Uncheck the Affirm Sandbox box
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. How do I enable Modal Checkout flow instead of redirecting the customer to Affirm?
The Modal Checkout configuration option is available in the latest version of Affirm WooCommerce plugin. Please refer Checkout Mode settings for as per documentation.
Why am I seeing Affirm canceled orders in WooCommerce > Orders?
WooCommerce creates orders when a customer goes to the Affirm checkout application. If the customer abandons the Affirm checkout at any point or is denied a loan, then WooCommerce automatically moves the associated orders to a Canceled status. If the customer completes the Affirm application and confirms their loan, they go to the order confirmation page, and the associated orders move to a Pending payment or Processing status depending on the Transaction Mode setting in WooCommerce > Settings > Checkout > Affirm.
2. Why is my site crashing as soon as I activate the Affirm plugin?
This may happen due to various reasons, such as PHP code syntax, compatibility, or memory limit exhaustion issues. To troubleshoot the issue:
- Enable error debug log (on your test site)
- Open the wp-config.php file of your WordPress install
- Search for define(‘WP_DEBUG’, false);
- Change false to true
- Save the file
- Refresh your website to see the message causing the error
- Make the necessary changes by modifying the code per the error message (refer to the file name and line number in the error message)
- To write these logs to a log file, add define( 'WP_DEBUG_LOG', true ); in the wp-config.php file (all the debug logs will then be written to /wp-content/debug.log)
- Check file and folder permissions for complete installation
- Verify files are 664 or 644
- Verify folders are 775 or 755
- Verify wp-config.php is 660, 600, or 644
- Check memory limits
If you still see an empty page or get an error about either memory limits or exhausted memory, you’ll need to allocate more memory for the application.
To deactivate the Affirm plugin to revert your site back to the previous state:
- If you can access your login to WordPress (yoursite.com/wp-admin), go to the plugins and deactivate the Affirm plugin
- If you can’t access your login to WordPress, access your website via FTP and go to /wp-content/themes/ and rename the Affirm plugin folder to Affirm_something (This deactivates the Affirm plugin and allows you to access both admin and frontend)
3. Where can I find Affirm related logs?
API logs related to Affirm are located at Wordpress Admin > WooCommerce > Status > Logs > woocommerce-gateway-affirm...
4. Why can't I get promotional messaging to display on the product pages?
This issue usually occurs if you are using or extending custom product templates. To fix this issue, you would need to manually add some code to the WooCommerce files:
- Go to Wordpress Admin > Appearance > Editor and select YourSiteTheme/woocommerce/single-product/price.php
- If this file does not exist, copy it from this path MAIN_DIR/wp-content/plugins/woocommerce/templates/single-product/price.php. Add this file, price.php, under YourSiteTheme/woocommerce/single-product/ directory
- Edit YourSiteTheme/woocommerce/single-product/price.php, and add the following code right below the paragraph tag with "price" class: <p class="price"> <?php echo $product->get_price_html(); ?> </p>
- Save the changes