Skip to content

Feature Proposal: Gift Cards with Native ERPNext Coupon Code Integration #94

@bvisible

Description

@bvisible

Hi,

First of all, we really appreciate the work you've done on POS Next. It's become an essential tool for our retail operations, and we're excited to contribute back to the project.

We're currently developing a feature that we believe could benefit the broader POS Next community, and we wanted to discuss it with you before submitting a PR.


🎯 What We're Building

Gift Card Sales & Management

We're implementing the ability to sell gift cards directly from the POS and manage their lifecycle:

  • Sell gift cards as a regular item → automatically generates a gift card code
  • Apply gift cards as payment method on future purchases
  • Partial usage → if gift card balance exceeds invoice total, keep the remaining balance
  • Track balance → customers can check their gift card balance

Native ERPNext Integration (Key Point)

Instead of relying solely on the existing POS Coupon doctype, we propose using ERPNext's native Coupon Code doctype with custom fields for gift card tracking.

Why this approach?

Current Approach Proposed Approach
POS Coupon → sync → ERPNext Coupon Code ERPNext Coupon Code directly
Two sources of truth Single source of truth
Sync complexity No sync needed
POS-only Works with POS + Webshop + API

🔧 Technical Overview

Custom Fields on ERPNext Coupon Code

- gift_card_amount (Currency) → Current balance
- original_gift_card_amount (Currency) → Initial value
- pos_next_gift_card (Check) → Flag for POS Next managed cards
- source_pos_invoice (Link) → Invoice that created the gift card

Integration with Pricing Rule

Each gift card creates a Pricing Rule for the discount amount, which is the standard ERPNext way of handling coupon discounts.

Flow

1. Customer buys "Gift Card" item (e.g., 50 CHF)
2. System creates:
   - Pricing Rule (discount_amount: 50)
   - Coupon Code (linked to Pricing Rule, gift_card_amount: 50)
3. Gift card code is printed/sent to customer
4. Customer uses gift card on future purchase
5. System reduces gift_card_amount and updates Pricing Rule

💡 Why We Need This

We use POS Next alongside ERPNext Webshop, and we need gift cards to work across both channels:

  • Customer buys gift card in-store → can use it online
  • Customer buys gift card online → can use it in-store
  • Single balance tracking across all channels

Using the native Coupon Code doctype makes this seamless since Webshop already uses it.


🤔 Questions for You

  1. Are you interested in this feature? We'd love to contribute it upstream if it aligns with your vision.

  2. POS Coupon deprecation? Should we keep POS Coupon for backwards compatibility, or would you consider deprecating it in favor of native ERPNext integration?

  3. Any concerns? We're open to feedback on the approach before we finalize the implementation.


Thanks for considering this proposal! We believe native ERPNext integration is the right direction for POS Next, and we're excited to contribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions