Integrate Zip

Zip provides Spree stores the spree_quad_pay gem for integrating Zip into your Spree store.

Installation

  1. Add this extension to your Gemfile with this line:
gem 'spree_quad_pay', github: 'quadpay/quadpay-spree', branch: '3-3-stable'
  1. Install the gem using Bundler:
bundle install
  1. Copy & run migrations
bundle exec rails g spree_quad_pay:install
  1. Setup a task scheduler to synchronize Zip order status

If your environment supports cronjobs, you can use whenever to schedule the recurring tasks to synchronize orders:

bundle exec whenever --update-crontab

If you are using Heroku or another environment that doesn't support cronjobs, use rake task combine with Heroku Scheduler or another background job processing framework:

rake quad_pay_tasks:sync_orders

Configuration

  1. Create the Zip Payment Method.

    • Login into the Spree Admin Dashboard and go to Configurations > Payment Method, click the button New Payment Method.
    • On the new payment method page, set the PROVIDER field to Spree::BillingIntegration::QuadPayCheckout and enter a Name and Description.
    • Click Create.
  2. Setup the Zip API keys and Settings.

Go to Configurations > QuadPay Settings and enter the information below:

PropertyData typeDescription
Site URLString, eg. https://www.mycompany.shopThis URL is used for Zip callback calls
Merchant NameString, eg. my-companyMerchant Name provided by Zip
Client IDStringClient ID provided by Zip
Min AmountAny positive integerThe Order minimum product/cart amount as agreed upon with Zip
Max AmountAny positive integerThe Order maximum product/cart amount as agreed upon with Zip
Display Widget At Product PageBoolean
Display Widget At Cart PageBoolean
Test ModeBooleanToggle Test Mode or Live Mode
  1. Restart your server

Integration with Order Management Systems

By default, the gem hooks into the regular Spree workflows for Refunds and Order cancellation.

If you are using custom workflows for Shipping, Refunds or Cancellations, you may wish to explore the built in Spree::BillingIntegration::QuadPayCheckout object to trigger Zip commands. The following actions are supported:

* create_order: create Zip Order
* find_order: find Zip Order based on token provided
* refund: refund with Zip payment based on the Payment's response code
* credit: partial refund back to User
* cancel: full refund

Customization

For guidance on customizing the styling of the widget, visit the Zip Widget Integration Guide.

📘

These instructions are for a Spree store using a lightly customized theme. If the store's theme is heavily customized, further customization may be necessary. If you would like support with the Zip integration please get in touch with us.


What’s Next

Now that you've added the Zip gateway and integrated the Zip widget, be sure to follow these quality assurance steps: