Gift Certificates
Unfortunately due to recent changes in ofbiz, this document may be out of date and the status of the feature is not clear.
Contents
General Overview
A customer could purchase a gift certificate or gift card and then redeem it later for purchasing another product. Gift certificates are a special kind of digital good. They are set up as products and available for purchase from stores. When the order is placed, they are immediately fulfilled by creating a financial account (FinAccount) which records the balance.
Later, when they are redeemed, the customer enters a code for a gift card, which could be either an internal gift certificate or a ValueLink external gift card. If the store is configured to use internal gift certificates, a series of authorization, capture, release, and refund services similar to those for any payment processor allow the gift certificate balance to be used for paying for an order.
Setting up Gift Certificates
Set up gift certificates as products of type of “Digital Good” in the Catalog Manager. Then, use the [Content] tab of [Edit Product] to add a ProductContent with type of “External Fulfillment Async” which points to a Content with serviceName of “ofbGcPurchase”. You can create variants of a gift certificate virtual product, and the ProductContent needs to be associated with the virtual parent item only.
Currently gift certificates' amounts are based on the prices of the gift certificates. In the future, we could use the “fixedAmount” field so that the price and value could be separate.
The information collected at the time of purchase, such as recipient email and gift message, is based on a Survey. The survey can be setup in the content manager. The survey must be set to allow anonymous responses and multiple responses, so a new user can order a gift certificate, and the same user can order a gift certificate multiple times.
General parameters for gift certificates are set in a ProductStoreFInActSetting entity which allows you to configure whether pin numbers are required, length of gift certificate numbers and pin numbers, and the survey to use for purchase information. The field validateGCFinAcct is used to tell the checkout process whether to validate the gift certificate code against FinAccounts when the user enters it as payment. (If left empty, no validation is done.) Currently this validation is only done when no pin number is required. Note that ProductStoreFinActSetting must be created in an XML file and loaded—there is no user interface for it.
Ordering Gift Certificates
Every order which goes through the system runs through a service called checkDigitalFulfillment. If there are digital items, they are fulfilled with a service called fulfillDigitalItems. In the case of a gift certificate set up above, this would cause ofbGcPurchase to be called. This would cause gift certificates and other digital items to be fulfilled immediately, regardless of whether the physical items on the same order are in stock or not. Separate invoices will be generated for the gift certificates and physical products.
OfbGcPurchase would lookup the store's gift certificate settings and then create a new FinAccount with a unique random code. It will then add the purchase amount as a FinAccountTrans transaction. Then it will use the survey to generate an email and lookup the email set in ProductStoreEmailSetting to send an email notifying recipient of gift certificate.
Fulfilling Gift Certificates
To track gift certificate fulfillment, set a BCC in ProductStoreEmailSetting to your own store, so you can have a record of the email. Also set the fromAddress to an email address which accepts bounced emails, so you can track bounced emails.
Very important: make sure that the SurveyQuestion.description fields in the gift certificate survey match the fields used in the confirmation email FTL exactly, or the email will be incorrect. For example, if your SurveyQuestion.description says “Message”, your FTL must also say ${Message}.
Viewing Fulfilled Gift Certificates
Currently there is no screen for viewing gift certificates purchased by customers on the order view in order manager. This will be added in the near future.
Using Gift Certificates to Pay
The system accepts a “gift card” for payment, which could be an internal gift certificate or external gift card system, depending on the store's payment settings. To configure for internal gift certificates, point the payment processor services to the ones for authorizing, capturing, releasing, reauthorizing, and refunding gift certificates by changing the ProductStorePaymentSetting entities for the store and payment type “GIFT_CARD”. For reference, see the ProductStorePaymentSetting entities for credit cards and gift cards in applications/ecommerce/data/DemoProduct.xml
During checkout, the user can enter a gift card code. The system would then look up the gift certificate FinAccount from the code and add it as a payment method for the user. When the user checks out, the system would use the gift certificate payment processors to handle payment.
If there are multiple payment methods (ie, gift certificate and credit card), the system currently captures the payment methods in the sequence they were added to the cart.
Order Cancellation
The release payment processor would cause the authorization against the gift certificate to expire.
Returns
The refund payment processor would cause a refund to be issued back to the original gift certificate.
Note about Recording Gift Certificate Authorizations
It is important to record the authorizations explicitly rather than rely upon an implicit check of current balances because orders usually cause inventory to be reserved for the customer. Thus, we don't want several FinAccount transactions to cause excessive inventory to be set aside, when in fact the transactions could not go through.