{"id":11161,"date":"2024-08-20T13:19:18","date_gmt":"2024-08-20T13:19:18","guid":{"rendered":"https:\/\/spreecommerce.org\/?post_type=cpt_integrations&#038;p=11161"},"modified":"2024-08-21T13:20:09","modified_gmt":"2024-08-21T13:20:09","slug":"affirm-and-spree-integration","status":"publish","type":"cpt_integrations","link":"https:\/\/spreecommerce.org\/integrations\/affirm-and-spree-integration\/","title":{"rendered":"Affirm and Spree integration"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.affirm.com\/\">Affirm<\/a>&nbsp;is a financial services company that offers installment loans to consumers at the point of sale. Its aim is to improve the banking industry to be more accountable and accessible to consumers.<\/p>\n\n\n\n<p>Founded in 2012, Affirm lets shoppers pay for purchases across multiple months with transparent, fairly-priced fees built into every payment, and increases conversion and basket size for e-tailers at less than the cost of credit cards.<\/p>\n\n\n\n<p>The integration of Affirm with your Spree Commerce store can be done quickly and easily following the guidelines mentioned below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The benefits of using Affirm for your eCommerce business<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Large customer network<\/h3>\n\n\n\n<p>When you partner with Affirm, you\u2019ll reach the company\u2019s rapidly growing network of millions of customers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Zero risk to you<\/h3>\n\n\n\n<p>Affirm settles within one business day and takes on risk, from costly chargebacks to fraud.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Flexibility to fit your business<\/h3>\n\n\n\n<p>With Affirm, you have the power to tailor your shopping experience to any customer, channel, or price point.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to integrate Affirm with Spree<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Before you begin<\/h3>\n\n\n\n<p>Before beginning integration, you should review:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.affirm.com\/Integrate_Affirm\/Transaction_flow\">The transaction flow when buying with Affirm<\/a><\/li>\n\n\n\n<li>Your current checkout process to understand how Affirm will affect operations and customer experience<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.affirm.com\/Merchant_Resources\/Merchant_Daily_Operations\/Settlement_Reports?origin=deflection\">Settlement reports to know how to reconcile transactions with the deposits into your bank account<\/a><\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Sandbox development<\/h3>\n\n\n\n<p>You should have received an email inviting you to create an Affirm account.&nbsp;<a href=\"https:\/\/docs.affirm.com\/Merchant_Resources\/Merchant_Daily_Operations\/Accessing_the_Dashboard?origin=deflection\">Click here for information about accessing your account<\/a>.<\/p>\n\n\n\n<p>Develop and test the Affirm integration in your development environment connected to our sandbox. To use our sandbox, retrieve your sandbox API keys at&nbsp;<a href=\"https:\/\/sandbox.affirm.com\/dashboard\/#\/apikeys\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/sandbox.affirm.com\/dashboard\/#\/apikeys<\/a>&nbsp;for use during integration.<\/p>\n\n\n\n<p>After development and testing, you\u2019ll need to update your integration to use your live API keys, which you can find at&nbsp;<a href=\"https:\/\/affirm.com\/dashboard\/#\/apikeys\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/affirm.com\/dashboard\/#\/apikeys<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Install the Spree extension<a><\/a><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/Affirm\/spree_affirm\" target=\"_blank\" rel=\"noreferrer noopener\">Download the Spree extension<\/a><\/li>\n\n\n\n<li>Add the following line to your Spree Gemfile:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>1<\/code><\/td><td><code>gem 'spree_affirm', :github =&gt; \"affirm\/spree_affirm\"<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Install the gem with Bundler:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>1<\/code><\/td><td><code>bundle install<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>2<\/code><\/td><td><code>bundle exec rails g spree_affirm:install<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>Restart your Spree server<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">2. Configure Affirm as a payment method<a><\/a><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Sign in to the Spree admin page<\/li>\n\n\n\n<li>Go to&nbsp;<strong>Configurations<\/strong>&nbsp;&gt;&nbsp;<strong>Payment Methods<\/strong><\/li>\n\n\n\n<li>Click&nbsp;<strong>New Payment Method<\/strong><\/li>\n\n\n\n<li>Set&nbsp;<strong>PROVIDER<\/strong>&nbsp;to&nbsp;<strong>Spree::Gateway::Affirm<\/strong><\/li>\n\n\n\n<li>Enter&nbsp;<strong>Affirm Monthly Payments<\/strong>&nbsp;for&nbsp;<strong>NAME<\/strong><\/li>\n\n\n\n<li>Click&nbsp;<strong>Create<\/strong><\/li>\n\n\n\n<li>Keep&nbsp;<strong>SERVER<\/strong>&nbsp;set to&nbsp;<strong>sandbox.affirm.com<\/strong>&nbsp;for testing<\/li>\n\n\n\n<li>Check the&nbsp;<strong>TEST MODE<\/strong>&nbsp;box for testing<\/li>\n\n\n\n<li>Enter the&nbsp;<strong>API Key<\/strong>&nbsp;(public key) and&nbsp;<strong>Secret Key<\/strong>&nbsp;(private key) you retrieved from the Affirm sandbox merchant dashboard<\/li>\n\n\n\n<li>If your checkout process automatically captures the charge, set&nbsp;<strong>AUTO CAPTURE<\/strong>&nbsp;to&nbsp;<strong>Yes<\/strong><\/li>\n\n\n\n<li>Set&nbsp;<strong>ACTIVE<\/strong>&nbsp;to&nbsp;<strong>Yes<\/strong>&nbsp;to enable Affirm as a payment method.<\/li>\n\n\n\n<li>Click&nbsp;<strong>Update<\/strong><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/docs.affirm.com\/@api\/deki\/files\/557\/Screen_Shot_2018-07-24_at_3.13.30_PM.png?revision=1&amp;size=bestfit&amp;width=669&amp;height=439\" alt=\"Screen Shot 2018-07-24 at 3.13.30 PM.png\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. Add Affirm promotional messaging<a><\/a><\/h2>\n\n\n\n<p>Affirm promotional messaging components\u2014monthly payment messaging and educational modals\u2014show customers how they can use Affirm to finance their purchases. Properly placed promotional messaging helps drive increased AOV and conversion.<\/p>\n\n\n\n<p>Adding Affirm promotional messaging is a required integration step, and you should complete it before testing your integration.&nbsp;<a href=\"https:\/\/docs.affirm.com\/Integrate_Affirm\/Promotional_Messaging\">Click here for information about adding Affirm promotional messaging<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Review your order management functions<a><\/a><\/h2>\n\n\n\n<p>Processing orders (authorize, void, refund, and partial refund) in Spree updates the order status in the Affirm dashboard. While you can process orders in the dashboard, we strongly recommend using Spree to keep order status synced with Affirm. For more information on processing orders in Spree, refer to their documentation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Add the Confirmation Page function<a><\/a><\/h2>\n\n\n\n<p>When a customer completes their purchase, you can send their order and product information to Affirm for A\/B testing, which will help you optimize your site. Send this information by adding the Confirmation Page function to your payment confirmation page. We only require&nbsp;<strong>orderId<\/strong>,&nbsp;<strong>total<\/strong>,&nbsp;<strong>productId<\/strong>, and&nbsp;<strong>quantity<\/strong>&nbsp;for A\/B testing.<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.affirm.com\/Integrate_Affirm\/Promotional_Messaging\/2018_Summer_Upgrade\/Confirmation_Page_function\">Click here for all the Confirmation Page function parameters<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>01<\/code><\/td><td><code>affirm.analytics.trackOrderConfirmed({<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>02<\/code><\/td><td><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>\"orderId\"<\/code><code>:&nbsp;<\/code><code>\"T12345\"<\/code><code>,<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>03<\/code><\/td><td><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>\"total\"<\/code><code>: 3739<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>04<\/code><\/td><td><code>}, [{<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>05<\/code><\/td><td><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>\"productId\"<\/code><code>:&nbsp;<\/code><code>\"SKU-1234\"<\/code><code>,<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>06<\/code><\/td><td><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>\"quantity\"<\/code><code>: 1<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>07<\/code><\/td><td><code>}, {<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>08<\/code><\/td><td><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>\"productId\"<\/code><code>:&nbsp;<\/code><code>\"SKU-5678\"<\/code><code>,<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>09<\/code><\/td><td><code>&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code>\"quantity\"<\/code><code>: 1<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><code>10<\/code><\/td><td><code>}]);<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Required_function_parameters-1307\">Required function parameters<\/h3>\n\n\n\n<p><strong>Order object<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td>orderId<\/td><td>string<\/td><td>Your internal unique identifier representing the order. Maximum 500 characters.<\/td><\/tr><tr><td>total<\/td><td>integer<\/td><td>The total amount of the transaction, including tax and shipping, stated in USD cents (e.g., $100 = 10000).<\/td><\/tr><\/thead><\/table><\/figure>\n\n\n\n<p><strong>Product object<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td>productId<\/td><td>string<\/td><td>Your internal unique identifier representing the product, such as the SKU or an internal database identifier. Maximum 500 characters.<\/td><\/tr><tr><td>quantity<\/td><td>integer<\/td><td>The quantity of the purchased product.<\/td><\/tr><\/thead><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">6. Test your integration<a><\/a><\/h2>\n\n\n\n<p>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.&nbsp;<a href=\"https:\/\/docs.affirm.com\/Integrate_Affirm\/Platform_Integration\/Platform_Acceptance_Testing_Guidelines?origin=deflection\">Click here for our recommended test plan<\/a>. However, you\u2019ll need to tailor your testing plan to your specific systems, processes, and integration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7. Deploy to production<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Coordinate testing with Affirm<\/h3>\n\n\n\n<p>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 Client Success Manager to coordinate this test.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect to the live Affirm environment<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Retrieve your live API keys at&nbsp;<a href=\"https:\/\/affirm.com\/dashboard\/#\/apikeys\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/affirm.com\/dashboard\/#\/apikeys<\/a><\/li>\n\n\n\n<li>In the Spree admin panel, go to&nbsp;<strong>Configurations<\/strong>&nbsp;&gt;&nbsp;<strong>Payment Methods<\/strong><\/li>\n\n\n\n<li>Select&nbsp;<strong>Affirm Monthly Payments<\/strong><\/li>\n\n\n\n<li>Set&nbsp;<strong>SERVER<\/strong>&nbsp;set&nbsp;<strong>api.affirm.com<\/strong><\/li>\n\n\n\n<li>Enter the&nbsp;<strong>API Key<\/strong>&nbsp;(public key) and&nbsp;<strong>Secret Key<\/strong>&nbsp;(secret key) you just retrieved from the Affirm merchant dashboard<\/li>\n\n\n\n<li>Uncheck the&nbsp;<strong>TEST MODE<\/strong>&nbsp;box<\/li>\n\n\n\n<li>Click&nbsp;<strong>Update<\/strong><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Launch to production<\/h3>\n\n\n\n<p>After you\u2019ve connected to our live environment and we\u2019ve tested your integration, you\u2019re ready to deploy to your production environment and offer Affirm as a payment option to your customers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example of Affirm and Spree integration<\/h2>\n\n\n\n<p>FORM&nbsp;is a beauty brand belonging to Walker and Company, a firm that is reinventing the way consumers of color learn about, purchase and enjoy health and beauty products. The company uses Spree for their beautiful website with some really cool features like customized Gift Cards, product reviews and featured testimonials from Twitter. The integration with Affirm allows FORM\u2019s customers to pay with 3 interest-free payments.<\/p>\n\n\n\n<p>Read more:&nbsp;<a href=\"https:\/\/spreecommerce.org\/stories\/form-uses-spree-commerce-for-its-prestige-hair-care-brand-designed-for-all-hair-types\/\">FORM&nbsp;Success Story<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"690\" src=\"\/cdn-cgi\/image\/width=1039,height=700,fit=crop,quality=70,format=auto,onerror=redirect,metadata=none\/wp-content\/uploads\/2024\/08\/image-2-1024x690.png\" alt=\"\" class=\"wp-image-11164\" srcset=\"https:\/\/spreecommerce.org\/wp-content\/uploads\/2024\/08\/image-2-1024x690.png 1024w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2024\/08\/image-2-300x202.png 300w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2024\/08\/image-2-768x517.png 768w, https:\/\/spreecommerce.org\/wp-content\/uploads\/2024\/08\/image-2.png 1039w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Affirm&nbsp;is a financial services company that offers installment loans to consumers at the point of sale. Its aim is to improve the banking industry to be more accountable and accessible to consumers. Founded in 2012, Affirm lets shoppers pay for purchases across multiple months with transparent, fairly-priced fees built into every payment, and increases conversion [&hellip;]<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":true,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":""},"cpt_integrations_category":[986],"class_list":["post-11161","cpt_integrations","type-cpt_integrations","status-publish","hentry","cpt_integrations_category-payment"],"acf":[],"_links":{"self":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/cpt_integrations\/11161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/cpt_integrations"}],"about":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/types\/cpt_integrations"}],"wp:attachment":[{"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/media?parent=11161"}],"wp:term":[{"taxonomy":"cpt_integrations_category","embeddable":true,"href":"https:\/\/spreecommerce.org\/wp-json\/wp\/v2\/cpt_integrations_category?post=11161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}