Integrate Zip
Zip provides Spree stores the spree_quad_pay gem for integrating Zip into your Spree store.
Installation
- Add this extension to your Gemfile with this line:
gem 'spree_quad_pay', github: 'quadpay/quadpay-spree', branch: '3-3-stable'
- Install the gem using Bundler:
bundle install
- Copy & run migrations
bundle exec rails g spree_quad_pay:install
- 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
-
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.
-
Setup the Zip API keys and Settings.
Go to Configurations > QuadPay Settings and enter the information below:
Property | Data type | Description |
---|---|---|
Site URL | String, eg. https://www.mycompany.shop | This URL is used for Zip callback calls |
Merchant Name | String, eg. my-company | Merchant Name provided by Zip |
Client ID | String | Client ID provided by Zip |
Min Amount | Any positive integer | The Order minimum product/cart amount as agreed upon with Zip |
Max Amount | Any positive integer | The Order maximum product/cart amount as agreed upon with Zip |
Display Widget At Product Page | Boolean | |
Display Widget At Cart Page | Boolean | |
Test Mode | Boolean | Toggle Test Mode or Live Mode |
- 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.
Updated about 2 years ago
Now that you've added the Zip gateway and integrated the Zip widget, be sure to follow these quality assurance steps: