Documentation
Complete guide for installing, configuring, and using Gift Cards for Amelia (v2.0.0).
Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Amelia Booking Plugin v9+ — any license (Starter, Standard, Pro, or Premium). Requires the Finance module (coupons).
- A Stripe, Square or PayPal account, or WooCommerce — to take payments
- SSL certificate — required for payments (HTTPS)
Installation
- Download the
amelia-gift-cards.zipfile from your LemonSqueezy account - Go to WordPress Admin → Plugins → Add New
- Click Upload Plugin and select the ZIP file
- Click Install Now, then Activate
After activation, you should see a "Gift Cards" menu in your WordPress admin sidebar.
Quick Start
Get your gift card system running in under 10 minutes:
- Activate the plugin — an admin notice appears with a link to the License page and information about the Divi module
- Configure payments — Stripe/Square auto-detected from Amelia (Pro/Premium) or enter keys manually
- Create a gift card type — go to Gift Cards → Types and create your first type
- Add the form to a page — insert
[agc_gift_card_form]on any page - Test a purchase — use test mode to verify everything works
Payment Setup
v3.19 Buyers can pay with Stripe, Square, PayPal or at your WooCommerce checkout; Mollie, Razorpay and Barion are coming soon. The plugin uses the payment methods you have already set up in Amelia: same keys, same test or live mode, same currency. A method can be offered once Amelia itself would take payments with it:
- it is enabled in Amelia → Settings → Payments;
- it is switched on in Amelia → Features & Integrations and covered by your Amelia licence;
- the keys of Amelia's current mode (test or live) are filled in;
- it accepts your shop's currency.
In Gift Cards → Settings → Payment, tick the methods buyers can choose and drag the rows into the order you want: the first one is preselected. Each row shows what Amelia reports (mode, currency, and why a method cannot be offered, with a link to fix it). With a single method the purchase form looks as before; with several, buyers pick one before paying.
Stripe Setup
Automatic (Pro / Premium)
If you have Amelia Pro or Premium, the plugin automatically uses your existing Stripe configuration from Amelia. No additional setup required.
Manual (Starter / Standard)
If you have Amelia Starter or Standard:
- Go to Gift Cards → Settings → Payments
- Enter your Stripe Publishable Key and Secret Key
- Enable Test Mode for initial testing
- Click Save & Verify to test the connection
v3.19 With Amelia's keys, Stripe follows its switch in Amelia: when it is off there, the gift card form no longer offers it; turn it on in Amelia, or choose your own keys in Gift Cards → Settings → Payment. Like Amelia, Stripe only offers payment methods confirmed during checkout: SEPA Direct Debit, other bank debits and vouchers are left out. Unfinished Stripe payments are checked every 15 minutes, so a buyer who pays with iDEAL or Klarna and never comes back still gets the gift card. Webhook (recommended): add the endpoint shown in the settings in Stripe's test mode and live mode, and paste each signing secret in its field.
Square Setup
Square is also supported as a payment provider:
- Set up Square in Amelia → Settings → Payments: the plugin reads its configuration from there
- In Gift Cards → Settings → Payment, tick Square
- Open its details to check the configuration read from Amelia (application, location, mode, currency)
v3.19 The currency of the Square location selected in Amelia must be Amelia's currency: otherwise Square refuses the payments, so it is not offered. When Square's access token expires, the plugin renews it through Amelia. Google Pay and Apple Pay can be ticked in the Square settings (off by default); Apple Pay also needs your domain registered with Square, as described in Amelia's Square guide. A refund made in Square is emailed to you; the gift card stays active until you deactivate it.
PayPal v3.19
Set up PayPal in Amelia (client ID and secret of the sandbox or live app), then tick it. Buyers pay in PayPal's window without leaving your page; your site captures the payment as soon as they approve it, then shows the confirmation page. PayPal sends no notification to your site: a payment approved in a window closed too early is captured by the check of unfinished payments. In live mode PayPal only pays a verified Business account: until yours is verified, PayPal holds the payments; the plugin follows them, emails you what to do in PayPal, and issues each gift card once PayPal completes its payment.
Mollie, Razorpay and Barion Coming soon
Amelia also takes payments with Mollie, Razorpay and Barion; the plugin will offer them in a coming update. Until then they are shown in Gift Cards → Settings → Payment with a Coming soon badge and cannot be ticked, even when they are set up in Amelia.
WooCommerce v3.19
Turn on Amelia's WooCommerce integration, then tick WooCommerce. Amelia then also sends bookings through WooCommerce. The plugin creates a hidden virtual product for gift cards: each card becomes a cart line priced by the plugin, and buyers pay with any payment method of your shop. Your WooCommerce currency must be the same as Amelia's, and a cart cannot hold a gift card and a booking together.
The gift card is issued when the payment completes, when you mark the order Completed, or when it moves to Processing from On hold, Pending payment or Failed with a method other than cash on delivery. So a bank transfer issues the card once you mark the order Processing, and cash on delivery once you complete it. The code appears on the order, in the customer's account and in WooCommerce's emails, unless the card is delivered physically.
v3.19 A gift card is issued only for what the order really paid: shop coupons never apply to a gift card, and a discount, a negative fee or a currency switched at checkout is refused or leaves the order to you (you are emailed, no card is issued). A refund of a gift card order, even partial, is emailed to you; the card stays active until you deactivate it. A bank transfer or a cheque confirmed weeks later still issues its card.
Unfinished payments and payments needing attention v3.19
Payments left unfinished (a window closed too early, a missed notification) are checked with the payment provider every 15 minutes, or at once with Check unfinished payments now in Settings → Payment. When a payment was taken but its gift card could not be issued, the plugin tries again with growing waits and emails you after 5 tries with the purchase details. After 10 tries, or at once when trying again cannot help, it stops and lists the payment under Payments needing attention at the top of Settings → Payment: create the gift card in Gift Cards → Manual Gift Card or refund the buyer, then click Mark as handled. The Payment Gateways card of Diagnostics counts these payments and checks your gateways' keys.
*.paypal.com, *.paypalobjects.com) for scripts and frames, or its window will not open.General Settings
Navigate to Gift Cards → Settings → General to configure:
- Default Currency — auto-detected from your site, changeable
- Expiration Period — default 365 days, or tick Gift cards never expire to issue cards with no expiry date at all. Required where expiring gift cards are prohibited, such as Canada. The same choice is available per gift card type, which overrides this default.
- Code Format — prefix and pattern for gift card codes (e.g., GC-XXXXXXX)
- Suggested Amounts — pre-defined amounts shown in the purchase form (editable since v1.1)
- Custom Amounts — allow customers to enter any amount within a min/max range
- Hide exclusions on the form — keep the « Not valid for the following » list off the public form (still shown on the success page and confirmation email). Added in v1.4.
- Recipient email v3.14 — optional by default for a gift card sent by email, so a buyer can keep the surprise: left empty, the gift card email goes to the buyer, who hands it over, and they still get their purchase confirmation. Tick Require the recipient email for gift cards delivered by email to make it mandatory. It is always optional for a card collected in person or sent by post.
Text & Language Presets
Every label, button and message on the public form and emails is editable. Open Gift Cards → Settings → Text and either translate strings one by one, or apply a one-click language preset:
- English — default
- French — added in v1.2
- Spanish — added in v1.2
- German — added in v1.3
- Bulgarian — added in v3.13
You do not pick the language yourself: each visitor is served the one matching your site’s language, and every gift card remembers the language it was bought in — so a card bought in French keeps sending French emails, whatever language the site is showing later.
Email Settings
Configure email delivery at Gift Cards → Settings → Email:
- From Name — sender name for emails
- From Email — sender email address
- Reply-To Email — where replies go
- Enable/disable specific email types (purchase confirmation, recipient notification, etc.)
Advanced Settings
- Debug Mode — enable detailed logging for troubleshooting
Customize Menu
Gift Cards → Customize brings every visual setting in one place. The menu has two tabs: Visual Template for the public purchase form, and Mail for the recipient and purchaser emails. Both tabs offer a live preview that reflects your changes as you edit. New in v2.0
Visual Template tab
Designs the public purchase form. Each of the 6 built-in templates (Spa, Restaurant, Beauty, Fitness, Medical, Generic) can be duplicated and edited independently — your customizations live alongside the originals so you can always revert.
- Duplicate / edit / delete templates without touching the originals
- Primary & secondary colors per template, with a live preview of the form
- Font — pick from 5 web-safe fonts (Arial, Georgia, Helvetica, Times New Roman, Verdana)
- Button style — 3D, Flat or Outline. Applied globally to step badges, amount selectors and action buttons.
- Visibility — disable templates you don't use to keep the gift card type selector tidy
Mail tab
Designs the recipient and purchaser emails. The colors come from the gift card type that's being sent — pick a type in the preview selector to see what each customer would actually receive.
Starter presets
Three one-click presets bundle typography, layout and spacing as a sensible starting point:
- Classic — serif heading, generous spacing, traditional look
- Minimal — sans-serif, tight spacing, thin colored band
- Bold — large header, heavy weight, prominent type
Typography
- Sizes in pixels — base, heading, code block
- Weights, line-height, letter-spacing
- Optional Google Fonts URL — paste a
@importURL; web-safe fallbacks always render if a mail client blocks the font
Layout
- Drag-and-drop sections — reorder header, greeting, message, code, details, summary, restrictions, footer
- Per-section visibility — hide what you don't need
- Per-section spacing — fine-grained padding/margin control
Branding
- Logo upload — JPG/PNG up to 500 KB (200×80 px recommended)
- Free-form footer HTML — for legal mentions, contact info or seasonal offers
- Social links — Twitter / X, Facebook, Instagram, LinkedIn, YouTube, TikTok
- Custom CSS — for fine adjustments not covered by the controls above
- Card visual v3.16 — your own illustrated gift card picture, shown in the recipient's email between the personal message and the code
Live preview
A gift card type selector at the top of the preview lets you instantly visualize the actual rendering for each type — no need to send test emails to verify your branding.
Next to it, a second selector chooses which email you are looking at: the gift card sent to the recipient, the purchase confirmation sent to the buyer, or the balance update sent after each booking. v3.13
HTML Email tab v3.14
When the visual controls are not enough, this tab lets you replace the emails with your own raw HTML — your existing house template, pasted in. Switch on Enable custom HTML, write your markup, and use the %token% list shown beside the editor to drop in the code, the amount, the recipient's name and so on. Values typed by the buyer, such as names and the personal message, are inserted safely: they cannot break your layout.
Each language has its own template, on its own sub-tab. Buyers receive the template for the language they bought in; a language you leave untouched falls back to English, and if you never write an English one either, the built-in design is used. The on/off switch is shared — it covers every language at once.
The balance update template has its own variables: %amount_used% (the amount just spent), %remaining_balance%, %formatted_amount% (the card's original value) and %formatted_expiry_date%, alongside the code, the recipient's name, your site details and the card colours. Purchase details such as the buyer or the personal message are not available there — that email is sent at booking time.
The purchase emails also have per-purchase variables: %amount_label% (the amount's tile label, v3.16), %card_visual_url% (your card picture, v3.16), %invoice_request_notice% (the line confirming an invoice request, purchase confirmation only, v3.16), %supplements% (the supplements included, names only, v3.17) and %supplements_detail% (with their prices, purchase confirmation only, v3.17). %supplements_detail% stays empty in the gift card email, so a gift never shows prices.
Send test sends the template of the email and language you are on, filled with placeholder values. Save before testing — the test reads what is stored, not what is on screen.
Creating Gift Card Types
Gift card types define the look, amounts, and restrictions for your gift cards.
- Go to Gift Cards → Types
- Click Add New Type
- Fill in the name, description, and select an email template
- Configure amounts and restrictions
- Save
Amounts & Pricing
For each type, you can configure:
- Suggested Amounts — pre-set tiles (e.g., $25, $50, $100, $200)
- Custom Amount — allow free-form entry with min/max limits
- Tile labels v3.16 — a label above the price on each amount tile, e.g. “1h experience · 2 people”. It is repeated in the emails, on the confirmation page, in All Gift Cards and in exports.
- Supplements v3.17 — priced extras the buyer adds on top of the amount, such as an apéro board or a bottle of champagne, each with a maximum quantity (1 shows a checkbox, more a − / + selector). They are added to the price and to the value of the gift card, and listed in the emails, on the confirmation page, in All Gift Cards and in exports.
Restrictions
Restrict gift cards to specific Amelia services:
- Services — limit to specific services
- Packages — limit to specific packages
- Events — limit to specific events
Email Templates
The plugin ships with 6 built-in templates. Each one defines a primary and secondary color, and the recipient email is automatically themed to match the gift card type that was bought:
- Spa & Wellness — calming greens
- Restaurant & Gastronomy — warm browns / oranges
- Beauty Salon — elegant pinks
- Fitness & Sport — energetic blues
- Health & Medical — professional teals
- Generic — versatile purples
To restyle a template — colors, font, button style, email typography and branding — use the new Customize menu. Duplicate any built-in template, edit it independently and the originals stay untouched.
Success Page
After a successful purchase, the buyer lands on a redesigned success page that visually matches the recipient email — a clean 600 px white card themed by the gift card type's primary/secondary colors. Redesigned in v1.5
- Prominent code box with a working copy-to-clipboard button
- Structured summary table — amount, recipient, expiration, restrictions
- Themed personal message and restrictions blocks
- Coupon-pending banner if the Amelia coupon is still being created
- How-to-use instructions and next-steps preserved from previous versions
WordPress Shortcode
Add the gift card purchase form to any page or post:
[agc_gift_card_form]
With Parameters
[agc_gift_card_form
title="Buy a Gift Card"
description="Give the perfect gift"
amounts="25,50,100,200"
allow_custom="yes"
min_amount="10"
max_amount="500"
currency="EUR"
css_class="my-custom-class"
]
Divi Builder Module
If you use the Divi theme, a native Gift Card module is available:
- Edit a page with Divi Builder
- Click Add Module and search for "Gift Card"
- Configure the design options (colors, fonts, spacing)
- Save and publish
Frontend Form
The purchase form guides customers through 3 steps:
- Choose Amount — select a preset or enter a custom amount
- Recipient Details — name, email, personal message
- Payment — secure checkout with Stripe (3D Secure), Square, PayPal or your WooCommerce shop
After payment, the recipient receives a beautifully designed email with their gift card code.
Invoice requests v3.16
Buyers can tick I need an invoice on the form and enter their billing details. You receive them by email and issue the invoice from your own accounting tool: the plugin does not create invoices, and the Stripe receipt is a payment receipt, not an invoice. It is off by default: turn it on under Settings → Delivery → Invoice requests, choose which billing fields are hidden, optional or required, and let a gift card type always offer it or never. The request shows in All Gift Cards and in exports, and the buyer sees a confirmation line in their purchase confirmation and on the success page.
Dashboard
The dashboard (Gift Cards → Dashboard) provides:
- Sales Overview — total revenue, number of cards sold, average value
- Transaction History — filterable list of all transactions
- Email Stats — delivery rates, open rates
- Quick Actions — create manual cards, export data
Rolling Balance
Since v3.0, every gift card issued by the plugin carries a rolling balance: one card pays for several Amelia bookings until its value is used up — a behavior that native Amelia coupons do not provide. Since v3.15, what is left after a booking moves to a new code, which the customer receives by email.
How it works in practice
- A customer buys a $100 gift card. The recipient gets a code worth $100.
- The recipient books a $30 service in Amelia and enters the code as a coupon. Amelia applies the full $30 discount.
- The plugin records the redemption in its transaction ledger and closes that code at its original value, so Amelia keeps showing the booking as paid. The remaining $70 moves to a new code.
- The customer automatically receives an email showing Used: $30 / Remaining: $70 and the new code.
- Later, a $70 booking made with the new code uses it up. That code is closed too, still at its value, and no balance email is sent: Amelia already confirms the booking.
Automatic balance email
After each redemption, the plugin sends a transactional email summarizing what was just used, how much remains on the card and, when the balance moved, the new code. It goes to the card's recipient; for a card with no recipient email, such as one handed over in person, to the customer who made the Amelia booking, or else to the buyer v3.17. Since v3.13 it is built from the same design as your other emails — your logo, colours, fonts and footer from Customize → Confirmation Page & Mail, and the accent colour of the gift card type it belongs to.
The wording itself — the greeting, the “you just used” line, the remaining-balance line and the closing instruction — is yours to edit per language under Customize → Text, in the Email — Balance Update Notification group. Under Settings → Gift Card Balance you can turn the email off (one that gives a new code is always sent) and choose whether a booking that uses up the whole balance sends one too — off by default since v3.17.
Where to see the ledger
Open Gift Cards → All Gift Cards and press Details on any gift card to see its full record: the initial purchase, buyer and recipient details, every redemption with the matching Amelia booking ID, the running balance after each event, and every email that was sent. The Logs view shows the same events across all gift cards with date/type filters.
Manual Gift Card Creation
Create gift cards directly from the admin:
- Go to Gift Cards → Add New
- Fill in the amount, recipient details, and optional message
- Choose whether to send the notification email
- Click Create
Importing existing gift cards v3.12
Moving to Amelia from another platform? Gift Cards → Import brings your existing cards across from a CSV file — including cards your customers have already partly spent, which keep exactly the balance they have left.
Each card is recreated at its original face value, and the amount already used is recorded against it as a redemption. A card sold for 150 with 138.70 left arrives worth 138.70, and its history shows the 11.30 that was already spent. Nothing is emailed to anyone unless you ask for it.
The three steps
- Choose your file. A CSV with one gift card per row and a header row, separated by commas or semicolons. Exports from Squarespace, Square and Shopify are recognised automatically. A sample file is available to download.
- Check the columns. The detected mapping is shown so you can correct anything that is wrong, along with the import options below.
- Review and import. A dry run first: how many cards will be imported, skipped or rejected, the total original value, the balance still redeemable and how much was already spent — plus a per-row list of anything needing attention. Nothing is created until you press Import these gift cards, and the import then runs in batches with a progress bar.
Which columns are needed
Only the gift card code and the initial value are required. Everything else is optional: missing names are derived from the email address, and a missing remaining value is treated as unspent. Column names are matched ignoring case, spaces, underscores and hyphens, and each field accepts several common names — the full list is shown on the import screen itself.
GIFT CODE— the code your customers already hold. Required, and kept exactly as written, including its capitalisation.INITIAL VALUE— what the card was originally worth. Required. May carry a currency code or symbol (226.00 CAD,$150.00) and either decimal separator.REMAINING VALUE— what is still on the card. Leave it out and the card is imported unspent.USAGE—FULL,PARTIALorDEPLETED. Used to mark a card as fully spent when there is no remaining-value column.PURCHASER EMAIL,RECIPIENT EMAIL,PURCHASER NAME,RECIPIENT NAME,PURCHASE DATE,LAST ACTIVITY,MESSAGE— all optional.
Import options
- Expiry — imported cards carry no expiry date by default, since they were sold under your previous system's terms. You can instead set a number of days from the import, or one fixed date for every card.
- Fully spent cards — off by default. Switch it on to import zero-balance cards too, so an old code presented at the counter is recognised as spent rather than reported as unknown.
- Gift card type — attach a type to apply its service, package and event restrictions to every imported card.
- Name when missing — used when your file has no name column.
- Emails — off by default, and worth leaving off: these people already received their card from your previous system.
Export
Export gift card data from the Dashboard (CSV report) or from Gift Cards → Logs (CSV log export). Filter by date range or status before exporting. The report ends with the columns added in recent versions: Origin (v3.15.1), Amount_Label and the billing details (v3.16), then Supplements (v3.17). Supplements are already included in Amount: do not add them twice.
Logs
View all system activity at Gift Cards → Logs:
- Filter by action type, date range, user, or gift card
- View detailed log entries with timestamps
- Export logs in CSV format
- Log stats: total entries, entries by type, error rate
Shortcode Reference
[agc_gift_card_form]
Main purchase form with Stripe integration.
| Parameter | Default | Description |
|---|---|---|
title | — | Form title displayed at the top |
description | — | Description text below the title |
amounts | "50,100,150,200" | Comma-separated preset amounts |
allow_custom | "yes" | Allow custom amounts ("yes" / "no") |
min_amount | "10" | Minimum custom amount |
max_amount | "1000" | Maximum custom amount |
currency | "EUR" | Currency code |
template | "default" | Email template to use |
css_class | — | Additional CSS class |
Developer Hooks
WordPress actions and filters for connecting gift cards to another system — a CRM, an accounting tool, or a second voucher platform. Add these to your theme's functions.php or a small plugin.
agc_amelia_coupon_created
Fires once per Amelia coupon, immediately after it is created and linked to the gift card. This is the hook to use when another system needs a matching code: it carries the code, the amount and the expiry date, so no database lookup is needed. It fires for online purchases and for gift cards created by hand in the admin.
| Parameter | Type | Description |
|---|---|---|
$coupon_id | int | Amelia coupon ID |
$gift_card_id | int | Gift card ID |
$gift_card_data | array | code, amount, expiration_date, gift_card_type_id — added in v3.8.0 |
add_action( 'agc_amelia_coupon_created', function ( $coupon_id, $gift_card_id, $data ) {
wp_remote_post( 'https://example.com/api/vouchers', array(
'timeout' => 15,
'headers' => array( 'Content-Type' => 'application/json' ),
'body' => wp_json_encode( array(
'name' => $data['code'],
'value' => (float) $data['amount'],
'expires' => $data['expiration_date'],
) ),
) );
}, 10, 3 );
Declare 3 as the last argument, as above, or the gift card data will not reach your callback. Listeners registered with 1 or 2 arguments keep working unchanged.
Keep the callback fast. The hook runs inside the purchase request, so a slow API call becomes a slow confirmation screen for your customer. Schedule anything lengthy with wp_schedule_single_event().
Failures are contained, and therefore silent. An exception thrown by your callback is caught and logged rather than propagated — a gift card that has been paid for must not be undone by a failing integration. The trade-off is that the customer sees nothing, so log failures on your side and reconcile.
One edge case worth knowing: if a generated code already exists in Amelia's coupons table, the plugin links the existing coupon instead of creating one, and this hook does not fire. Codes are random and checked for uniqueness, so this is very rare — but if your systems must never drift, reconcile periodically, or switch on the purchase notification email below as a second channel.
agc_gift_card_created
Fires after the gift card is stored, before the Amelia coupon exists. Use it only for work that does not depend on the coupon; otherwise prefer agc_amelia_coupon_created above.
| Parameter | Type | Description |
|---|---|---|
$gift_card_id | int | Gift card ID |
$gift_card_data | array | Gift card data as stored |
agc_fulfilment_email (filter)
Overrides the address that receives the shop notification, ignoring the value set in Settings → Delivery. Useful for routing notifications per gift card type, or into a ticketing system's inbox.
add_filter( 'agc_fulfilment_email', function ( $email ) {
return 'vouchers@example.com';
} );
agc_invoice_request_offered (filter)
Decides whether a purchase form shows the I need an invoice box, after the global setting (Settings → Delivery → Invoice requests) and the gift card type's own setting. It runs both when the form is displayed and when the payment is created, so returning false also drops a request sent anyway. The plugin never creates the invoice: the billing details reach you in the shop notification.
| Parameter | Type | Description |
|---|---|---|
$offered | bool | Whether the box is offered, from the settings |
$type_id | int | Gift card type of the form, or 0 when it has none |
$mode | string | The type's own setting: inherit, always or never |
add_filter( 'agc_invoice_request_offered', function ( $offered, $type_id, $mode ) {
// Offer invoices on the corporate gift card type only.
return 42 === $type_id;
}, 10, 3 );
agc_gift_card_code (filter)
Rewrites a gift card code as it is generated, for when the code has to follow a format another system expects. For the common case — simply putting the amount at the end of the code — you do not need this filter: switch on Settings → General → Append the amount to the code and every new code becomes GIFT-A3B7-9K2M-195.
| Parameter | Type | Description |
|---|---|---|
$code | string | The generated code, with the amount already appended if that setting is on |
$context | array | Generation context — see the keys below |
| Key | Type | Description |
|---|---|---|
amount | float | The card's face value. Any delivery fee is excluded, so this matches the coupon's deduction rather than what the buyer paid |
currency | string | Currency code, uppercase. Never written into the code unless you add it yourself |
gift_card_type_id | int | Gift card type, or 0 when the purchase is not tied to one |
prefix | string | The prefix actually in use, after your setting is applied |
source | string | Where the card came from: a customer purchase, one created by hand in the admin, or a legacy form |
attempt | int | Retry counter, starting at 1 |
add_filter( 'agc_gift_card_code', function ( $code, $context ) {
if ( 'purchase' !== $context['source'] || empty( $context['amount'] ) ) {
return $code;
}
return sprintf(
'VOUCHER-%s-%s',
(int) $context['amount'],
strtoupper( wp_generate_password( 8, false, false ) )
);
}, 10, 2 );
Return something that varies. This filter runs inside the loop that guarantees a code is unique, and the value you return is the one checked against the database. A filter that always returns the same string can never become unique, so the loop gives up and the purchase fails after the customer has been charged — vary your code, for example with $context['attempt'].
Stay within the allowed characters. A returned code must be 64 characters or fewer and use only letters, numbers, dots, dashes and underscores; anything else is ignored in favour of the generated code, with a note in the log. The code is never changed to upper case, because Amelia matches coupon codes exactly. These limits exist because the code is stored in two tables and appears in the buyer's confirmation link.
agc_append_amount_to_code (filter)
The code equivalent of the Settings → General checkbox, so you can switch the amount suffix on for some gift cards and not others. It receives the current setting as a boolean and returns the value to use.
agc_recipient_email_required (filter) v3.14
The code equivalent of the Settings → General → Recipient email checkbox, for example to require the address for some gift card types only. It receives the current setting as a boolean and returns the value to use. It only concerns email delivery: the address is never required for a card collected in person or sent by post.
agc_gift_card_balance_updated v3.13
Fires after a booking has drawn on a gift card, once the debit is committed. This is the hook for keeping another system in step with the remaining balance — a loyalty account, an accounting ledger, a dashboard. It is also what triggers the built-in balance email, so you can switch that off under Settings → Gift Card Balance and send your own instead.
| Parameter | Type | Description |
|---|---|---|
$gift_card | array | The gift card record, including code, recipient_email and locale — the language it was bought in |
$amount_consumed | float | Amount just charged to the card |
$new_balance | float | Balance remaining after this charge |
$new_gift_card | array|null | Since v3.15: the card that now carries the remaining balance under a new code (with its code and amount), or null when the balance stayed on the same code or nothing is left |
$context | array | Since v3.17: booking_id and customer_email, the email of the Amelia customer who made the booking (empty when unknown) |
add_action( 'agc_gift_card_balance_updated', function ( $card, $used, $left, $new_card = null, $context = array() ) {
wp_remote_post( 'https://example.com/api/balances', array(
'timeout' => 15,
'headers' => array( 'Content-Type' => 'application/json' ),
'body' => wp_json_encode( array(
'code' => $card['code'],
'used' => $used,
'remaining' => $left,
'new_code' => $new_card ? $new_card['code'] : null,
'booked_by' => isset( $context['customer_email'] ) ? $context['customer_email'] : '',
) ),
) );
}, 10, 5 );
The built-in email goes to the card's recipient; for a card with no recipient email, such as one handed over in person, to customer_email, or else to the buyer. An email that gives a new code is always sent. When the booking uses up the whole balance, none is sent unless Also send it when the booking uses up the whole balance is ticked under Settings → Gift Card Balance. Callbacks written for three arguments keep working; register with 10, 5 to receive all five.
Do not throw. This runs on the commit path of the booking's database transaction. As with the hooks above, keep it quick and push anything slow onto wp_schedule_single_event().
A safety-net task re-checks balances every few minutes and repairs any redemption the live hook missed. It deliberately does not fire this action, so nobody gets emailed about a booking from weeks ago. If your integration would rather hear about those too, opt in with the agc_balance_catchup_send_usage_emails filter — return true and be aware the built-in email goes out with it.
agc_resolved_language (filter) v3.13
Decides which language a customer-facing text or email renders in. The plugin works it out on its own — the language stored on the gift card first, then Polylang, WPML, and finally the WordPress locale — so you only need this filter when your site decides language some other way.
add_filter( 'agc_resolved_language', function ( $language, $requested_locale ) {
return 'bg';
}, 10, 2 );
Return one of en, fr, es, de, bg. Anything else is ignored and the plugin's own choice stands, so a typo degrades quietly instead of breaking an email.
agc_payment_providers (filter) v3.19
The payment methods the plugin knows, as an array of ID ⇒ class name: stripe, square, paypal, woocommerce, plus mollie, razorpay and barion, which are not offered yet (coming soon). A class you add must implement the plugin's payment gateway interface. To hide a method from buyers, prefer the next filter.
agc_payment_provider_availability (filter) v3.19
Decides whether a ticked method can be offered to buyers. It receives what the plugin found (available, reason, message, mode, currency…) and the method ID. Set available to false to hide a method from the purchase form, for example WooCommerce while Amelia's WooCommerce integration stays on for bookings. Payments already started still finish.
add_filter( 'agc_payment_provider_availability', function ( $availability, $id ) {
if ( 'woocommerce' === $id ) {
$availability['available'] = false;
}
return $availability;
}, 10, 2 );
agc_paypal_sdk_query_args (filter) v3.19
The query of the PayPal buttons script (client-id, currency, intent, components, disable-funding) and the mode (test or live). By default the buttons offer PayPal only, like Amelia's booking form: remove a value from disable-funding to show that option.
add_filter( 'agc_paypal_sdk_query_args', function ( $args, $mode ) {
// Show the card button next to PayPal.
$funding = array_diff( explode( ',', $args['disable-funding'] ), array( 'card' ) );
$args['disable-funding'] = implode( ',', $funding );
return $args;
}, 10, 2 );
agc_gateway_request_payload (filter) v3.19
The body sent to PayPal when a payment starts, with the method ID and the stored payment order. Use it to add a field the provider accepts. Do not change the amount, the currency or the order reference: the payment is checked against them before the gift card is issued.
agc_wc_should_issue_gift_card (filter) v3.19
Decides whether a WooCommerce order issues its gift cards now. It receives the plugin's decision, the order and what triggered the check (payment_complete, completed, status_changed or reconcile). Return true to issue on a status the default rule waits on, or false to wait until the order is completed.
agc_wc_gift_card_product_args (filter) v3.19
The hidden WooCommerce product used for gift cards, when the plugin creates it: name and tax_status (none by default, since a gift card is usually taxed when it is spent). Keep it untaxed unless the sale itself must be taxed: with prices entered without tax, buyers then pay the tax on top of the card's value; with prices entered with tax, a tax-exempt buyer pays less and gets no gift card. Diagnostics warns about a taxable product.
agc_stripe_excluded_payment_method_types (filter) v3.19
The Stripe payment methods left out of the gift card form, like in Amelia's booking form: the ones that confirm hours or days after checkout (sepa_debit, bacs_debit, us_bank_account, boleto, oxxo, konbini…). Return an empty array to offer every method enabled in your Stripe Dashboard; the gift card of a payment confirmed later is then issued by the webhook or the check of unfinished payments.
add_filter( 'agc_stripe_excluded_payment_method_types', function ( $types ) {
// Offer SEPA Direct Debit again.
return array_values( array_diff( $types, array( 'sepa_debit' ) ) );
} );
agc_wc_unpaid_processing_methods (filter) v3.19
The WooCommerce payment methods whose Processing status does not mean the order is paid: array( 'cod' ) by default (cash on delivery). Their gift cards are issued when the order is completed. Add the ID of any other offline method that moves orders to Processing before you are paid. It receives the list and the order.
agc_payment_start_rate_limit (filter) v3.19
How many payments one visitor (one IP address) can start in 10 minutes: 60 by default, 0 turns the limit off. Raise it if your site is behind a proxy or CDN that hides visitors' addresses, since they then all share one limit.
add_filter( 'agc_payment_start_rate_limit', function () {
return 300;
} );
agc_payment_order_issued v3.19
Fires once a gift card has been issued for a PayPal or WooCommerce payment. It receives the payment order (order_ref, provider, amount_minor, currency…) and the card (gift_card_id, code). Stripe and Square payments do not go through an order: to act on every card, use agc_amelia_coupon_created.
add_action( 'agc_payment_order_issued', function ( $order, $card ) {
error_log( sprintf( 'Gift card %s issued for %s payment %s', $card['code'], $order['provider'], $order['order_ref'] ) );
}, 10, 2 );
Email template filters
For when the Customize screens do not reach far enough. Each of these receives a $template_name — one of recipient, purchaser-confirmation or balance-update — so you can target a single email.
| Filter | Description |
|---|---|
agc_email_template_settings | The resolved typography, layout, branding and section bundle, just before it reaches the template. Three arguments: the settings, the template name, the variables. |
agc_email_template_sections | The ordered list of sections that will be rendered. Reorder, drop or add to it. |
agc_email_template_section_html | Replaces one section's markup outright. Four arguments: the HTML, the section id, the template name, the section config. Return null to keep the built-in one. |
agc_email_template_custom_css | The CSS injected into the email's style block, per template. |
agc_template_path | The absolute path of the template file about to be loaded — point it at a file in your own theme or plugin to replace an email wholesale. |
add_filter( 'agc_email_template_section_html', function ( $html, $section_id, $template_name, $section ) {
if ( 'balance' === $section_id && 'balance-update' === $template_name ) {
return '<tr><td style="padding:20px;">' . esc_html__( 'Your own balance block', 'my-plugin' ) . '</td></tr>';
}
return $html;
}, 10, 4 );
These return markup that is emailed as-is, so escape anything that comes from a user. Email clients also ignore most modern CSS — stick to table layouts and inline styles, as the built-in templates do.
Purchase notification email
Not a hook, but often the simpler answer: under Settings → Delivery → Purchase notifications, switch on Notify me for every purchase to receive an email for every gift card sold, containing the code, the amount and the buyer's details. It is off by default. Physical gift cards always trigger it, since the code is never emailed to anyone else.
Common Issues
Gift Cards menu not visible
Ensure the Amelia Booking plugin is installed and activated. The Gift Cards plugin requires Amelia to function.
Payment errors
- Open Gift Cards → Settings → Payment: each payment method says whether it can be offered and, if not, why
- Verify your Stripe, Square or PayPal keys are correct
- Ensure your site has an SSL certificate (HTTPS)
- Check that webhooks are configured
- Try enabling Test Mode first
Emails not being received
- Check your spam/junk folder
- Verify the "From Email" address in settings
- Test with the built-in email test tool: Gift Cards → Settings → Email → Send Test
- Consider using an SMTP plugin like WP Mail SMTP
Form not displaying
- Check for JavaScript errors in the browser console
- Ensure the shortcode is typed correctly:
[agc_gift_card_form] - Clear any caching plugins
Diagnostics
The built-in diagnostics system (Gift Cards → Diagnostics) checks:
- System Requirements — PHP version, WordPress version, required extensions
- Plugin Dependencies — Amelia status, payment connection
- Database — table integrity, orphaned records
- Email — delivery capability, template integrity
- Performance — response times, cache status
Each section gets a health score. Click on any failing check for remediation steps.
Debug Mode
Enable debug mode at Gift Cards → Settings → Advanced → Debug Mode.
When enabled, the plugin logs detailed information about:
- Payment requests and responses
- Stripe and Square payment processing
- Email sending
- Coupon creation in Amelia
FAQ
Can I use this without Amelia?
No. Gift Cards for Amelia is designed specifically to work with the Amelia Booking plugin. It creates Amelia coupons that are used during the booking process.
Is there a free version?
No. Gift Cards for Amelia is a premium plugin available for $39/year. This includes all features, 1 year of updates, and email support.
Can I use it on multiple sites?
Each license is for a single WordPress installation. Contact us for multi-site pricing.
What happens when a gift card is purchased?
- Customer pays with Stripe, Square, PayPal or your WooCommerce checkout
- Gift card record is created in the database
- A corresponding Amelia coupon is auto-created
- Recipient receives an email with the gift card code
- Buyer receives a confirmation email
How do recipients use their gift card?
Recipients enter their gift card code in the coupon/promo code field during the Amelia booking process. The discount is applied automatically based on the card's current balance. Since v3.0 the same code can be reused on subsequent bookings until the balance reaches zero, and the recipient receives a balance email after every redemption.