xWeb Event Registration—Free Event

If you have a free event and you want to use the WEBCentralizedShoppingCartInsert and related xWeb web methods to manage the event registration, you can do so with the following case study.

First, let's define a "free event" in netFORUM. There is a flag on the event labeled Free Event. Select that checkbox and save the event to make the event free. When this flag is checked, then netFORUM will automatically suppress the creation of invoices or payments when people register for this event in xWeb.

There is one catch: the various CentralizedShoppingCart methods are built around having invoice line items--even for free events which, in the end, will not have any line items. Therefore, in the event setup in iWeb, the event manager will need to create a $0.00 Registration Fee for the event. In your xWeb integration, you'll need to allow the registrant to choose that $0.00 fee just like any other fee and add that Fee to the registrant. If you try to add a registrant to the cart without line items, you'll get a xWebException described in WEBCentralizedShoppingCartAddEventRegistrant#No_line_items_selected.

Add that $0.00 Fee to the EventsRegistrantType the same way as a regular paid fee.

When you submit the order to xWeb in WEBCentralizedShoppingCartInsert, you can pass a blank element for the Payment and Payment_Info elements. You'll need to set certain values in the Invoice element to instruct NetForum to create what's called a "terms" invoice with no payment (although it won't actually create an invoice anyway); see the code below or see Terms_Invoice_With_No_Payment for more.

When the transaction is saved, you will have an event registration but no invoice or payment.

If you do have other line items in the cart that do require payment, then treat the transaction like any other paid order. As long as you have a $0.00 registration fee with the EventsRegistrantType, then everything should work.

Code

The code below is a Visual Studio .NET C# code sample illustrating the case study:

// Instantiate web reference to xWeb and authenticate:
xWeb.netForumXML xweb = new netForumXML();
 
// Change these to your real username and password
xweb.Authenticate("xWebUserName", "xWebPassword");
 
// Set variables below. These values are for illustration purposes. In a real application
// you'll get these variables based on user inputs and the return from other web methods.
 
// Customer key of the person to be registered
Guid cst_key = new Guid("3CE2C530-2A15-41CF-B2DB-AB8C9B326823");
 
// Event Key of the Event to register for
Guid evt_key = new Guid("011E99EF-8A9A-473E-8BC6-89751676EED0");
 
// This is the price key (prc_key) for the $0.00 event registration fee
Guid FreeEventPriceFee = new Guid("7D1710CD-00D7-4E62-9A0F-B6829874DD31");
 
// This is the terms key for "Net 30 Days". This comes from ac_invoice_terms table for the
// business unit associated with the batch. Be sure you don't use a invoice terms
// key from the wrong business unit.
string InvoiceTerms_ait_key = "33846347-2BC3-4BC2-8424-01C835B4C50E";
 
// Shopping Cart object
CentralizedOrderEntryType cart = xweb.WEBCentralizedShoppingCartGetNew(cst_key);
 
// Registrant object.
EventsRegistrantType reg =
xweb.WEBCentralizedShoppingCartEventRegistrantGetNew(cst_key, evt_key);
 
// Add the $0.00 fee
 
// This is just a list of Fees for main event and sessions
// In real-life the application would determine what these are by prompting the user
List<Guid> feeGuids = new List<Guid>();
feeGuids.Add(FreeEventPriceFee);
 
// Fees Collection
Fee[] fees =new Fee[feeGuids.Count];
 
// Add each of the Fees above into the fees collection:
for (int i = 0; i < feeGuids.Count; i++)
{
Fee eventFee = new Fee();
eventFee.prc_key = feeGuids[i];
eventFee.action = FeeAction.Add;
eventFee.qty = 1;
fees[i] = eventFee;
}
 
// Add the Fees to the registrant
reg = xweb.WEBCentralizedShoppingCartEventRegistrantSetLineItems(reg, fees);
 
// Set any properties for the registrant:
reg.Registrant.reg_badge_name = "Bob";
 
// Add the Registrant to the Cart:
cart = xweb.WEBCentralizedShoppingCartAddEventRegistrant(cart, reg);
 
// You can blank out Payment and Payment_Info
cart.Payment = null; // payment;
cart.Payment_Info = null; // paymentInfo;
 
// Critical to set these values on the invoice so that it won't try to apply a payment:
cart.Invoice.inv_orig_trans_type = "terms";
cart.Invoice.inv_ait_key = InvoiceTerms_ait_key;
cart.Invoice.inv_autoapplypayment = 0;
 
// Insert the order:
cart = xweb.WEBCentralizedShoppingCartInsert(cart);

Recommendations

If you want to make free event registration easier for the end user, you might be able to detect the condition where there is only a single registration fee, and that fee is $0.00, then your application can automatically select that fee and not prompt the user to select the fee when there’s only one fee. This could condense the registration process a little bit and reduce the steps a user needs to take.