The Voucherify Developer Hub

Welcome to the Voucherify developer hub. You'll find comprehensive guides and documentation to help you start working with Voucherify as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Shopify

Sell vouchers online

Voucherify provides a Shopify integration that enables you to automate the process of selling vouchers for your services or goods. The plugin sends unique voucher codes to customers who paid for their orders.

Requirements

Besides an active Voucherify account, the app requires a Mandrill account to send emails.

1. Install the app

Go to https://shopify-app.voucherify.io/ and click the green Get button.

A popup window appears. Type the name of your shop and click the Log in button.

Once you log into your shop, you will be asked to give permission for the app to modify orders. The app needs that to register a trigger on order payment and to mark processed orders with a tag. Click the Install App button to finish the installation.

2. Configure the app

After installation, you will be taken to configuration view. Note: you can also access the configuration view from your shop's admin panel - navigate to Apps and click on the voucherify.io app.

Voucherify Configuration

First, you will need to obtain Voucherify Application ID and Application Secret Key. You can get them from Voucherify Configuration. Copy and paste them in the first and second field of the app's configuration.

Next enter a campaign name that includes vouchers you want to sell. If you don't have any campaign yet go and create one.

Campaign per Product

If you need to specify different campaigns for different products or variants you can achieve it with metafields. You'll need to install an extra app to edit metafields, e.g. MetaFields Editor. In the Metafields Editor select a product or variant for which you want to use a custom campaign and add following metafield:

  • Namespace: voucherify
  • Value type: string
  • Key: campaign
  • Value: <campaign name>

If both product and variant specify custom campaigns then variant will take precedence.

Email Configuration

Now it's time to setup up the email section. The first thing needed here is a Mandrill API Key. Sign in to Mandrill or create a new account if you don't have one yet.

Go to Mandrill Settings to get or create an API Key.

In the next step type in an email address that will be used to send vouchers. Make sure the email domain is configured as Sending Domain in Mandrill.

Email Template

The last 2 fields Email Subject and Template are totally up to you. In the email template, you can use customer and order variables. Each order item (order.line_items) is enhanced with vouchers list - as many as the quantity of the item.

Shopify app gives you two main mechanisms to define email content. The user can define email body either in plain text or HTML syntax.

Plain text email template

Useful template code snippets:

${customer.first_name}
${customer.last_name}
${order.total_price}
Dear ${customer.first_name} ${customer.last_name},

Your voucher codes:
<% _.forEach(order.line_items, function(item) { %>
- ${item.name}: ${_.map(item.vouchers, 'code').join(', ')}
<% }) %>
  
Regards,
Voucherify.io Team

HTML email template

If you decide to implement an email content in HTML, you will have to use syntax similar to this from Handlebars.js framework. You will find useful examples below.

Dear {{customer.first_name}} {{customer.last_name}},
<br><br>
Your voucher codes:
<ul>
{{#each order.line_items}}
<li>{{name}}: {{#each vouchers}} {{code}}{{#unless @last}},{{/unless}}{{/each}}</li>
{{/each}}
</ul>
Regards,<br>
Voucherify.io Team
Dear {{customer.first_name}} {{customer.last_name}},
<br><br>
Your voucher codes:
<ul>
{{#each order.line_items}}
<li>{{name}}:<br/>
  {{#each vouchers}}<img src="{{assets.qr.url}}"/>{{#if @last}}{{else}}</br></br>{{/if}}{{/each}}</li>
{{/each}}
</ul>
Regards,<br>
Voucherify.io Team

3. Let it roll

The app works in background. Once an order is paid an email including voucher codes is sent to the customer. The app marks processed orders with a tag: voucher_sent if everything worked fine or voucher_failed if there were some troubles.

Troubleshooting

A voucher_fail tag is usually caused by an error in the configuration (e.g. invalid API keys, not existing campaign) or because there are no more unpublished vouchers in the provided campaign. If you are struggling with sorting that out, don't hesitate to contact our support. We are here to help.

Questions?

We're always happy to help with code or other questions you might have! Search our site for more information or contact us here.