The plugin uses WordPress AJAX (admin-ajax.php) for its interactive frontend and admin features. This reference lists the available AJAX actions for developers building custom integrations. All endpoints require the appropriate nonce.
Frontend Endpoints (Free) #
| Action | Purpose |
|---|---|
spar_apply_voucher_to_cart |
Apply a reward voucher / coupon code to the cart |
spar_apply_points_redemption |
Apply a points discount to the cart |
spar_remove_points_redemption |
Remove an applied points discount |
spar_get_cart_rewards_data |
Fetch current cart rewards / redemption data |
spar_get_rewards_header |
Fetch the rewards header markup |
spar_get_rewards_box |
Fetch the rewards box HTML |
spar_redeem_reward_cart |
Redeem an individual reward from the cart context |
Frontend Endpoints (Pro) #
| Action | Purpose |
|---|---|
spar_spin_wheel |
Perform a spin on the prize wheel |
spar_get_spin_wheel_config |
Fetch the spin wheel configuration |
spar_buy_spin_with_points |
Purchase an extra spin using points |
spar_award_social_share_points |
Award points for a social share action |
spar_get_rewards_widget |
Lazy-load the floating rewards widget content |
spar_generate_referral_coupon |
Generate a referral gift coupon |
spar_check_referral_coupon |
Validate a referral coupon |
spar_sync_guest_points |
Sync guest customer points |
Admin Endpoints (Pro) #
| Action | Purpose |
|---|---|
spar_admin_load_customer_spins |
Load a customer’s spin history (admin) |
spar_admin_grant_customer_spins |
Grant bonus spins to a customer (admin) |
spar_add_guest_customer |
Create a guest customer record (admin) |
spar_update_guest_points_total |
Update a guest customer’s points (admin) |
spar_preview_email |
Preview an email template (admin) |
Sicherheit #
Every AJAX request is protected by a WordPress nonce. When building custom integrations, always pass the correct nonce for the endpoint. The plugin localises nonces into its frontend scripts (e.g. sparReferralSystem.referralNonce, sparReferralSystem.socialShare.nonce).
Note on Programmatic Access #
These AJAX endpoints are primarily intended for the plugin’s own UI. For server-side custom development, prefer the public PHP functions (see “PHP Functions Reference”) which provide a cleaner, supported API for reading and modifying points.