Adyen and Spree integration
Adyen is the payment platform of choice for many of the world’s leading companies, providing a modern end-to-end infrastructure connecting directly to Visa, Mastercard, and consumers’ globally preferred payment methods. Adyen delivers frictionless payments across online, mobile, and in-store channels. With offices across the world, Adyen serves customers including Facebook, Uber, Spotify, Casper, Bonobos and L’Oreal.
The benefits of using Adyen for your ecommerce business:
Get everything you need in one integration
Enjoy a full range of tools to build better customer experiences, accept payments globally, reduce payment declines, and increase revenue.
Create a checkout in minutes and customize to your brand
Make paying quick, easy, and secure for customers anywhere, anytime. Add all popular payment methods and give your customers the best payment experience with one-click payments.
Accept recurring payments anywhere in the world
Make sure customers keep coming back time and time again with recurring payment technology built for any business, location, and payment setup.
- Make it easy for customers to sign up
Allow customers to subscribe to your service with a smooth sign-up process. You’ll provide a seamless checkout experience with the payment methods your customers know and trust, and validate new cards quickly and easily.
- Reduce canceled subscriptions
A customer’s card can expire, get stolen or they may lose it without your knowledge. Account updater services automatically update card details to give customers an uninterrupted experience.
- Prevent fraud and card testing
Serious threats of fraudulent attacks and card testing cost your business time and money. Smart data and machine learning automates your fraud defense and takes the burden off your shoulders.
- Keep customers coming back
Returning customers don’t want to input their card details again. Tokenized payment data allows seamless one-click payments, without any payment data touching your website.
For more information, check out Adyen’s subscription payments guide.
How to integrate Adyen with Spree
Spree Adyen Integration
Easily integrates Adyen payments into a Spree store. It works as a wrapper of the awesome adyen gem which contains all basic API calls for Adyen payment services.
Installation
Add this line to your application’s Gemfile:
gem 'spree-adyen', github: 'spree/spree-adyen'
And then execute:
$ bundle
Copy the adyen notification migration. You’ll need it to save all notifications responses.
$ rake railties:install:migrations
Usage
To integrate with Adyen Payments you’ll need to request API credentials by signing up at Adyen website https://www.adyen.com/.
This extension provides three Payment Methods. In order to use AdyenPayment and AdyenPaymentEncrypted method you’ll need to make sure your account is enabled to use Adyen API Payments, needed to authorize payments via their SOAP API.
The other payment method, AdyenHPP, allows your store to authorize payments using Adyen Hosted Payments Page solution. In this case the customer will enter cc in Adyen website and be redirected back to the store after the payment.
For the AdyenHPP method you’ll need to create a skin in your merchant dashboard and add the skin_code and shared_secret to the payment method on Spree backend UI.
All subsequent calls, e.g. capture, are done via Adyen SOAP API by both payment methods.
Make sure that you config your notification settings in Adyen Merchant dashboard. You need to set URL, choose HTTP POST, and set a username and password for authentication. The username and password need to be set as environment variables , ADYEN_NOTIFY_USER and ADYEN_NOTIFY_PASSWD, so that notifications can successfully persist on your application database.
Please look into the adyen gem wiki https://github.com/wvanbergen/adyen/wiki and Adyen Integration Manual for further info https://www.adyen.com/developers/api/
Testing
The extension contains some specs that will reach out Adyen API the first time you run them. Those are marked with the external tag and they need credentials so you’ll have to set up a config/credentials.yml file. There’s a helper test_crendentials
available on the specs to call each key on that YAML file. Also it uses VCR to record the requests so you’ll need to delete those files to do a new request.
Required to run specs: create a dummy Rails app as testing environment:
bundle exec rake test_app
You can run external specs like this:
bundle exec rspec spec --tag external
Test Credit Card Info
Example of Adyen and Spree integration
Sirdar is the UK market leader in hand knitting yarns as well as having a growing presence in export markets, most notably the USA. The company uses Spree Commerce for its online store with a project builder and Adyen for payments.
Read more: Sirdar’s success story