Skip to content
AE DIGITAL
Email MarketingBy 6 min read

Unique coupon codes per contact with Brevo: keep discounts off coupon sites

How to generate single-use discount codes in Shopify, load them into a Brevo coupon collection and give each contact their own, with expiry dates, reminders and usage tracking.

Article cover: the word “%” next to a glowing icon on a violet space background

Why shared codes end up on coupon sites

A unique coupon code is a different code for each recipient, valid only once. It does one specific job: stopping a discount meant for your email list from being used by anyone. A code that's the same for everyone, like BLACK20, leaves your list within hours. A subscriber forwards it or posts it in a group, or a coupon browser extension picks it up at checkout and offers it to other shoppers on your site.

The damage is twofold. Customers who would have paid full price get the discount, and campaign data becomes unreliable because not every order with that code came from the email. For welcome, win-back or early access discounts, unique codes fix both problems.

Single-use codes: how to generate them in Shopify

One discount, many codes

In Shopify a discount code has its own rules: discount type, products or collections, minimum amount, dates, combinations. For unique codes you don't create hundreds of separate discounts: you create one discount with the rules you want and add many codes to it. The Admin API does this with the discountRedeemCodeBulkAdd mutation, up to 250 codes per call, asynchronously. Several App Store apps offer the same operation with an interface and CSV export.

Settings to check

  • One use per customer, so the same customer can't use several codes from the same set.
  • Start and end dates that match the campaign.
  • Combinations: decide whether the code stacks with active automatic discounts. Combination rules are explained in our article on Shopify automatic discounts and codes.
  • Codes that can't be guessed: a readable prefix plus a random part of at least 8 characters, for example BF26-K7Q2M9XD.

Before sending, place a test order with one code and try to use it again: it must be rejected.

Coupon collections in Brevo

Brevo distributes codes through coupon collections. A few points worth knowing, all from Brevo's documentation:

  • Brevo doesn't generate codes: it uses them in your messages, but they have to be created and synced with your store;
  • the feature is available to users of the API or one of the compatible ecommerce plugins;
  • codes are uploaded in a CSV file of up to 2 MB;
  • each campaign recipient gets their own unique code;
  • every collection has a name and a required default coupon;
  • you can set an expiry date and email alerts when remaining codes or days to expiry drop below a threshold.

The default coupon deserves attention: it should be a code you don't mind seeing in circulation, for example a small discount with a total usage limit. Always upload more codes than expected recipients and turn on the remaining-codes alert. If the Brevo and Shopify integration isn't set up yet, start with our Brevo and Shopify integration guide.

Inserting the code in the email

In Brevo's drag-and-drop editor you turn on developer mode and, in the Design tab, define a feed that points to the coupon collection. If the feed is called unique, you insert the code in the text with {{ feed.unique.coupon }}. HTML templates use the same variable.

A few practical rules:

  • put the code in text, not in an image, so it can be copied on a phone;
  • place it next to the button and repeat the expiry date beside it;
  • send a test to yourself and a colleague: the two codes must be different;
  • check the plain-text preview, where the full code must appear.

Expiry dates and reminders

A code with no expiry is an open-ended cost. Set the end date both in the Shopify discount and in the Brevo collection, and state it clearly in the email.

Reminders work better as an automation than as a campaign: 48 hours before expiry, email only the people who received a code and haven't ordered yet. To exclude buyers you need order data in Brevo, which comes from the store integration. The same pattern works for reserved offers such as Black Friday early access for VIP customers.

Tracking usage

Three numbers tell you whether the system works:

  1. redemption rate: codes used divided by codes sent, per campaign;
  2. revenue and margin of orders with a code, from Shopify's sales by discount report;
  3. unusual redemptions: a unique code used by a customer with a different email from the one it was sent to.

The third is the leak signal. A few cases are normal, such as a customer forwarding the code to a family member; many cases from the same send mean codes are being collected somewhere. In that case you can deactivate the discount and all its codes in Shopify in one step.

Common mistakes with unique codes

  • Codes exported from one discount and loaded into a collection for another campaign: the customer gets a code with different rules from those described in the email.
  • The same CSV uploaded twice: two recipients can get the same code, and the second finds it already used.
  • Shopify discount expiring before the Brevo collection: emails keep going out with codes the checkout rejects.
  • Codes sent to contacts without marketing consent, just because they were on the customer list.
  • No per-customer limit: someone who receives several emails from the same set collects several codes and uses them all.

Almost all of these are avoided with one simple rule: one Brevo collection for each Shopify discount, with the same name and the same dates.

Alternative: links with the discount applied

Shopify creates links that apply a code at checkout: open the discount and use Promote > Get a shareable link. Customers don't have to type anything, which matters on mobile.

The link, though, is only as safe as the code inside it. With a generic code it spreads like the code. With a unique code you can build a link per contact by putting the feed variable in place of the code, getting the convenience of the link and the protection of a single-use code. Always test the link in a private window before sending.

For the full picture of flows and campaigns, see our ecommerce email marketing guide. If you want to set up unique codes, collections and automations with someone who does it every day, take a look at our Brevo email marketing service.

Frequently asked questions

Does Brevo generate unique discount codes itself?

No. Brevo states that it doesn't generate codes: it imports them from a CSV file (up to 2 MB) into a coupon collection and assigns one to each recipient. The codes have to be created first on your ecommerce platform, for example Shopify.

How do I create hundreds of single-use codes in Shopify?

Create one discount with the rules you want, then add codes in bulk with the Admin API (the discountRedeemCodeBulkAdd mutation, up to 250 codes per call) or with an App Store app that uses it. Then export the codes to CSV.

What happens if the Brevo collection runs out of codes?

The collection always has a default coupon, and Brevo can email you when remaining codes drop below a threshold. Set that alert and upload more codes than expected recipients, with some headroom.

Is a link with the discount applied safer than a code?

Only if the link contains a unique code. A link with a generic code gets shared just like the code itself. The benefit of the link is that customers don't need to type anything at checkout.

Sources

  1. Send unique discount or coupon codes in emails and SMS messages — Brevo Help Center
  2. Coupon collections — Brevo Developers
  3. Create a coupon collection — Brevo Developers
  4. discountRedeemCodeBulkAdd — Shopify Developers
  5. Discount codes — Shopify Help Center

Related articles

Tell us what isn't working.

We reply within one business day with a first opinion and, if it makes sense, a quote.

Write to us