Hello,
Particular solution of this aim depends on couple of things, but one scenario could be following:
- Set up a gift card product, which will be offered in the store. It could be a standard product type with "Needs shipping" set to false.
- After the gift card product purchase, you or some automated API code will create a new discount coupon with some unique coupon code (e.g. some larger number or part of a hash string or GUID). You can set its time validity (from and to fields) to the current datetime and only enable it after the Order is paid by setting the
DiscountCouponValidTo to a date in the future. You could even create the coupon after the payment... it depends on your preference.
You can use
DiscoutCouponInfoProvider for all manipulations with coupons.
- Send the coupon code to the customer (actually you can send it even earlier, but it shouldn't be valid until the order is paid and it would be more consistent to send it after receiving the payment, so the customer has also a sort of confirmation of the payment)
- When the coupon code is entered in the checkout process, the custom code in the
ProcessStep method in the
ShoppingCartPreview step control (where you place an order) will handle that and update the
DiscountCouponInfo.DiscountCouponValidTo to current
DateTime, which will effectively invalidate the coupon, so it can't be used any longer.
As for the calculation of coupon discount, the already linked KB article (
KB - Discount coupon for entire order) should help to achieve that.
Is this scenario suitable for your E-commerce solution? Which details would you want to discuss?
Regards,
Zdenek