HAFiskal Loyalty for WooCommerce

By hostarena

0+ active installationsVersion 1.2.0

Loyalty points for WooCommerce shops using HA Loyalty Biz: customers enter their loyalty ID at checkout, spend points as a discount and earn points.

Description

HA Loyalty Biz is the loyalty program of the HAFiskal invoicing and fiscalization service (https://hafiskal.rs/ha-loyalty/). One program works in the physical shop (HAFiskal POS: scan the loyalty QR or enter the loyalty ID) and in the online shop (this plugin), so a customer collects and spends the same points everywhere.

In the online shop:

  • Cart and checkout show a “Loyalty program” box: the customer enters a loyalty ID, phone number or e-mail and sees their points and their value.
  • The customer can spend points as a discount. The limits (minimum points, maximum percentage of the order, value of one point) come from the program rules set in HAFiskal. The discount is applied as a cart coupon, so it is spread over the order items and the totals (and the fiscal receipt, if you use “HAFiskal for WooCommerce”) stay correct.
  • Spent points are reserved when the order is placed and finally deducted when the order is paid; if the order is cancelled or never paid, they are returned to the customer.
  • Points are added when the order is completed (or processing – configurable), and removed again if the order is cancelled or refunded.
  • New customers can join with a checkbox at checkout (“I want to join”), automatically, or not at all – your choice.
  • “My account > Loyalty points” shows the customer’s loyalty ID and balance, lets them join or link an existing loyalty ID (e.g. from the shop’s POS).
  • The order screen shows a “Loyalty” box (member, points spent, points earned) and a “Give points now” button.
  • Failed requests are retried every hour (WP-Cron).

Requirements: an HAFiskal account with the “Loyalty Biz” module enabled and a loyalty API key (in HAFiskal: Integrations > New integration > type “HA Loyalty”). The loyalty key works only for the loyalty program; fiscalization keys are not accepted.

The plugin works with the classic cart and checkout (shortcodes). The WooCommerce cart/checkout blocks are not supported yet.

External services

This plugin connects to one external service, the HAFiskal Cloud API. Nothing is sent until a loyalty API key is entered in the plugin settings. Without a key the plugin makes no requests.

HAFiskal Cloud API (HostArena)

What it is: HAFiskal is a Serbian invoicing, fiscalization and loyalty service provided by HostArena (https://hafiskal.rs). The plugin talks to the HAFiskal Cloud API at the address set in the settings (default https://api.hafiskal.rs).

What is sent, and when:

  • Program rules: read when the cart/checkout box or “My account > Loyalty points” is shown (cached for 10 minutes) and when the admin clicks “Test connection”. No personal data is sent.
  • Member lookup: when a customer enters a loyalty ID, phone number or e-mail in the cart/checkout box, or opens “My account > Loyalty points”, that value is sent to find the member; the member’s ID, name and points are returned.
  • Spending points: when an order with spent points is placed, the member’s loyalty ID, the number of points, the order total and a random order reference are sent to reserve the points.
  • Earning points: when an order is completed (or processing, if so configured), the random order reference and the order amount are sent, together with the member’s loyalty ID; for a customer who chose to join (or with automatic joining), the billing e-mail, phone and name are sent instead, to find or create the member.
  • Joining from “My account”: the customer’s name, e-mail and phone are sent to create the member.
  • Cancelled, refunded or failed orders: the random order reference is sent to return the points.

  • Service provider: HostArena, https://hafiskal.rs

  • Terms of Service: https://hafiskal.rs/uslovi-koriscenja/
  • Privacy Policy: https://hafiskal.rs/politika-privatnosti/

Installation

  1. Install and activate the plugin.
  2. In HAFiskal create an integration of type “HA Loyalty” and copy its API key.
  3. Go to WooCommerce > HAFiskal Loyalty and enter the key.
  4. Click “Proveri vezu” (Test connection) – it shows the program rules from HAFiskal.

FAQ

Where do I set how many points a customer gets?

In HAFiskal: Loyalty Biz (points per 100 RSD, value of one point, minimum points to spend, maximum % of an order, welcome bonus). The plugin always uses these rules.

What happens with points when an order is refunded?

On “Cancelled”, “Refunded” or “Failed” the plugin asks HAFiskal to reverse the order: earned points are removed and spent points are returned.

Changelog

1.2.0

  • Gift cards: customers enter a gift card code (PK-XXXX-XXXX) in the cart or at checkout; the card balance is applied as a discount (partial use is supported, the rest stays on the card). The card is charged in HAFiskal when the order is paid.

1.1.1

  • Admin notices are shown only on the Plugins screen; the settings page shows its messages inline.

1.1.0

  • Own loyalty API key (HAFiskal integration of type “HA Loyalty”); the key of the fiscalization plugin is no longer used.
  • Clear messages when a non-loyalty key is entered.

1.0.0

  • First version: loyalty ID in cart and checkout, spending points as a discount with reservation, earning points on paid orders, reversal on cancel/refund, “My account > Loyalty points”, order screen box, hourly retries.